com.swabunga.spell.engine
Class SpellDictionaryASpell

java.lang.Object
  extended bycom.swabunga.spell.engine.SpellDictionaryASpell
All Implemented Interfaces:
SpellDictionary
Direct Known Subclasses:
GenericSpellDictionary, SpellDictionaryDichoDisk, SpellDictionaryDisk, SpellDictionaryHashMap

public abstract class SpellDictionaryASpell
extends java.lang.Object
implements SpellDictionary

Container for various methods that any SpellDictionary will use. Based on the original Jazzy aspell port.


Field Summary
protected  Transformator tf
          The reference to a Transformator, used to transform a word into it's phonetic code.
 
Constructor Summary
SpellDictionaryASpell(java.io.File phonetic)
           
SpellDictionaryASpell(java.io.File phonetic, java.lang.String encoding)
           
SpellDictionaryASpell(java.io.Reader phonetic)
           
 
Method Summary
 java.lang.String getCode(java.lang.String word)
          Returns the phonetic code representing the word.
 java.util.List getSuggestions(java.lang.String word, int threshold)
          Returns a list of Word objects that are the suggestions to an incorrect word.
protected abstract  java.util.List getWords(java.lang.String phoneticCode)
          Returns a list of words that have the same phonetic code.
 boolean isCorrect(java.lang.String word)
          Returns true if the word is correctly spelled against the current word list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.swabunga.spell.engine.SpellDictionary
addWord
 

Field Detail

tf

protected Transformator tf
The reference to a Transformator, used to transform a word into it's phonetic code.

Constructor Detail

SpellDictionaryASpell

public SpellDictionaryASpell(java.io.File phonetic)
                      throws java.io.IOException

SpellDictionaryASpell

public SpellDictionaryASpell(java.io.File phonetic,
                             java.lang.String encoding)
                      throws java.io.IOException

SpellDictionaryASpell

public SpellDictionaryASpell(java.io.Reader phonetic)
                      throws java.io.IOException
Method Detail

getSuggestions

public java.util.List getSuggestions(java.lang.String word,
                                     int threshold)
Returns a list of Word objects that are the suggestions to an incorrect word.

Specified by:
getSuggestions in interface SpellDictionary
Parameters:
word - Suggestions for given mispelt word
threshold - The lower boundary of similarity to mispelt word
Returns:
Vector a List of suggestions
See Also:
Word

getCode

public java.lang.String getCode(java.lang.String word)
Returns the phonetic code representing the word.


getWords

protected abstract java.util.List getWords(java.lang.String phoneticCode)
Returns a list of words that have the same phonetic code.


isCorrect

public boolean isCorrect(java.lang.String word)
Returns true if the word is correctly spelled against the current word list.

Specified by:
isCorrect in interface SpellDictionary