|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bericotech.clavin.util.DamerauLevenshtein
public class DamerauLevenshtein
Utility functions for calculating edit distance between strings, consistent with the Damerau-Levenshtein metric. Transposition, substitution, insertion, and deletion operations are all considered to be one edit each. Multiple substring edits (e.g., adjacent transpositions) are supported, unlike in "optimal string alignment distance" where no substring may be edited more than once.
| Constructor Summary | |
|---|---|
DamerauLevenshtein()
|
|
| Method Summary | |
|---|---|
static int |
damerauLevenshteinDistance(String str1,
String str2)
Computes the true Damerau–Levenshtein edit distance (with adjacent transpositions) between two given strings. Based on C# code from Wikipedia. |
static int |
damerauLevenshteinDistanceCaseInsensitive(String str1,
String str2)
Convenience method for calling damerauLevenshteinDistance(String str1, String str2)
when you don't care about case sensitivity. |
static boolean |
isEditDistance1(String str1,
String str2)
Fast method for determining whether the Damerau-Levenshtein edit distance between two strings is less than 2. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DamerauLevenshtein()
| Method Detail |
|---|
public static int damerauLevenshteinDistance(String str1,
String str2)
str1 - First string being comparedstr2 - Second string being compared
public static int damerauLevenshteinDistanceCaseInsensitive(String str1,
String str2)
damerauLevenshteinDistance(String str1, String str2)
when you don't care about case sensitivity.
str1 - First string being comparedstr2 - Second string being compared
public static boolean isEditDistance1(String str1,
String str2)
damerauLevenshteinDistance(String str1, String str2)
which explores every path between every string to get the exact
edit distance. Despite the speed boost, we maintain consistency
with damerauLevenshteinDistance(String str1, String str2).
str1 - First string being comparedstr2 - Second string being compared
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||