public EnPlaceMatcher()

in src/cs/Microsoft.PhoneticMatching/Matchers/PlaceMatcher/EnPlaceMatcher.cs [41:86]


        public EnPlaceMatcher(IList<Place> places, Func<Place, PlaceFields> placeFieldsExtractor, MatcherConfig config)
            : base(config)
        {
            var targetEqualityComparer = new TargetEqualityComparer();
            var targets = new HashSet<Target<Place>>(targetEqualityComparer);

            this.maxWindowSize = 1;
            for (int idx = 0; idx < places.Count; ++idx)
            {
                var place = places[idx];
                var fields = placeFieldsExtractor(place);

                var name = string.Empty;
                var address = string.Empty;

                if (fields.Name != null)
                {
                    name = Preprocessor.PreProcess(fields.Name);
                }

                if (fields.Address != null)
                {
                    address = Preprocessor.PreProcess(fields.Address);
                }

                IList<Target<Place>> nameVariations = this.AddNameVariations(place, idx, name, address);
                this.maxWindowSize = Math.Max(this.maxWindowSize, nameVariations.Count);

                targets.UnionWith(nameVariations);

                if (fields.Types != null)
                {
                    foreach (var type in fields.Types)
                    {
                        var fieldVariations = this.AddNameVariations(place, idx, type);
                        this.maxWindowSize = Math.Max(this.maxWindowSize, fieldVariations.Count);
                        targets.UnionWith(fieldVariations);
                    }
                }
            }

            this.fuzzyMatcher = new EnHybridFuzzyMatcher<Target<Place>>(
                targets.ToArray(),
                this.Config.PhoneticWeightPercentage,
                (target) => target.Phrase);
        }