org.incava.text
public class SpellChecker extends Object
Field Summary | |
---|---|
protected static int | ARR_SIZE |
protected static int | COMP_LEN |
static int | DEFAULT_MAX_DISTANCE |
Method Summary | |
---|---|
boolean | addDictionary(String dictionary)
Adds the given dictionary. |
void | addWord(String word) |
protected int | compare(String str1, int len1, String str2, int len2)
Compares the two characters. |
int | editDistance(String str1, String str2)
Computes the Levenstein edit distance between the two words, with a
maximum of 3, at which point the distance is no longer computed. |
int | editDistance(String str1, String str2, int maximum)
Computes the Levenstein edit distance between the two words. |
String | getKey(String word) |
boolean | hasWord(String word) |
boolean | isCorrect(String word, int maxEditDistance, Map nearMatches) |
boolean | isCorrect(String word, Map nearMatches) |
protected static int | min3(int x, int y, int z) |
boolean | nearMatch(String str1, String str2) |
Parameters: nearMatches a map from edit distances to matches.