LevenshteinDistance#apply(CharSequence, CharSequence)
to calculate the edit distance between two strings. Provides useful helper
methods to traverse a set of strings and select the most similar ones
to a given input string.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static < the type of the strings in the given collection T extends CharSequence> T | Returns: the string with the lowest Levenshtein distancethe collection to search ss, CharSequence the second string t)Searches the given collection of strings and returns the string that
has the lowest Levenshtein distance to a given second string |
| public static < the type of the strings in the given collection T extends CharSequence> Collection | Returns: the strings with the lowest Levenshtein distancethe collection to search ss, CharSequence the string to compare to t, int the maximum number of strings to return n, int a threshold for individual item distances. Only items
with a distance below this threshold will be included in the result. threshold)Searches the given collection of strings and returns a collection of at
most |
| public static < the type of the strings in the given collection T extends CharSequence> Collection | Returns: a collection with similar stringsthe collection to search ss, CharSequence the string to compare to t)Searches the given collection of strings and returns a collection of
strings similar to a given string |
| Levenshtein | back to summary |
|---|---|
| public Levenshtein() | |
| findMinimum | back to summary |
|---|---|
| public static <T extends CharSequence> T findMinimum(Collection<T> ss, CharSequence t) Searches the given collection of strings and returns the string that
has the lowest Levenshtein distance to a given second string
| |
| findMinimum | back to summary |
|---|---|
| public static <T extends CharSequence> Collection Searches the given collection of strings and returns a collection of at
most
| |
| findSimilar | back to summary |
|---|---|
| public static <T extends CharSequence> Collection Searches the given collection of strings and returns a collection of
strings similar to a given string
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | compareTo(Levenshtein.
Implements java. Compares this object with the specified object for order. |
| distance | back to summary |
|---|---|
| private final int distance | |
| str | back to summary |
|---|---|
| private final T str | |
| Item | back to summary |
|---|---|
| public Item(T str, int distance) | |
| compareTo | back to summary |
|---|---|
| public int compareTo(Levenshtein. Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |