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); }
public NameSearchScores(NameSearchRatios nameSearchRatios) { this.nameSearchRatios = nameSearchRatios; this.nameSearchPercentage = CalculatePercentages(nameSearchRatios); }