public class EditDistance extends Object
Refer to a computer science text book for the definition of the "string edit distance".
Modifier and Type | Method and Description |
---|---|
static int |
editDistance(String a,
String b)
Computes the edit distance between two strings.
|
static String |
findNearest(String key,
Collection<String> group)
Finds the string in the
group closest to
key and returns it. |
static String |
findNearest(String key,
String[] group)
Finds the string in the
group closest to
key and returns it. |
public static int editDistance(String a, String b)
The complexity is O(nm) where n=a.length() and m=b.length().
public static String findNearest(String key, String[] group)
group
closest to
key
and returns it.public static String findNearest(String key, Collection<String> group)
group
closest to
key
and returns it.Copyright © 2017 JBoss by Red Hat. All rights reserved.