/** * Finds the feature within a set of given features that best match the target string. * @param features A list of strings containing the features to compare. * @param target The target string to compare against the features. * @param comparator A comparator that is used sort the scores. * @return A SimilarityScore that has the top value amongst the features, according to the comparator. */ public SimilarityScore findTop(List<String> features, String target, Comparator<SimilarityScore> comparator) { if (features.size() == 0) { return null; } List<SimilarityScore> scores= scoreAll(features, target); Collections.sort(scores, comparator); return scores.get(0); } }
/** * Finds the feature within a set of given features that best match the target string. * @param features A list of strings containing the features to compare. * @param target The target string to compare against the features. * @param comparator A comparator that is used sort the scores. * @return A SimilarityScore that has the top value amongst the features, according to the comparator. */ public SimilarityScore findTop(List<String> features, String target, Comparator<SimilarityScore> comparator) { if (features.size() == 0) { return null; } List<SimilarityScore> scores= scoreAll(features, target); Collections.sort(scores, comparator); return scores.get(0); } }
/** * Finds the feature within a set of given features that best match the target string. * @param features A list of strings containing the features to compare. * @param target The target string to compare against the features. * @param comparator A comparator that is used sort the scores. * @return A SimilarityScore that has the top value amongst the features, according to the comparator. */ public SimilarityScore findTop(List<String> features, String target, Comparator<SimilarityScore> comparator) { if (features.size() == 0) { return null; } List<SimilarityScore> scores= scoreAll(features, target); Collections.sort(scores, comparator); return scores.get(0); } }
/** * Finds the feature within a set of given features that best match the target string. * @param features A list of strings containing the features to compare. * @param target The target string to compare against the features. * @param comparator A comparator that is used sort the scores. * @return A SimilarityScore that has the top value amongst the features, according to the comparator. */ public SimilarityScore findTop(List<String> features, String target, Comparator<SimilarityScore> comparator) { if (features.size() == 0) { return null; } List<SimilarityScore> scores= scoreAll(features, target); Collections.sort(scores, comparator); return scores.get(0); } }