Example #1
0
 private static float GetSimHash(string str1, string str2)
 {
     IAnalyser analyser = new SimHashAnalyser();
     return analyser.GetLikenessValue(str1, str2) * 100;
 }
Example #2
0
        //字符串两两组合。
        //需要一个新的类型
        private static List<UrlCombination> GetCombinatorics(List<string> list)
        {
            List<UrlCombination> comList = new List<UrlCombination>();
            IAnalyser analyser = new SimHashAnalyser();
            foreach (var row in new Combination(list.Count, 2).GetRows())//row里存了,m中选出n,和结果数。
            {
                UrlCombination urlCom = new UrlCombination();
                List<string> com = Combination.Permute(row, list);//Combination.Permute(row, list)返回一个组合
                urlCom.Url1 = com[0];
                urlCom.Url2 = com[1];
                //SimHash运算
                urlCom.SimHash = analyser.GetLikenessValue(com[0], com[1]) * 100;
                comList.Add(urlCom);
            }

            return comList;
        }