RapidSpell Desktop


com.keyoti.rapidSpell
Class RapidSpellChecker

java.lang.Object
  |
  +--com.keyoti.rapidSpell.RapidSpellChecker

public class RapidSpellChecker
extends java.lang.Object
implements ICheckerEngine

Checks a text string for spelling errors and makes suggested corrections.

This is a non-GUI bean component, suitable for the business/logic layer of your application.

You would use this component in web server based applications.

This component can be used in 2 different ways. The most common usage, in an iterative fashion is detailed below, but it may also be used on a query by query basis.

To use this component in an iterative way you must first call check(text) to set the text to check and then iterate through nextBadWord() to identify misspelt words. nextBadWord() will return a BadWord object and internally locate the the misspelt word in the text, then you can call findSuggestions() which will return a Vector of suggestions as String objects. You may also call changeBadWord(replacement) to replace that current misspelt word in the text.

nextBadWord() will return null when the text has been checked. getAmendedText() returns the current state of the text with corrections.

Calling changeBadWord(replacement) or findSuggestions() before nextBadWord() has been called and returned a BadWord (i.e. not null) will result in a NoCurrentBadWordException

Example 1.

RapidSpellChecker c = new RapidSpellChecker();
BadWord badWord;
Enumeration suggestions;

//check some text.
c.check("This is sume text.");

//iterate through all bad words in the text.
while((badWord = c.nextBadWord())!=null){

  System.out.println(badWord.getWord() + "- is not spelt correctly. Suggestions:");

  try{
    //get suggestions for the current bad word.
    suggestions = c.findSuggestions().elements();

    //display all suggestions.
    while(suggestions.hasMoreElements()) {
      System.out.println(suggestions.nextElement());
    }

    //change the bad word in the text with "replacement".
    c.changeBadWord("replacement");

  } catch (NoCurrentBadWordException e){
    System.err.println(e);
  }

}
System.out.println(c.getAmendedText());

The second way to use this component is simply to query words yourself using lookUp(word) to check if word is in the lexicon/dictionary and findSuggestions(word) to find spelling suggestions for word.

Version:
2

Field Summary
 int currentBadWordEnd
          The start and end position of the current bad word being inspected
 int currentBadWordStart
          The start and end position of the current word being inspected
protected  java.lang.String[] dontSuggest
          Dont suggest words in this array (swear words).
static int HASHING_SUGGESTIONS
          Indicator for suggestion method (Hashing is default).
 java.util.Vector ignoreList
          Vector of words to be ignored.
 boolean optimizeForMemory
          Whether to optimize suggestion finding for memory instead of speed.
static int PHONETIC_SUGGESTIONS
          Indicator for suggestion method (Hashing is default).
 UserDictionary userDictionary
          The UserDictionary being used.
 
Constructor Summary
RapidSpellChecker()
          Creates a RapidSpellChecker, with no user dictionary.
RapidSpellChecker(java.lang.String licenseKey)
          Creates a RapidSpellChecker, with no user dictionary.
 
Method Summary
 boolean addWord(java.lang.String word)
          Adds word to the user dictionary (if it has been specified).
 void changeBadWord(java.lang.String newWord)
          Changes the current bad word to newWord in the text
 void check(java.lang.String text)
          Checks text for spelling correctness, from beginning of text, mis-spelt words can be accessed through nextBadWord()
 void check(java.lang.String text, int startPosition)
          Checks text for spelling correctness, from startPosition in text, mis-spelt words can be accessed through nextBadWord().
 void dispose()
          Frees up resources.
 void findAnagrams(java.lang.String word, java.util.List anagrams)
          Finds anagrams of word and puts them in anagrams if not already present.
 boolean findCompoundWords(java.lang.String text, java.util.List subwords)
          Finds the compound words in text and puts them in subwords, set subwords to null/nothing to just find if text has compound word formation. /* Only adds words to list if all are valid.
 java.util.Vector findSuggestions()
          Gets an enumeration of String suggestions for spelling of current bad word.
 java.util.Vector findSuggestions(java.lang.String word)
          Gets an enumeration of String suggestions for spelling of word.
 boolean flagged(java.lang.String word)
          Checks if word has been flagged as mis-spelt by the check() method
 boolean getAllowAnyCase()
          Whether to allow words spelt with incorrect case, eg.
 boolean getAllowMixedCase()
          Whether to allow words spelt with mixed case, eg.
 java.lang.String getAmendedText()
          Returns the original text sent to check() but with any alterations made through change()
 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()
          Gets whether to ignore words that start with capital letters.
 boolean getIgnoreWordsWithDigits()
          Whether to ignore words with digits in them.
 boolean getIgnoreXML()
          Whether to ignore XML/HTML tags, should be set true for 'rich HTML text box' support, false by default.
 boolean getIncludeUserDictionaryInSuggestions()
          Gets whether the user dictionary should be used in finding suggestions for misspelt words.
 int getLanguageParser()
          Gets the type of language parsing to use.
 boolean getLookIntoHyphenatedText()
          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 getMaximumAnagramLength()
          Gets the longest word length to find anagrams for.
 java.lang.String getNextWord()
          Returns the next word in the text.
 int getOptimization()
          Gets the optimization method to use.
 boolean getSeparateHyphenWords()
          Gets whether to treat hyphenated (-) words as separate words, default is false.
 boolean getSharedDictionary()
          Whether to use one shared dictionary amongst all RapidSpell instances under this VM.
 int getSuggestionsMethod()
          Gets the suggestions method to use.
 boolean getSuggestSplitWords()
          Whether to check for joined words when looking for suggestions.
 UserDictionary getUserDictionary()
          Gets the user dictionary to use.
 boolean getWarnDuplicates()
          Whether to treat duplicate words as errors (eg.
 int getWordEnd()
          Gets the current word's end index in the text
 int getWordStart()
          Gets the current word's start index in the text
 void ignoreAll(java.lang.String word)
          Marks word to be ignored in rest of the text
 boolean lookUp(java.lang.String query)
          Checks if query is in the word dictionary.
protected  boolean lookUpMainDictionary(java.lang.String query)
          Checks if query is in the word dictionary - returns true if doesnt start with a letter of apostrophe
protected  boolean lookUpUserDictionary(java.lang.String query)
          Look up the query in the user dictionary if it exists
 BadWord nextBadWord()
          Returns the next mis-spelt word in the text, as a BadWord object.
static void nullSharedDictionary()
          This will null the shared dictionary, allowing it to be GC'ed.
 void setAllowAnyCase(boolean value)
          Whether to allow words spelt with incorrect 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 w)
          Sets the factor for words to consider for suggestions, Should be O(100), lower values are faster but consider less words for suggestions.
 void setDictFilePath(java.lang.String value)
          The file to be used as the main dictionary, if this is null then the RapidSpellMDict jar is used.
 void setDictFileStream(java.io.InputStream dictFileStream)
          Passes a Dict file as a stream, to be used for the main dictionary.
 void setIgnoreCapitalizedWords(boolean v)
          Sets whether to ignore words that start with capital letters.
 void setIgnoreWordsWithDigits(boolean value)
          Whether to ignore words with digits in them.
 void setIgnoreXML(boolean value)
          Whether to ignore XML/HTML tags, should be set true for 'rich HTML text box' support, false by default.
 void setIncludeUserDictionaryInSuggestions(boolean v)
          Sets whether the user dictionary should be used in finding suggestions for misspelt words.
 void setLanguageParser(int language)
          The type of language parsing to use.
 void setLookIntoHyphenatedText(boolean value)
          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)
          Sets the longest word length to find anagrams for.
 void setOptimization(int indicator)
          Sets the optimization method to use.
 void setPosition(int pos)
          Sets the pointer position for the nextBadWord() iterator.
 void setSeparateHyphenWords(boolean f)
          Sets whether to treat hyphenated (-) words as separate words, default is false.
 void setSharedDictionary(boolean useSharedDictionary)
          Whether to use one shared dictionary amongst all RapidSpell instances under this VM.
 void setSuggestionsMethod(int method)
          Sets the suggestions method to use.
 void setSuggestSplitWords(boolean value)
          Whether to check for joined words when looking for suggestions.
 void setUserDictionary(java.io.File userDictionaryFile)
          Sets the user dictionary to use.
 void setUserDictionary(UserDictionary userDictionary)
          Sets the user dictionary to use.
 void setWarnDuplicates(boolean value)
          Whether to treat duplicate words as errors (eg.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ignoreList

public java.util.Vector ignoreList
Vector of words to be ignored.

optimizeForMemory

public boolean optimizeForMemory
Whether to optimize suggestion finding for memory instead of speed. This will affect suggestion speed by a factor of 10 (and therefore is not recommended for use with RapidSpell Web) and reduce memory usage by approx. 50%.

currentBadWordEnd

public int currentBadWordEnd
The start and end position of the current bad word being inspected

currentBadWordStart

public int currentBadWordStart
The start and end position of the current word being inspected

PHONETIC_SUGGESTIONS

public static int PHONETIC_SUGGESTIONS
Indicator for suggestion method (Hashing is default).

HASHING_SUGGESTIONS

public static int HASHING_SUGGESTIONS
Indicator for suggestion method (Hashing is default).

dontSuggest

protected java.lang.String[] dontSuggest
Dont suggest words in this array (swear words).

userDictionary

public UserDictionary userDictionary
The UserDictionary being used.
Constructor Detail

RapidSpellChecker

public RapidSpellChecker()
Creates a RapidSpellChecker, with no user dictionary. This constructor is supplied for backwards compatibility - please use licenseKey constructor.

RapidSpellChecker

public RapidSpellChecker(java.lang.String licenseKey)
Creates a RapidSpellChecker, with no user dictionary. Evaluation license keys can be obtained from http://keyoti.com/products/evaluation-key-generator
Method Detail

getWordStart

public int getWordStart()
Gets the current word's start index in the text

getWordEnd

public int getWordEnd()
Gets the current word's end index in the text

nullSharedDictionary

public static void nullSharedDictionary()
This will null the shared dictionary, allowing it to be GC'ed. Any later uses of the shared dictionary will cause it to be reloaded.

setMaximumAnagramLength

public void setMaximumAnagramLength(int maxAnagramLength)
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.
Specified by:
setMaximumAnagramLength in interface ICheckerEngine

getMaximumAnagramLength

public int getMaximumAnagramLength()
Gets 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.
Specified by:
getCheckCompoundWords in interface ICheckerEngine

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.
Specified by:
setCheckCompoundWords in interface ICheckerEngine

getWarnDuplicates

public boolean getWarnDuplicates()
Whether to treat duplicate words as errors (eg. "this is is an error").
Specified by:
getWarnDuplicates in interface ICheckerEngine

setWarnDuplicates

public void setWarnDuplicates(boolean value)
Whether to treat duplicate words as errors (eg. "this is is an error").
Specified by:
setWarnDuplicates in interface ICheckerEngine

getSuggestSplitWords

public boolean getSuggestSplitWords()
Whether to check for joined words when looking for suggestions.
Specified by:
getSuggestSplitWords in interface ICheckerEngine

setSuggestSplitWords

public void setSuggestSplitWords(boolean value)
Whether to check for joined words when looking for suggestions.
Specified by:
setSuggestSplitWords in interface ICheckerEngine

setSuggestionsMethod

public void setSuggestionsMethod(int method)
Sets the suggestions method to use. Either PHONETIC_SUGGESTIONS or HASHING_SUGGESTIONS
Specified by:
setSuggestionsMethod in interface ICheckerEngine

getSuggestionsMethod

public int getSuggestionsMethod()
Gets the suggestions method to use. Either PHONETIC_SUGGESTIONS or HASHING_SUGGESTIONS
Specified by:
getSuggestionsMethod in interface ICheckerEngine

setIncludeUserDictionaryInSuggestions

public void setIncludeUserDictionaryInSuggestions(boolean v)
Sets whether the user dictionary should be used in finding suggestions for misspelt words.
Specified by:
setIncludeUserDictionaryInSuggestions in interface ICheckerEngine

getIncludeUserDictionaryInSuggestions

public boolean getIncludeUserDictionaryInSuggestions()
Gets whether the user dictionary should be used in finding suggestions for misspelt words.
Specified by:
getIncludeUserDictionaryInSuggestions in interface ICheckerEngine

setIgnoreCapitalizedWords

public void setIgnoreCapitalizedWords(boolean v)
Sets whether to ignore words that start with capital letters.
Specified by:
setIgnoreCapitalizedWords in interface ICheckerEngine

getIgnoreCapitalizedWords

public boolean getIgnoreCapitalizedWords()
Gets whether to ignore words that start with capital letters.
Specified by:
getIgnoreCapitalizedWords in interface ICheckerEngine

setConsiderationRange

public void setConsiderationRange(int w)
Sets the factor for words to consider for suggestions, Should be O(100), lower values are faster but consider less words for suggestions.

Default is 80.

Specified by:
setConsiderationRange in interface ICheckerEngine

getConsiderationRange

public int getConsiderationRange()
Gets the factor for words to consider for suggestions.
Specified by:
getConsiderationRange in interface ICheckerEngine

setSeparateHyphenWords

public void setSeparateHyphenWords(boolean f)
Sets whether to treat hyphenated (-) words as separate words, default is false. For eg. if this is true text like "cheap-deals" will be treated as two words "cheap" and "deals", otherwise this will be treated as one word "cheap-deals".

Also see LookIntoHyphenatedText.

Specified by:
setSeparateHyphenWords in interface ICheckerEngine

getSeparateHyphenWords

public boolean getSeparateHyphenWords()
Gets whether to treat hyphenated (-) words as separate words, default is false. For eg. if this is true text like "cheap-deals" will be treated as two words "cheap" and "deals", otherwise this will be treated as one word "cheap-deals".

Also see LookIntoHyphenatedText.


getAllowMixedCase

public boolean getAllowMixedCase()
Whether to allow words spelt with mixed case, eg. "MIxEd", this will not allow incorrect casing however, such as "john", instead of "John".
Specified by:
getAllowMixedCase in interface ICheckerEngine

setAllowMixedCase

public void setAllowMixedCase(boolean value)
Whether to allow words spelt with mixed case, eg. "MIxEd", this will not allow incorrect casing however, such as "john", instead of "John".
Specified by:
setAllowMixedCase in interface ICheckerEngine

getAllowAnyCase

public boolean getAllowAnyCase()
Whether to allow words spelt with incorrect case, eg. "africa", instead of "Africa", this is more relaxed than AllowMixedCase.
Specified by:
getAllowAnyCase in interface ICheckerEngine

setAllowAnyCase

public void setAllowAnyCase(boolean value)
Whether to allow words spelt with incorrect case, eg. "africa", instead of "Africa", this is more relaxed than AllowMixedCase.
Specified by:
setAllowAnyCase in interface ICheckerEngine

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.
Specified by:
getDictFilePath in interface ICheckerEngine

setDictFilePath

public void setDictFilePath(java.lang.String value)
The file to be used as the main dictionary, if this is null then the RapidSpellMDict jar is used.
Specified by:
setDictFilePath in interface ICheckerEngine

setDictFileStream

public void setDictFileStream(java.io.InputStream dictFileStream)
                       throws java.io.IOException,
                              java.lang.IllegalStateException
Passes a Dict file as a stream, to be used for the main dictionary. Note this method must be set before check is called, and the stream position must be at beginning of Dict file
Throws:
java.lang.IllegalStateException - if called after dictionary has been loaded.

getLookIntoHyphenatedText

public boolean getLookIntoHyphenatedText()
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".
Specified by:
getLookIntoHyphenatedText in interface ICheckerEngine

setLookIntoHyphenatedText

public void setLookIntoHyphenatedText(boolean value)
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".
Specified by:
setLookIntoHyphenatedText in interface ICheckerEngine

getIgnoreWordsWithDigits

public boolean getIgnoreWordsWithDigits()
Whether to ignore words with digits in them.
Specified by:
getIgnoreWordsWithDigits in interface ICheckerEngine

setIgnoreWordsWithDigits

public void setIgnoreWordsWithDigits(boolean value)
Whether to ignore words with digits in them.
Specified by:
setIgnoreWordsWithDigits in interface ICheckerEngine

getIgnoreXML

public boolean getIgnoreXML()
Whether to ignore XML/HTML tags, should be set true for 'rich HTML text box' support, false by default.
Specified by:
getIgnoreXML in interface ICheckerEngine

setIgnoreXML

public void setIgnoreXML(boolean value)
Whether to ignore XML/HTML tags, should be set true for 'rich HTML text box' support, false by default.
Specified by:
setIgnoreXML in interface ICheckerEngine

setOptimization

public void setOptimization(int indicator)
Sets the optimization method to use. Generally OPTIMIZE_FOR_MEMORY should be used on desktop systems, whereas for servers with more memory OPTIMIZE_FOR_SPEED should be used.

getOptimization

public int getOptimization()
Gets the optimization method to use.

getLanguageParser

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

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

Specified by:
getLanguageParser in interface ICheckerEngine
Returns:
int identifier corresponding to LanguageType.XXXX
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.

Specified by:
setLanguageParser in interface ICheckerEngine
See Also:
LanguageType

findCompoundWords

public boolean findCompoundWords(java.lang.String text,
                                 java.util.List subwords)
Finds the compound words in text and puts them in subwords, set subwords to null/nothing to just find if text has compound word formation. /* Only adds words to list if all are valid. In other words, this will not find all words that /* are part of text, but only the words that all make up text. /*

Eg. "catchmentarea" has words "catchment" and "area" but not "cat", "me" etc.

/* The order of the words in the list is the reverse of their order in text. /* @param text The text to find compound words in /* @param subwords A list that formative sub-words will be added to, can be null. /* @returns true if text is entirely formed from compound words, False if not.

addWord

public boolean addWord(java.lang.String word)
                throws java.lang.NullPointerException
Adds word to the user dictionary (if it has been specified).
Specified by:
addWord in interface ICheckerEngine
Returns:
boolean true if the word was is now in the user dictionary, false if the word could not be added to the user dictionary.
Throws:
java.lang.NullPointerException - if word parameter is null.

changeBadWord

public void changeBadWord(java.lang.String newWord)
                   throws NoCurrentBadWordException,
                          java.lang.NullPointerException
Changes the current bad word to newWord in the text
Specified by:
changeBadWord in interface ICheckerEngine
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.

check

public void check(java.lang.String text,
                  int startPosition)
           throws java.lang.NullPointerException
Checks text for spelling correctness, from startPosition in text, mis-spelt words can be accessed through nextBadWord(). startPosition should be >=0 but if it is < 0 it is set = 0.
Parameters:
text - the text to be checked
startPosition - the position in the text to begin checking from
Returns:
void
Throws:
java.lang.NullPointerException - if text parameter is null.

check

public void check(java.lang.String text)
           throws java.lang.NullPointerException
Checks text for spelling correctness, from beginning of text, mis-spelt words can be accessed through nextBadWord()
Specified by:
check in interface ICheckerEngine
Parameters:
text - to spell check.
Returns:
void
Throws:
java.lang.NullPointerException - if text parameter is null.

findSuggestions

public java.util.Vector findSuggestions()
                                 throws NoCurrentBadWordException
Gets an enumeration of String suggestions for spelling of current bad word.
Specified by:
findSuggestions in interface ICheckerEngine
Returns:
Vector of String suggestions for current bad word.
Throws:
NoCurrentBadWordException - if nextBadWord() hasn't been run first AND found an erroneous word.

findSuggestions

public java.util.Vector findSuggestions(java.lang.String word)
                                 throws java.lang.NullPointerException
Gets an enumeration of String suggestions for spelling of word.
Returns:
Vector of String suggestions for current bad word.
Throws:
java.lang.NullPointerException - if word is null.

getAmendedText

public java.lang.String getAmendedText()
Returns the original text sent to check() but with any alterations made through change()
Returns:
java.lang.String the text after corrections, null if there is no text.

ignoreAll

public void ignoreAll(java.lang.String word)
               throws java.lang.NullPointerException
Marks word to be ignored in rest of the text
Specified by:
ignoreAll in interface ICheckerEngine
Parameters:
word - to ignore
Returns:
void
Throws:
java.lang.NullPointerException - if word parameter is null.

lookUp

public boolean lookUp(java.lang.String query)
               throws java.lang.NullPointerException
Checks if query is in the word dictionary. Note. returns true if query doesnt start with a letter because this would indicate that query is not a word and therefore not going to be in the lexicon but is not a misspelling, i.e. it's probably a number or a symbol etc.
Parameters:
query - the word to check spelling of
Returns:
true if spelt correctly, false if not in dictionary
Throws:
java.lang.NullPointerException - if query parameter is null.

nextBadWord

public BadWord nextBadWord()
Returns the next mis-spelt word in the text, as a BadWord object.
Specified by:
nextBadWord in interface ICheckerEngine
Returns:
com.keyoti.rapidSpell.BadWord or null if there are no more bad words.
See Also:
BadWord

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 position > the text length it is set to the text length. If position < 0, it is set to zero.
Specified by:
setPosition in interface ICheckerEngine

findAnagrams

public void findAnagrams(java.lang.String word,
                         java.util.List anagrams)
Finds anagrams of word and puts them in anagrams if not already present.
Parameters:
word - The word to find anagrams of
anagram - A list that anagrams will be added to.

getUserDictionary

public UserDictionary getUserDictionary()
Gets the user dictionary to use.
Specified by:
getUserDictionary in interface ICheckerEngine

setUserDictionary

public void setUserDictionary(java.io.File userDictionaryFile)
                       throws java.lang.NullPointerException
Sets the user dictionary to use.

If the userDictionary can not be created/read it will be ignored and a message sent to System.err

Specified by:
setUserDictionary in interface ICheckerEngine
Parameters:
userDictionary - a file to be used as a user dictionary
Throws:
java.lang.NullPointerException - if userDictionaryFile is null

setUserDictionary

public void setUserDictionary(UserDictionary userDictionary)
                       throws java.lang.NullPointerException
Sets the user dictionary to use.

If the userDictionary can not be created/read it will be ignored and a message sent to System.err

Specified by:
setUserDictionary in interface ICheckerEngine
Parameters:
userDictionary - a UserDictionary object representing a user dictionary
Throws:
java.lang.NullPointerException - if userDictionary is null.

setSharedDictionary

public void setSharedDictionary(boolean useSharedDictionary)
Whether to use one shared dictionary amongst all RapidSpell instances under this VM. This must be set BEFORE any spell checking is performed (eg. before setTextComponent or check is called in RapidSpellAsYouType or RapidSpellGUI). Caution: When this is set to true each instance (where this is true) will be forced to use the same dictionary. Also see RapidSpellChecker.nullSharedDictionary()

getSharedDictionary

public boolean getSharedDictionary()
Whether to use one shared dictionary amongst all RapidSpell instances under this VM. Caution: When this is set to true each instance (where this is true) will be forced to use the same dictionary. Also see RapidSpellChecker.nullSharedDictionary()

dispose

public void dispose()
Frees up resources.

flagged

public boolean flagged(java.lang.String word)
Checks if word has been flagged as mis-spelt by the check() method

getNextWord

public java.lang.String getNextWord()
Returns the next word in the text.
Returns:
String the next word in the text

lookUpMainDictionary

protected boolean lookUpMainDictionary(java.lang.String query)
Checks if query is in the word dictionary - returns true if doesnt start with a letter of apostrophe
Parameters:
query - the word to check spelling of
Returns:
boolean true if spelt correctly, false if not in dictionary

lookUpUserDictionary

protected boolean lookUpUserDictionary(java.lang.String query)
Look up the query in the user dictionary if it exists

RapidSpell Desktop


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