예제 #1
0
        private List <RecognitionResulType> MatchFrases(string city, string street, string pna)
        {
            List <RecognitionResulType> Results = new List <RecognitionResulType>();

            string input = city + street;

            input = ZnakiPL(RemoveAllSpecialCharacters(input, true, true, true, true)).ToLower();

            foreach (var o in Dict)
            {
                string dictfraase = ZnakiPL(RemoveAllSpecialCharacters(o.CITY_STREET_LOWER(), true, true, true, true)).ToLower();
                if (dictfraase == input)
                {
                    RecognitionResulType R = new RecognitionResulType();
                    R.Input           = city + " " + street + " " + pna;
                    R.Method          = "MatchFrases";
                    R.ResultDict      = o;
                    R.MatchPercentage = 100.00;

                    if (!Results.Contains(R))
                    {
                        Results.Add(R);
                    }
                }
            }


            return(DistResults(Results));
        }
예제 #2
0
        private List <RecognitionResulType> MatchEquals(string city, string street, string pna)
        {
            List <RecognitionResulType> Results = new List <RecognitionResulType>();



            foreach (var dd in Dict)
            {
                if (dd.CITY_LOWER() == city.ToLower())
                {
                    if (dd.STREET_LOWER() == street.ToLower())
                    {
                        if (dd.PNA == pna)
                        {
                            RecognitionResulType R = new RecognitionResulType();
                            R.Input           = city + " " + street + " " + pna;
                            R.Method          = "MatchEquals";
                            R.ResultDict      = dd;
                            R.MatchPercentage = 100.00;

                            if (!Results.Contains(R))
                            {
                                Results.Add(R);
                            }
                        }
                    }
                }
            }



            if (Results.Count == 0)
            {
                foreach (var dd in Dict)
                {
                    if (dd.CITY_LOWER() == city.ToLower())
                    {
                        if (dd.STREET_LOWER() == street.ToLower())
                        {
                            RecognitionResulType R = new RecognitionResulType();
                            R.Input           = city + " " + street + " " + pna;
                            R.Method          = "MatchEquals";
                            R.ResultDict      = dd;
                            R.MatchPercentage = 100.00;

                            if (!Results.Contains(R))
                            {
                                Results.Add(R);
                            }
                        }
                    }
                }
            }



            return(DistResults(Results));
        }
예제 #3
0
        private List <RecognitionResulType> MatchAlias(string citystreet)
        {
            List <RecognitionResulType> Results = new List <RecognitionResulType>();

            citystreet = citystreet.Replace(" ", "");

            foreach (var alias in Aliasses)
            {
                if (RemoveAllSpecialCharacters(alias.Alias.ToLower().Replace(" ", ""), true, true, true, true).Contains(citystreet.ToLower()))
                {
                    RecognitionResulType R = new RecognitionResulType();
                    R.Input           = citystreet;
                    R.Method          = "MatchAlias";
                    R.ResultDict      = alias.ToDict();
                    R.MatchPercentage = 100.00;

                    Results.Add(R);
                }
            }

            return(DistResults(Results));
        }
예제 #4
0
        private List <RecognitionResulType> MatchFrasesPNA(string city, string street, string pna)
        {
            List <RecognitionResulType> Results = new List <RecognitionResulType>();

            string input = city + street;

            input = ZnakiPL(RemoveAllSpecialCharacters(input, true, true, true, true)).ToLower();



            List <DictType> DictByPNA = new List <DictType>();

            DictByPNA = (from o in Dict
                         where ZnakiPL(RemoveAllSpecialCharacters(o.CITY_STREET_LOWER(), true, true, true, true)) == ZnakiPL(RemoveAllSpecialCharacters(city.ToLower(), true, true, true, true))
                         select o).ToList();

            if (DictByPNA.Count == 1)
            {
                if (ZnakiPL(RemoveAllSpecialCharacters(DictByPNA[0].CITY_STREET_LOWER(), true, true, true, true)).Contains(ZnakiPL(RemoveAllSpecialCharacters(street.ToLower(), true, true, true, true))))
                {
                    RecognitionResulType R = new RecognitionResulType();
                    R.Input           = city + " " + street + " " + pna;
                    R.Method          = "MatchFrases_By_PNA";
                    R.ResultDict      = DictByPNA[0];
                    R.MatchPercentage = 100.00;

                    if (!Results.Contains(R))
                    {
                        Results.Add(R);
                    }
                }
            }


            foreach (var o in DictByPNA)
            {
                string dictfraase = ZnakiPL(RemoveAllSpecialCharacters(o.CITY_STREET_LOWER(), true, true, true, true)).ToLower();
                if (dictfraase.Contains(ZnakiPL(RemoveAllSpecialCharacters(city, true, true, true, true)).ToLower()))
                {
                    if (dictfraase.Contains(ZnakiPL(RemoveAllSpecialCharacters(street, true, true, true, true)).ToLower()))
                    {
                        RecognitionResulType R = new RecognitionResulType();
                        R.Input           = city + " " + street + " " + pna;
                        R.Method          = "MatchFrasesPNA_ByCityStreet";
                        R.ResultDict      = o;
                        R.MatchPercentage = 100.00;

                        if (!Results.Contains(R))
                        {
                            Results.Add(R);
                        }
                    }
                }
            }


            foreach (var o in DictByPNA)
            {
                string dictfraase = ZnakiPL(RemoveAllSpecialCharacters(o.CITY_STREET_LOWER(), true, true, true, true)).ToLower();

                foreach (var cityword in city.Split(' '))
                {
                    if (dictfraase.Contains(ZnakiPL(cityword).ToLower()))
                    {
                        foreach (var streetword in street.Split(' '))
                        {
                            if (dictfraase.Contains(ZnakiPL(streetword).ToLower()))
                            {
                                RecognitionResulType R = new RecognitionResulType();
                                R.Input           = city + " " + street + " " + pna;
                                R.Method          = "MatchFrasesPNA_ByPartOf_CityStreet";
                                R.ResultDict      = o;
                                R.MatchPercentage = 100.00;

                                if (!Results.Contains(R))
                                {
                                    Results.Add(R);
                                }
                            }
                        }
                    }
                }
            }


            if (Results.Count == 0)
            {
                DictByPNA = (from o in Dict
                             where o.PNA == pna
                             select o).ToList();

                if (DictByPNA.Count == 1)
                {
                    double perm = PercentageMatcher(DictByPNA[0].Street, street);
                    if (perm > PercentageMatcherPrecision)
                    {
                        RecognitionResulType R = new RecognitionResulType();
                        R.Input           = city + " " + street + " " + pna;
                        R.Method          = "MatchFrases_By_PNA";
                        R.ResultDict      = DictByPNA[0];
                        R.MatchPercentage = 100.00;

                        if (!Results.Contains(R))
                        {
                            Results.Add(R);
                        }
                    }
                    else
                    {
                        NoMatched.Add(city + "_" + street + "_" + pna + "_" + perm);
                    }
                }
            }


            return(DistResults(Results));
        }
예제 #5
0
        private List <RecognitionResulType> ContainsFrases(string city, string street, string pna)
        {
            List <RecognitionResulType> Results = new List <RecognitionResulType>();


            string input = city + street;

            input = ZnakiPL(RemoveAllSpecialCharacters(input, true, true, true, true)).ToLower();

            foreach (var o in Dict)
            {
                string dictfraase = ZnakiPL(RemoveAllSpecialCharacters(o.CITY_STREET_LOWER(), true, true, true, true)).ToLower();
                if (dictfraase.Contains(input))
                {
                    RecognitionResulType R = new RecognitionResulType();
                    R.Input           = city + " " + street + " " + pna;
                    R.Method          = "ContainsFrases";
                    R.ResultDict      = o;
                    R.MatchPercentage = 100.00;

                    if (!Results.Contains(R))
                    {
                        Results.Add(R);
                    }
                }

                if (input.Contains(dictfraase))
                {
                    RecognitionResulType R = new RecognitionResulType();
                    R.Input           = city + " " + street + " " + pna;
                    R.Method          = "ContainsFrases";
                    R.ResultDict      = o;
                    R.MatchPercentage = 100.00;

                    if (!Results.Contains(R))
                    {
                        Results.Add(R);
                    }
                }
            }

            if (Results.Count == 0)
            {
                input = street;
                input = ZnakiPL(RemoveAllSpecialCharacters(input, true, true, true, false)).ToLower();

                foreach (var o in Dict)
                {
                    string dictfraase = ZnakiPL(RemoveAllSpecialCharacters(o.CITY_STREET_LOWER(), true, true, true, true)).ToLower();


                    if (ZnakiPL(RemoveAllSpecialCharacters(o.City, true, true, true, true)).ToLower().Contains(ZnakiPL(RemoveAllSpecialCharacters(city, true, true, true, true)).ToLower()))
                    {
                        foreach (var word in input.Split(' '))
                        {
                            if (dictfraase.Contains(word))
                            {
                                RecognitionResulType R = new RecognitionResulType();
                                R.Input           = city + " " + street + " " + pna;
                                R.Method          = "ContainsFrasesByPArtWord";
                                R.ResultDict      = o;
                                R.MatchPercentage = 100.00;

                                if (!Results.Contains(R))
                                {
                                    Results.Add(R);
                                }
                            }

                            if (word.Contains(dictfraase))
                            {
                                RecognitionResulType R = new RecognitionResulType();
                                R.Input           = city + " " + street + " " + pna;
                                R.Method          = "ContainsFrasesByPArtWordDict";
                                R.ResultDict      = o;
                                R.MatchPercentage = 100.00;

                                if (!Results.Contains(R))
                                {
                                    Results.Add(R);
                                }
                            }
                        }
                    }
                }
            }


            return(DistResults(Results));
        }