public class DichotomyDiskSpellingDictionary extends ASpellSpellingDictionary
SpellDictionary that doesn't cache any
words in memory. Avoids the huge footprint of
SpellDictionaryHashMap at the cost of relatively minor latency.
A future version of this class that implements some caching strategies might
be a good idea in the future, if there's any demand for it.
This implementation requires a special dictionary file, with "code*word"
lines sorted by code. It's using a dichotomy algorithm to search for words in
the dictionarytransformator| Constructor and Description |
|---|
DichotomyDiskSpellingDictionary(java.io.File wordListFile)
Dictionary convenience Constructor.
|
DichotomyDiskSpellingDictionary(java.io.File wordListFile,
java.io.File phoneticFile)
Dictionary constructor that uses an aspell phonetic file to build the
transformation table.
|
DichotomyDiskSpellingDictionary(java.io.File wordListFile,
java.io.File phoneticFile,
java.lang.String encoding)
Dictionary constructor that uses an aspell phonetic file to build the
transformation table.
|
DichotomyDiskSpellingDictionary(java.io.File wordListFile,
java.lang.String encoding)
Dictionary convenience Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addWord(java.lang.String word)
Add a word permanently to the dictionary (and the dictionary file).
|
java.util.List<java.lang.String> |
getWords(java.lang.String code)
Returns a list of strings (words) for the code.
|
getPhoneticCode, getSuggestions, getSuggestions, isCorrectpublic DichotomyDiskSpellingDictionary(java.io.File wordListFile)
throws java.io.FileNotFoundException,
java.io.IOException
wordListFile - The file containing the words list for the dictionaryjava.io.FileNotFoundException - indicates problems locating the
words list file on the systemjava.io.IOException - indicates problems reading the words list
filepublic DichotomyDiskSpellingDictionary(java.io.File wordListFile,
java.lang.String encoding)
throws java.io.FileNotFoundException,
java.io.IOException
wordListFile - The file containing the words list for the dictionaryencoding - Uses the character set encoding specifiedjava.io.FileNotFoundException - indicates problems locating the
words list file on the systemjava.io.IOException - indicates problems reading the words list
filepublic DichotomyDiskSpellingDictionary(java.io.File wordListFile,
java.io.File phoneticFile)
throws java.io.FileNotFoundException,
java.io.IOException
wordListFile - The file containing the words list for the dictionaryphoneticFile - The file to use for phonetic transformation of the
wordlist.java.io.FileNotFoundException - indicates problems locating the
file on the systemjava.io.IOException - indicates problems reading the words list
filepublic DichotomyDiskSpellingDictionary(java.io.File wordListFile,
java.io.File phoneticFile,
java.lang.String encoding)
throws java.io.FileNotFoundException,
java.io.IOException
wordListFile - The file containing the words list for the dictionaryphoneticFile - The file to use for phonetic transformation of the
wordlist.encoding - Uses the character set encoding specifiedjava.io.FileNotFoundException - indicates problems locating the
file on the systemjava.io.IOException - indicates problems reading the words list
filepublic void addWord(java.lang.String word)
word - The word to add.public java.util.List<java.lang.String> getWords(java.lang.String code)
getWords in class ASpellSpellingDictionarycode - The phonetic code common to the list of words