@Immutable public class Levenshtein extends Object implements MetricStringDistance
Constructor and Description |
---|
Levenshtein() |
Modifier and Type | Method and Description |
---|---|
double |
distance(String s1,
String s2)
The Levenshtein distance, or edit distance, between two words is the
minimum number of single-character edits (insertions, deletions or
substitutions) required to change one word into the other.
|
public final double distance(String s1, String s2)
distance
in interface MetricStringDistance
distance
in interface StringDistance
s1
- The first string to compare.s2
- The second string to compare.NullPointerException
- if s1 or s2 is null.Copyright © 2017. All rights reserved.