Package com.swabunga.spell.engine
Class SpellDictionaryCachedDichoDisk
- java.lang.Object
-
- com.swabunga.spell.engine.SpellDictionaryASpell
-
- com.swabunga.spell.engine.SpellDictionaryDichoDisk
-
- com.swabunga.spell.engine.SpellDictionaryCachedDichoDisk
-
- All Implemented Interfaces:
SpellDictionary
public class SpellDictionaryCachedDichoDisk extends SpellDictionaryDichoDisk
Yet anotherSpellDictionarythis one is based on Damien Guillaume's Diskbased dictionary but adds a cache to try to improve abit on performance.- Version:
- 0.01
- Author:
- Robert Gustavsson
-
-
Field Summary
Fields Modifier and Type Field Description static intcodesstatic inthitsstatic java.lang.StringJAZZY_DIRstatic java.lang.StringPRE_CACHE_FILE_EXT-
Fields inherited from class com.swabunga.spell.engine.SpellDictionaryASpell
tf
-
-
Constructor Summary
Constructors Constructor Description SpellDictionaryCachedDichoDisk(java.io.File wordList)Dictionary Convienence Constructor.SpellDictionaryCachedDichoDisk(java.io.File wordList, java.io.File phonetic)Dictionary constructor that uses an aspell phonetic file to build the transformation table.SpellDictionaryCachedDichoDisk(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.SpellDictionaryCachedDichoDisk(java.io.File wordList, java.lang.String encoding)Dictionary Convienence Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddWord(java.lang.String word)Add a word permanantly to the dictionary (and the dictionary file).voidclearCache()Clears the cache.java.util.ListgetWords(java.lang.String code)Returns a list of strings (words) for the code.voidsaveCache()Saves the current cache to file.-
Methods inherited from class com.swabunga.spell.engine.SpellDictionaryASpell
getCode, getSuggestions, getSuggestions, isCorrect
-
-
-
-
Field Detail
-
hits
public static int hits
-
codes
public static int codes
-
JAZZY_DIR
public static final java.lang.String JAZZY_DIR
- See Also:
- Constant Field Values
-
PRE_CACHE_FILE_EXT
public static final java.lang.String PRE_CACHE_FILE_EXT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SpellDictionaryCachedDichoDisk
public SpellDictionaryCachedDichoDisk(java.io.File wordList) throws java.io.FileNotFoundException, java.io.IOExceptionDictionary Convienence Constructor.- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
SpellDictionaryCachedDichoDisk
public SpellDictionaryCachedDichoDisk(java.io.File wordList, java.lang.String encoding) throws java.io.FileNotFoundException, java.io.IOExceptionDictionary Convienence Constructor.- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
SpellDictionaryCachedDichoDisk
public SpellDictionaryCachedDichoDisk(java.io.File wordList, java.io.File phonetic) throws java.io.FileNotFoundException, java.io.IOExceptionDictionary constructor that uses an aspell phonetic file to build the transformation table.- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
SpellDictionaryCachedDichoDisk
public SpellDictionaryCachedDichoDisk(java.io.File wordList, java.io.File phonetic, java.lang.String encoding) throws java.io.FileNotFoundException, java.io.IOExceptionDictionary constructor that uses an aspell phonetic file to build the transformation table.- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
-
Method Detail
-
addWord
public void addWord(java.lang.String word)
Add a word permanantly to the dictionary (and the dictionary file). not implemented !- Specified by:
addWordin interfaceSpellDictionary- Overrides:
addWordin classSpellDictionaryDichoDisk- Parameters:
word- The word to add.
-
clearCache
public void clearCache()
Clears the cache.
-
getWords
public java.util.List getWords(java.lang.String code)
Returns a list of strings (words) for the code.- Overrides:
getWordsin classSpellDictionaryDichoDisk- Parameters:
code- The phonetic code common to the list of words- Returns:
- A list of words having the same phonetic code
-
saveCache
public void saveCache() throws java.io.IOExceptionSaves the current cache to file.- Throws:
java.io.IOException
-
-