public class CachedDichotomyDiskSpellingDictionary extends DichotomyDiskSpellingDictionary
SpellDictionary this one is based on Damien
Guillaume's Diskbased dictionary but adds a cache to try to improve a bit on
performance.transformator| Constructor and Description |
|---|
CachedDichotomyDiskSpellingDictionary(java.io.File wordList)
Dictionary Convenience Constructor.
|
CachedDichotomyDiskSpellingDictionary(java.io.File wordList,
java.io.File phonetic)
Dictionary constructor that uses an aspell phonetic file to build the
transformation table.
|
CachedDichotomyDiskSpellingDictionary(java.io.File wordList,
java.io.File phonetic,
java.lang.String encoding)
Dictionary constructor that uses an aspell phonetic file to build the
transformation table.
|
CachedDichotomyDiskSpellingDictionary(java.io.File wordList,
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).
|
void |
clearCache()
Clears the cache.
|
java.util.List<java.lang.String> |
getWords(java.lang.String code)
Returns a list of strings (words) for the code.
|
void |
saveCache() |
getPhoneticCode, getSuggestions, getSuggestions, isCorrectpublic CachedDichotomyDiskSpellingDictionary(java.io.File wordList)
throws java.io.FileNotFoundException,
java.io.IOException
wordList - a file containing a list of words one per line.java.io.FileNotFoundException - if file is not accessiblejava.io.IOExceptionpublic CachedDichotomyDiskSpellingDictionary(java.io.File wordList,
java.lang.String encoding)
throws java.io.FileNotFoundException,
java.io.IOException
wordList - a file containing a list of wordsencoding - the encoding for the filejava.io.FileNotFoundException - if the file cannot be locatedjava.io.IOExceptionpublic CachedDichotomyDiskSpellingDictionary(java.io.File wordList,
java.io.File phonetic)
throws java.io.FileNotFoundException,
java.io.IOException
wordList - a file containing a list of words.phonetic - an aspell phonetic filejava.io.FileNotFoundException - if either file cannot be locatedjava.io.IOExceptionpublic CachedDichotomyDiskSpellingDictionary(java.io.File wordList,
java.io.File phonetic,
java.lang.String encoding)
throws java.io.FileNotFoundException,
java.io.IOException
wordList - a file containing a list of wordsphonetic - an aspell phonetic fileencoding - the character encoding used in the word listjava.io.FileNotFoundException - if either file cannot be locatedjava.io.IOException - generic file system or read errors.public void addWord(java.lang.String word)
addWord in interface SpellingDictionaryaddWord in class DichotomyDiskSpellingDictionaryword - The word to add.public void clearCache()
public java.util.List<java.lang.String> getWords(java.lang.String code)
getWords in class DichotomyDiskSpellingDictionarycode - The phonetic code common to the list of wordspublic void saveCache()
throws java.io.IOException
java.io.IOException - Saves the current cache to file.