public class Speller extends Object
s_fsa
package.Modifier and Type | Field and Description |
---|---|
protected CharsetDecoder |
decoder
Charset decoder for the FSA.
|
protected FSA |
fsa
The FSA we are using.
|
static int |
MAX_WORD_LENGTH |
Constructor and Description |
---|
Speller(Dictionary dictionary) |
Speller(Dictionary dictionary,
int editDistance) |
Speller(Dictionary dictionary,
int editDistance,
boolean convertCase) |
Modifier and Type | Method and Description |
---|---|
int |
cuted(int depth)
Calculates cut-off edit distance.
|
int |
ed(int i,
int j)
Calculates edit distance.
|
List<String> |
findReplacements(String word)
Find suggestions by using K.
|
List<String> |
getAllReplacements(String str,
int fromIndex,
int level)
Returns a list of all possible replacements of a given string
|
int |
getCandLen() |
int |
getEffectiveED() |
int |
getFrequency(CharSequence word)
Get the frequency value for a word form.
|
int |
getWordLen() |
boolean |
isCamelCase(String str) |
boolean |
isInDictionary(CharSequence word)
Test whether the word is found in the dictionary.
|
boolean |
isMisspelled(String word) |
List<String> |
replaceRunOnWords(String original)
Propose suggestions for misspelled run-on words.
|
public static int MAX_WORD_LENGTH
protected final CharsetDecoder decoder
protected final FSA fsa
public Speller(Dictionary dictionary)
public Speller(Dictionary dictionary, int editDistance)
public Speller(Dictionary dictionary, int editDistance, boolean convertCase)
public boolean isMisspelled(String word)
public boolean isInDictionary(CharSequence word)
word
- the word to be testedpublic int getFrequency(CharSequence word)
word
- the word to be testedpublic List<String> replaceRunOnWords(String original)
original
- The original misspelled word.public List<String> findReplacements(String word) throws CharacterCodingException
word
- The original misspelled word.CharacterCodingException
public int ed(int i, int j)
i
- length of first word (here: misspelled) - 1;j
- length of second word (here: candidate) - 1.public int cuted(int depth)
depth
- current length of candidates.public boolean isCamelCase(String str)
public List<String> getAllReplacements(String str, int fromIndex, int level)
public final int getWordLen()
public final int getCandLen()
public final int getEffectiveED()
Copyright © 2017. All rights reserved.