com.swabunga.spell.engine
Class SpellDictionaryCachedDichoDisk

java.lang.Object
  extended by com.swabunga.spell.engine.SpellDictionaryASpell
      extended by com.swabunga.spell.engine.SpellDictionaryDichoDisk
          extended by com.swabunga.spell.engine.SpellDictionaryCachedDichoDisk
All Implemented Interfaces:
SpellDictionary

public class SpellDictionaryCachedDichoDisk
extends SpellDictionaryDichoDisk

Yet another SpellDictionary 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
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
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
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 interface SpellDictionary
Overrides:
addWord in class SpellDictionaryDichoDisk
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 class SpellDictionaryDichoDisk
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