Package com.swabunga.spell.engine
Class SpellDictionaryDichoDisk
java.lang.Object
com.swabunga.spell.engine.SpellDictionaryASpell
com.swabunga.spell.engine.SpellDictionaryDichoDisk
- All Implemented Interfaces:
SpellDictionary
- Direct Known Subclasses:
SpellDictionaryCachedDichoDisk
Another implementation of
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 dictionary- Version:
- 0.1
- Author:
- Damien Guillaume
-
Field Summary
Fields inherited from class com.swabunga.spell.engine.SpellDictionaryASpell
tf
-
Constructor Summary
ConstructorsConstructorDescriptionSpellDictionaryDichoDisk
(File wordList) Dictionary convenience Constructor.SpellDictionaryDichoDisk
(File wordList, File phonetic) Dictionary constructor that uses an aspell phonetic file to build the transformation table.SpellDictionaryDichoDisk
(File wordList, File phonetic, String encoding) Dictionary constructor that uses an aspell phonetic file to build the transformation table.SpellDictionaryDichoDisk
(File wordList, String encoding) Dictionary convenience Constructor. -
Method Summary
Methods inherited from class com.swabunga.spell.engine.SpellDictionaryASpell
getCode, getSuggestions, getSuggestions, isCorrect
-
Constructor Details
-
SpellDictionaryDichoDisk
Dictionary convenience Constructor.- Parameters:
wordList
- The file containing the words list for the dictionary- Throws:
FileNotFoundException
- indicates problems locating the words list file on the systemIOException
- indicates problems reading the words list file
-
SpellDictionaryDichoDisk
public SpellDictionaryDichoDisk(File wordList, String encoding) throws FileNotFoundException, IOException Dictionary convenience Constructor.- Parameters:
wordList
- The file containing the words list for the dictionaryencoding
- Uses the character set encoding specified- Throws:
FileNotFoundException
- indicates problems locating the words list file on the systemIOException
- indicates problems reading the words list file
-
SpellDictionaryDichoDisk
public SpellDictionaryDichoDisk(File wordList, File phonetic) throws FileNotFoundException, IOException Dictionary constructor that uses an aspell phonetic file to build the transformation table.- Parameters:
wordList
- The file containing the words list for the dictionaryphonetic
- The file to use for phonetic transformation of the wordlist.- Throws:
FileNotFoundException
- indicates problems locating the file on the systemIOException
- indicates problems reading the words list file
-
SpellDictionaryDichoDisk
public SpellDictionaryDichoDisk(File wordList, File phonetic, String encoding) throws FileNotFoundException, IOException Dictionary constructor that uses an aspell phonetic file to build the transformation table.- Parameters:
wordList
- The file containing the words list for the dictionaryphonetic
- The file to use for phonetic transformation of the wordlist.encoding
- Uses the character set encoding specified- Throws:
FileNotFoundException
- indicates problems locating the file on the systemIOException
- indicates problems reading the words list file
-
-
Method Details
-
addWord
Add a word permanently to the dictionary (and the dictionary file). not implemented !- Parameters:
word
- The word to add.
-
getWords
Returns a list of strings (words) for the code.- Specified by:
getWords
in classSpellDictionaryASpell
- Parameters:
code
- The phonetic code common to the list of words- Returns:
- A list of words having the same phonetic code
-