public class StringSimilarityServiceImpl extends Object implements StringSimilarityService
StringSimilarityService| Constructor and Description |
|---|
StringSimilarityServiceImpl(SimilarityStrategy strategy)
Creates a similarity calculator instance.
|
| Modifier and Type | Method and Description |
|---|---|
SimilarityScore |
findTop(List<String> features,
String target)
Finds the feature within a set of given features that best match the target string.
|
SimilarityScore |
findTop(List<String> features,
String target,
Comparator<SimilarityScore> comparator)
Finds the feature within a set of given features that best match the target string.
|
double |
score(String feature,
String target)
Calculates the similarity score of a single feature.
|
List<SimilarityScore> |
scoreAll(List<String> features,
String target)
Calculates all similarity scores for a given set of features.
|
public StringSimilarityServiceImpl(SimilarityStrategy strategy)
strategy - The similarity strategy to use when calculating similarity scores.public List<SimilarityScore> scoreAll(List<String> features, String target)
scoreAll in interface StringSimilarityServicefeatures - The list of features.target - The target string to compare against the features.public double score(String feature, String target)
score in interface StringSimilarityServicefeature - The feature string to compare.target - The target string to compare against the feature.public SimilarityScore findTop(List<String> features, String target)
findTop in interface StringSimilarityServicefeatures - A list of strings containing the features to compare.target - The target string to compare against the features.public SimilarityScore findTop(List<String> features, String target, Comparator<SimilarityScore> comparator)
findTop in interface StringSimilarityServicefeatures - A list of strings containing the features to compare.target - The target string to compare against the features.comparator - A comparator that is used sort the scores.Copyright © 2016. All rights reserved.