示例#1
0
        MatchResultSet LongestCommonSubsequence(NameSet target)
        {
            MatchResultSet result = new MatchResultSet();

            foreach (string str1 in this.names)
            {
                int index = target.Names.IndexOf(str1);
                if (index > -1)
                {
                    result.Add(str1, str1, 100);
                }
                else
                {
                    string best  = "";
                    int    score = 0;
                    foreach (string str2 in target.Names)
                    {
                        int lcs = Utilities.LcsLength(str1, str2);
                        if (lcs > score)
                        {
                            score = lcs;
                            best  = str2;
                        }
                    }
                    result.Add(str1, best, score);
                }
            }
            return(result);
        }
示例#2
0
        MatchResultSet Basic(NameSet target)
        {
            MatchResultSet result = new MatchResultSet();

            foreach (string str1 in this.names)
            {
                int index = target.Names.IndexOf(str1);
                if (index > -1)
                {
                    result.Add(str1, str1, 1);
                }
                else
                {
                    result.Add(str1, "", 0);
                }
            }
            return(result);
        }
示例#3
0
        public MatchResultSet MatchAllFacilities(CsvTable csv1, CsvTable csv2)
        {
            List <string> results = new List <string>();

            if (csv1 == null || csv2 == null)
            {
                return(null);
            }

            AdminTree admin1 = new AdminTree(csv1, applicationOptions.Country);

            admin1.AddFacilityNodes(csv1);
            AdminTree admin2 = new AdminTree(csv2, applicationOptions.Country);

            admin2.AddFacilityNodes(csv2);
            AdminIterator  adminNodes      = new AdminIterator(admin1);
            MatchResultSet resultsToReturn = new MatchResultSet();

            foreach (AdminTreeNode node in adminNodes)
            {
                Console.WriteLine(node.Name);
                if (node.IsFacility)
                {
                    string      path = node.Path;
                    NameSet     facilitiesToMatch = admin2.GetFacilities(path);
                    MatchResult result            = facilitiesToMatch.FindBestMatch(node.Name);

                    if (GoodMatch(node.Name, result))
                    {
                        string resultString = path + "\\" + result.ToString();
                        results.Add(resultString);
                        result.FullPath = path;
                        resultsToReturn.Add(result);
                    }
                }
            }

            displayManager.DisplayTextFile(results, 10000);
            return(resultsToReturn);
        }