RapidSpell Desktop


com.keyoti.rapidSpell
Interface ICheckerEngine

All Known Implementing Classes:
RapidSpellChecker, CheckerEngineAdapter

public interface ICheckerEngine

Defines the interface required for a class to be used as a checker engine.

This is the interface which any checker engine must have, by implementing this interface any object can be used to parse text and identify 'bad words'.

It is not necessary to functionally implement all members, for this reason an abstract empty implementation class is provided (CheckerEngineAdapter) which can be extended and overridden for desired functionality.

Since:
v2.0.0

Method Summary
 boolean addWord(java.lang.String word)
          Adds a word to the user dictionary, if it exists.
 void changeBadWord(java.lang.String newWord)
          Changes the current bad word to newWord in the text.
 void check(java.lang.String text)
          Checks the text for errors.
 java.util.Vector findSuggestions()
          Returns a Vector of Strings that are suitable suggestions for the current bad word (that is, the one last returned by nextBadWord()).
 boolean getAllowAnyCase()
          Whether to allow words spelt with any case, eg.
 boolean getAllowMixedCase()
          Whether to allow words spelt with mixed case, eg.
 boolean getCheckCompoundWords()
          Whether to check if words are made of compound forms - to be used in languages which use compounds, such as German.
 int getConsiderationRange()
          Gets the factor for words to consider for suggestions.
 java.lang.String getDictFilePath()
          The file to be used as the main dictionary, if this is null then the RapidSpellMDict jar is used.
 boolean getIgnoreCapitalizedWords()
          If supported, gets whether to ignore words that start with capital letters.
 boolean getIgnoreWordsWithDigits()
          Whether to ignore words with digits in them.
 boolean getIgnoreXML()
          If supported, gets whether to ignore XML tags in the text.
 boolean getIncludeUserDictionaryInSuggestions()
          If supported, gets whether the user dictionary should be used in finding suggestions for misspelt words.
 int getLanguageParser()
          The type of language parsing to use.
 boolean getLookIntoHyphenatedText()
          If supported, whether to 'look into' text with hyphens (-), if the word has hyphens in it and LookIntoHyphenatedText is set true (default), the parts of the text around the hyphens will be checked individually.
 int getSuggestionsMethod()
          If supported, sets the suggestions method, where method is an integer identifier.
 boolean getSuggestSplitWords()
          Whether to check for joined words when looking for suggestions.
 UserDictionary getUserDictionary()
          Gets the user dictionary.
 boolean getWarnDuplicates()
          Whether to treat duplicate words as errors (eg.
 void ignoreAll(java.lang.String word)
          Marks word to be ignored in rest of the text.
 BadWord nextBadWord()
          Gets the next bad word in the list that was identified by Check.
 void setAllowAnyCase(boolean value)
          Whether to allow words spelt with any case, eg.
 void setAllowMixedCase(boolean value)
          Whether to allow words spelt with mixed case, eg.
 void setCheckCompoundWords(boolean value)
          Whether to check if words are made of compound forms - to be used in languages which use compounds, such as German.
 void setConsiderationRange(int range)
          If supported, sets the breadth of the suggestions search.
 void setDictFilePath(java.lang.String s)
          The file to be used as the main dictionary, if this is null then the RapidSpellMDict jar is used.
 void setIgnoreCapitalizedWords(boolean ignore)
          If supported, sets whether to ignore capitalized words.
 void setIgnoreWordsWithDigits(boolean value)
          Whether to ignore words with digits in them.
 void setIgnoreXML(boolean v)
          If supported, sets whether to ignore XML tags in the text.
 void setIncludeUserDictionaryInSuggestions(boolean includeUserDictionaryInSuggestions)
          Sets whether to include the user dictionary in suggestions taken from this engine.
 void setLanguageParser(int language)
          The type of language parsing to use.
 void setLookIntoHyphenatedText(boolean value)
          If supported, whether to 'look into' text with hyphens (-), if the word has hyphens in it and LookIntoHyphenatedText is set true (default), the parts of the text around the hyphens will be checked individually.
 void setMaximumAnagramLength(int maxAnagramLength)
          If supported, sets the longest word length to find anagrams for.
 void setPosition(int pos)
          Sets the pointer position for the nextBadWord iterator.
 void setSeparateHyphenWords(boolean separate)
          If supported, sets whether to separate words with hyphens in them into separate words.
 void setSuggestionsMethod(int method)
          If supported, sets the suggestions method, where method is an integer identifier.
 void setSuggestSplitWords(boolean value)
          Whether to check for joined words when looking for suggestions.
 void setUserDictionary(java.io.File userDictionary)
          Sets the UserDictionary file path to be used as a user dictionary source.
 void setUserDictionary(UserDictionary userDictionary)
          Sets the UserDictionary object to be used as a user dictionary source.
 void setWarnDuplicates(boolean value)
          Whether to treat duplicate words as errors (eg.
 

Method Detail

check

public void check(java.lang.String text)
Checks the text for errors.
Throws:
java.lang.NullPointerException - if text parameter is null.

nextBadWord

public BadWord nextBadWord()
Gets the next bad word in the list that was identified by Check.

Check must be called before this method.

Returns:
The next BadWord object from the text, must return null when no more bad words exist.

findSuggestions

public java.util.Vector findSuggestions()
                                 throws NoCurrentBadWordException,
                                        java.lang.NullPointerException
Returns a Vector of Strings that are suitable suggestions for the current bad word (that is, the one last returned by nextBadWord()).

If no suggestions can be found, this should return an empty Vector. This method must be thread safe if operating with RapidSpell Desktop.

Throws:
NoCurrentBadWordException - If nextBadWord() hasn't been run first AND found an erroneous word.

setIncludeUserDictionaryInSuggestions

public void setIncludeUserDictionaryInSuggestions(boolean includeUserDictionaryInSuggestions)
Sets whether to include the user dictionary in suggestions taken from this engine.

setUserDictionary

public void setUserDictionary(UserDictionary userDictionary)
Sets the UserDictionary object to be used as a user dictionary source.

setUserDictionary

public void setUserDictionary(java.io.File userDictionary)
Sets the UserDictionary file path to be used as a user dictionary source.

addWord

public boolean addWord(java.lang.String word)
Adds a word to the user dictionary, if it exists.

Should return true if the word was added successfully, false otherwise.


setSuggestionsMethod

public void setSuggestionsMethod(int method)
If supported, sets the suggestions method, where method is an integer identifier.

getSuggestionsMethod

public int getSuggestionsMethod()
If supported, sets the suggestions method, where method is an integer identifier.

setIgnoreCapitalizedWords

public void setIgnoreCapitalizedWords(boolean ignore)
If supported, sets whether to ignore capitalized words.

getIgnoreXML

public boolean getIgnoreXML()
If supported, gets whether to ignore XML tags in the text.

setIgnoreXML

public void setIgnoreXML(boolean v)
If supported, sets whether to ignore XML tags in the text.

getIgnoreWordsWithDigits

public boolean getIgnoreWordsWithDigits()
Whether to ignore words with digits in them.

setIgnoreWordsWithDigits

public void setIgnoreWordsWithDigits(boolean value)
Whether to ignore words with digits in them.

setConsiderationRange

public void setConsiderationRange(int range)
If supported, sets the breadth of the suggestions search.

setSeparateHyphenWords

public void setSeparateHyphenWords(boolean separate)
If supported, sets whether to separate words with hyphens in them into separate words.

getUserDictionary

public UserDictionary getUserDictionary()
Gets the user dictionary.

getDictFilePath

public java.lang.String getDictFilePath()
The file to be used as the main dictionary, if this is null then the RapidSpellMDict jar is used.

setDictFilePath

public void setDictFilePath(java.lang.String s)
The file to be used as the main dictionary, if this is null then the RapidSpellMDict jar is used.

getLanguageParser

public int getLanguageParser()
The type of language parsing to use.

Eg. If the dictionary is set to French, you should use the French parser.

Returns:
int identifier from LanguageType
See Also:
LanguageType

setLanguageParser

public void setLanguageParser(int language)
The type of language parsing to use.

Eg. If the dictionary is set to French, you should use the French parser.

Parameters:
language - an int identifier from LanguageType
See Also:
LanguageType

setPosition

public void setPosition(int pos)
Sets the pointer position for the nextBadWord iterator.

Further calls to nextBadWord will look for the next bad word from position pos.

If pos > the text length it is set to the text length.

If pos < 0, it is set to zero.


getIncludeUserDictionaryInSuggestions

public boolean getIncludeUserDictionaryInSuggestions()
If supported, gets whether the user dictionary should be used in finding suggestions for misspelt words.

getIgnoreCapitalizedWords

public boolean getIgnoreCapitalizedWords()
If supported, gets whether to ignore words that start with capital letters.

getConsiderationRange

public int getConsiderationRange()
Gets the factor for words to consider for suggestions.

changeBadWord

public void changeBadWord(java.lang.String newWord)
                   throws NoCurrentBadWordException,
                          java.lang.NullPointerException
Changes the current bad word to newWord in the text.
Parameters:
newWord - replaces the current misspelt word.
Returns:
void
Throws:
NoCurrentBadWordException - if nextBadWord() hasn't been run first AND found an erroneous word.
java.lang.NullPointerException - if newWord parameter is null.

ignoreAll

public void ignoreAll(java.lang.String word)
Marks word to be ignored in rest of the text.

getLookIntoHyphenatedText

public boolean getLookIntoHyphenatedText()
If supported, whether to 'look into' text with hyphens (-), if the word has hyphens in it and LookIntoHyphenatedText is set true (default), the parts of the text around the hyphens will be checked individually. Eg. "socio-economic" will be checked as "socio" and "economic".

setLookIntoHyphenatedText

public void setLookIntoHyphenatedText(boolean value)
If supported, whether to 'look into' text with hyphens (-), if the word has hyphens in it and LookIntoHyphenatedText is set true (default), the parts of the text around the hyphens will be checked individually. Eg. "socio-economic" will be checked as "socio" and "economic".

setMaximumAnagramLength

public void setMaximumAnagramLength(int maxAnagramLength)
If supported, sets the longest word length to find anagrams for. Default is 8. Increasing this will slow down suggestion look ups. Note RapidSpell Desktop and RapidSpell Web interface classes set this to their own values.

getCheckCompoundWords

public boolean getCheckCompoundWords()
Whether to check if words are made of compound forms - to be used in languages which use compounds, such as German.

setCheckCompoundWords

public void setCheckCompoundWords(boolean value)
Whether to check if words are made of compound forms - to be used in languages which use compounds, such as German.

getSuggestSplitWords

public boolean getSuggestSplitWords()
Whether to check for joined words when looking for suggestions.

setSuggestSplitWords

public void setSuggestSplitWords(boolean value)
Whether to check for joined words when looking for suggestions.

getAllowMixedCase

public boolean getAllowMixedCase()
Whether to allow words spelt with mixed case, eg. "MIxEd".

setAllowMixedCase

public void setAllowMixedCase(boolean value)
Whether to allow words spelt with mixed case, eg. "MIxEd".

getAllowAnyCase

public boolean getAllowAnyCase()
Whether to allow words spelt with any case, eg. "africa".

setAllowAnyCase

public void setAllowAnyCase(boolean value)
Whether to allow words spelt with any case, eg. "africa".

getWarnDuplicates

public boolean getWarnDuplicates()
Whether to treat duplicate words as errors (eg. "this is is an error").

setWarnDuplicates

public void setWarnDuplicates(boolean value)
Whether to treat duplicate words as errors (eg. "this is is an error").

RapidSpell Desktop


Copyright © 2002-2005 Keyoti Inc. All Rights Reserved.