Refer to a computer science text book for the definition of the "string edit distance".
| Modifier and Type | Field and Description |
|---|---|
| private final String | a
Two strings to be compared. |
| private final String | b
Two strings to be compared. |
| private int[] | back
back buffer. |
| private static final WeakHashMap | CACHE
Weak results cache to avoid additional computations. |
| private int[] | cost
cost vector. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private int | |
| public static int | |
| public static String | Returns: null if group.length==0.Finds the string in the |
| public static String | Returns: null if group.length==0.Finds the string in the |
| private void | |
| private int |
| a | back to summary |
|---|---|
| private final String a Two strings to be compared. | |
| b | back to summary |
|---|---|
| private final String b Two strings to be compared. | |
| back | back to summary |
|---|---|
| private int[] back back buffer. | |
| CACHE | back to summary |
|---|---|
| private static final WeakHashMap<AbstractMap. Weak results cache to avoid additional computations. Because of high complexity caching is required. | |
| cost | back to summary |
|---|---|
| private int[] cost cost vector. | |
| EditDistance | back to summary |
|---|---|
| private EditDistance(String a, String b) | |
| calc | back to summary |
|---|---|
| private int calc() | |
| editDistance | back to summary |
|---|---|
| public static int editDistance(String a, String b) Computes the edit distance between two strings. The complexity is O(nm) where n=a.length() and m=b.length(). | |
| findNearest | back to summary |
|---|---|
| public static String findNearest(String key, String[] group) Finds the string in the
| |
| findNearest | back to summary |
|---|---|
| public static String findNearest(String key, Collection<String> group) Finds the string in the
| |
| flip | back to summary |
|---|---|
| private void flip() Swaps two buffers. | |
| min | back to summary |
|---|---|
| private int min(int a, int b, int c) | |