public class Similarity extends Object
| Constructor and Description |
|---|
Similarity() |
| Modifier and Type | Method and Description |
|---|---|
static int |
compute(String s1,
String s2)
Computes similarity score for two strings using Levenshtein distance.
|
static int |
computeBiased(String probe,
String candidate)
Computes similarity score for two strings using modified Levenshtein distance.
|
static ArrayList<String> |
head(String probe,
List<String> candidates,
int max,
int threshold)
Returns a list of strings from
candidates that are most similar to probe. |
static ArrayList<String> |
head(String probe,
List<String> candidates,
int max,
int threshold,
BiFunction<String,String,Integer> computeScore)
Returns a list of strings from
candidates that are most similar to probe. |
public static int compute(String s1, String s2)
s1 - First string to compare.s2 - Second string to compare.public static int computeBiased(String probe, String candidate)
probe - probe string.candidate - Candidate stringpublic static ArrayList<String> head(String probe, List<String> candidates, int max, int threshold)
candidates that are most similar to probe.
Similarity is computed using Levenshtein distance.probe - Test string.candidates - List of strings from which those most similar to probe should be selected.max - Maximum number of strings to select.threshold - Only strings with similarity score below threshold can be selected.public static ArrayList<String> head(String probe, List<String> candidates, int max, int threshold, BiFunction<String,String,Integer> computeScore)
candidates that are most similar to probe.probe - Test string.candidates - List of strings from which those most similar to probe should be selected.max - Maximum number of strings to select.threshold - Only strings with similarity score below threshold can be selected.computeScore - Function that computes similarity score between probe and candidate.Copyright © 2023 LSST. All rights reserved.