Example usage for Java org.apache.commons.text.similarity LevenshteinDistance fields, constructors, methods, implement or subclass
The text is from its open source code.
LevenshteinDistance() This returns the default instance that uses a version of the algorithm that does not use a threshold parameter. |
Integer | apply(final CharSequence left, final CharSequence right) Find the Levenshtein distance between two Strings. A higher score indicates a greater distance. The previous implementation of the Levenshtein distance algorithm was from http://www.merriampark.com/ld.htm Chas Emerick has written an implementation in Java, which avoids an OutOfMemoryError which can occur when my Java implementation is used with very large strings. distance.apply(null, *) = IllegalArgumentException distance.apply(*, null) = IllegalArgumentException distance.apply("","") = 0 distance.apply("","a") = 1 distance.apply("aaapppp", "") = 7 distance.apply("frog", "fog") = 1 distance.apply("fly", "ant") = 3 distance.apply("elephant", "hippo") = 7 distance.apply("hippo", "elephant") = 7 distance.apply("hippo", "zzzzzzzz") = 8 distance.apply("hello", "hallo") = 1 |
LevenshteinDistance | getDefaultInstance() Gets the default instance. |