Class 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 Detail

      • hits

        public static int hits
      • codes

        public static int codes
      • 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