This is the number of changes needed to change one sequence into another, where each change is a single character modification (deletion, insertion, substitution, or transposition of two adjacent characters).
| Access | Constructor and Description |
|---|---|
| public | DamerauLevenshteinDistance()
Constructs a default instance that uses a version of the algorithm that does not use a threshold parameter. |
| public | DamerauLevenshteinDistance(final Integer
If this is null then distances calculations will not be limited. This may not be negative. threshold)Constructs a new instance. |
| Modifier and Type | Method and Description |
|---|---|
| public Integer | Returns: result distance, or -1 if threshold is exceeded.the first input, must not be null. left, final CharSequence the second input, must not be null. right)Implements org. Computes the Damerau-Levenshtein distance between two Strings. |
| public < The type of similarity score unit. E> Integer | Returns: result distance, or -1 if threshold is exceeded.the first input, must not be null. left, final SimilarityInput<E> the second input, must not be null. right)Implements org. Computes the Damerau-Levenshtein distance between two inputs. |
| private static int | Returns: The distance value, or-1 if distance is greater than threshold.The distance value. distance, final int The threshold value. threshold)Utility function to ensure distance is valid according to threshold. |
| public Integer | |
| private static <E> int | Returns: result distance, or -1 if distance exceeds threshold.the first SimilarityInput, must not be null. left, SimilarityInput<E> the second SimilarityInput, must not be null. right, final int the target threshold, must not be negative. threshold)Finds the Damerau-Levenshtein distance between two CharSequences if it's less than or equal to a given threshold. |
| private static <E> int | Returns: result distance.the first CharSequence, must not be null. left, SimilarityInput<E> the second CharSequence, must not be null. right)Finds the Damerau-Levenshtein distance between two inputs using optimal string alignment. |
| threshold | back to summary |
|---|---|
| private final Integer threshold Threshold. | |
| DamerauLevenshteinDistance | back to summary |
|---|---|
| public DamerauLevenshteinDistance() Constructs a default instance that uses a version of the algorithm that does not use a threshold parameter. | |
| DamerauLevenshteinDistance | back to summary |
|---|---|
| public DamerauLevenshteinDistance(final Integer threshold) Constructs a new instance. If the threshold is not null, distance calculations will be limited to a maximum length. If the threshold is null, the unlimited version of the algorithm will be used.
| |
| apply | back to summary |
|---|---|
| public Integer apply(final CharSequence left, final CharSequence right) Implements org. Computes the Damerau-Levenshtein distance between two Strings. A higher score indicates a greater distance.
| |
| apply | back to summary |
|---|---|
| public <E> Integer apply(final SimilarityInput<E> left, final SimilarityInput<E> right) Implements org. Computes the Damerau-Levenshtein distance between two inputs. A higher score indicates a greater distance.
| |
| clampDistance | back to summary |
|---|---|
| private static int clampDistance(final int distance, final int threshold) Utility function to ensure distance is valid according to threshold.
| |
| getThreshold | back to summary |
|---|---|
| public Integer getThreshold() Gets the distance threshold.
| |
| limitedCompare | back to summary |
|---|---|
| private static <E> int limitedCompare(SimilarityInput<E> left, SimilarityInput<E> right, final int threshold) Finds the Damerau-Levenshtein distance between two CharSequences if it's less than or equal to a given threshold.
| |
| unlimitedCompare | back to summary |
|---|---|
| private static <E> int unlimitedCompare(SimilarityInput<E> left, SimilarityInput<E> right) Finds the Damerau-Levenshtein distance between two inputs using optimal string alignment.
| |