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 anotherSpellDictionary
this 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 int
codes
static int
hits
static java.lang.String
JAZZY_DIR
static java.lang.String
PRE_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 void
addWord(java.lang.String word)
Add a word permanantly to the dictionary (and the dictionary file).void
clearCache()
Clears the cache.java.util.List
getWords(java.lang.String code)
Returns a list of strings (words) for the code.void
saveCache()
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.IOException
Dictionary Convienence Constructor.- Throws:
java.io.FileNotFoundException
java.io.IOException
-
SpellDictionaryCachedDichoDisk
public SpellDictionaryCachedDichoDisk(java.io.File wordList, java.lang.String encoding) throws java.io.FileNotFoundException, java.io.IOException
Dictionary Convienence Constructor.- Throws:
java.io.FileNotFoundException
java.io.IOException
-
SpellDictionaryCachedDichoDisk
public SpellDictionaryCachedDichoDisk(java.io.File wordList, java.io.File phonetic) throws java.io.FileNotFoundException, java.io.IOException
Dictionary constructor that uses an aspell phonetic file to build the transformation table.- Throws:
java.io.FileNotFoundException
java.io.IOException
-
SpellDictionaryCachedDichoDisk
public SpellDictionaryCachedDichoDisk(java.io.File wordList, java.io.File phonetic, java.lang.String encoding) throws java.io.FileNotFoundException, java.io.IOException
Dictionary constructor that uses an aspell phonetic file to build the transformation table.- Throws:
java.io.FileNotFoundException
java.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:
addWord
in interfaceSpellDictionary
- Overrides:
addWord
in 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:
getWords
in 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.IOException
Saves the current cache to file.- Throws:
java.io.IOException
-
-