com.swabunga.spell.event
public class SpellChecker extends Object
SpellDictionaryHashMap
to persist the added word, the user dictionary will have the possibility to
grow and be available across differents invocations of the spell checker.
Field Summary | |
---|---|
static int | SPELLCHECK_CANCEL Flag indicating that the Spell Check completed due to user cancellation |
static int | SPELLCHECK_OK Flag indicating that the Spell Check completed without any errors present |
Constructor Summary | |
---|---|
SpellChecker()
Constructs the SpellChecker. | |
SpellChecker(SpellDictionary dictionary)
Constructs the SpellChecker. | |
SpellChecker(SpellDictionary dictionary, int threshold)
Constructs the SpellChecker with a threshold
|
Method Summary | |
---|---|
void | addDictionary(SpellDictionary dictionary)
Accumulates a dictionary at the end of the dictionaries list used
for looking up words. |
void | addSpellCheckListener(SpellCheckListener listener)
Adds a SpellCheckListener to the listeners list.
|
void | addToDictionary(String word)
Adds a word to the user dictionary |
int | checkSpelling(WordTokenizer tokenizer)
This method is called to check the spelling of the words that are returned
by the WordTokenizer.
|
String | checkString(String text)
Checks the text string.
|
protected boolean | fireAndHandleEvent(WordTokenizer tokenizer, SpellCheckEvent event)
This method will fire the spell check event and then handle the event
action that has been selected by the user.
|
protected void | fireSpellCheckEvent(SpellCheckEvent event)
Fires off a spell check event to the listeners.
|
Configuration | getConfiguration()
Supply the instance of the configuration holding the spell checking engine
parameters.
|
List | getSuggestions(String word, int threshold)
Produces a list of suggested word after looking for suggestions in various
dictionaries. |
void | ignoreAll(String word)
Adds a word to the list of ignored words |
boolean | isCorrect(String word)
Verifies if the word to analyze is contained in dictionaries. |
boolean | isIgnored(String word)
Indicates if a word is in the list of ignored words |
static boolean | isINETWord(String word)
Verifies if the word that is being spell checked contains an Internet
address. |
void | removeSpellCheckListener(SpellCheckListener listener)
Removes a SpellCheckListener from the listeners list.
|
void | reset()
This method clears the words that are currently being remembered as
Ignore All words and Replace All words. |
void | setCache()
Activates a cache with the maximum number of entries set to 300 |
void | setCache(int size)
Activates a cache with specified size |
void | setUserDictionary(SpellDictionary dictionary)
Registers the user dictionary to which words are added.
|
Parameters: dictionary The dictionary used for looking up words.
Parameters: dictionary the dictionary used for looking up words. threshold the cost value above which any suggestions are thrown away
Parameters: dictionary the dictionary to add at the end of the dictionary list.
Parameters: listener The feature to be added to the SpellCheckListener attribute
Parameters: word The text of the word to add
Parameters: tokenizer The media containing the text to analyze.
Returns: Either SPELLCHECK_OK, SPELLCHECK_CANCEL or the number of errors found. The number of errors are those that are found BEFORE any corrections are made.
Deprecated: use checkSpelling(WordTokenizer)
Checks the text string.Returns the corrected string.
Parameters: text The text that need to be spelled checked
Returns: The text after spell checking
Parameters: tokenizer Description of the Parameter event The event to handle
Returns: Returns true if the event action is to cancel the current spell checking, false if the spell checking should continue
Parameters: event The event that need to be processed by the spell checking system.
Returns: Current Configuration
Parameters: word The word for which we want to gather suggestions threshold the cost value above which any suggestions are thrown away
Returns: the list of words suggested
Parameters: word The text of the word to ignore
Parameters: word The word to verify that it's spelling is known.
Returns: true if the word is in a dictionary.
Parameters: word The text of the word check
Parameters: word The word to analyze for an Internet address.
Returns: true if this word looks like an Internet address.
Parameters: listener The listener to be removed from the listeners list.
Ignore All
words and Replace All
words.Parameters: size - max. number of cache entries (0 to disable chache)
Parameters: dictionary the dictionary to use when the user specify a new word to add.