示例#1
0
        private NameSearchPercentage CalculatePercentages(NameSearchRatios nameSearchRatios)
        {
            NameSearchPercentage nameSearchPercentage = new NameSearchPercentage();

            int totalPoints = nameSearchRatios.ExactMatchNoNormalization +
                              nameSearchRatios.ExactMatchWithNormalization +
                              nameSearchRatios.ExactMatchWithNormalizationOutOfOrder +
                              nameSearchRatios.MatchWithoutPlurals +
                              nameSearchRatios.MatchSpellings +
                              nameSearchRatios.MatchSoundsLike;

            nameSearchPercentage.ExactMatchNoNormalizationPercentage             = (float)(nameSearchRatios.ExactMatchNoNormalization * PercentageMultiplier) / totalPoints;
            nameSearchPercentage.ExactMatchWithNormalizationPercentage           = (float)(nameSearchRatios.ExactMatchWithNormalization * PercentageMultiplier) / totalPoints;
            nameSearchPercentage.ExactMatchWithNormalizationOutOfOrderPercentage = (float)(nameSearchRatios.ExactMatchWithNormalizationOutOfOrder * PercentageMultiplier) / totalPoints;
            nameSearchPercentage.MatchWithoutPluralsPercentage = (float)(nameSearchRatios.MatchWithoutPlurals * PercentageMultiplier) / totalPoints;
            nameSearchPercentage.MatchSpellingsPercentage      = (float)(nameSearchRatios.MatchSpellings * PercentageMultiplier) / totalPoints;
            nameSearchPercentage.MatchSoundsLikePercentage     = (float)(nameSearchRatios.MatchSoundsLike * PercentageMultiplier) / totalPoints;

            return(nameSearchPercentage);
        }
示例#2
0
        public NameSearchScores(NameSearchRatios nameSearchRatios)
        {
            this.nameSearchRatios = nameSearchRatios;

            this.nameSearchPercentage = CalculatePercentages(nameSearchRatios);
        }