com.jspell.domain
Interface JSpellDictionaryAccessor

All Known Implementing Classes:
JSpellDictionary, JSpellDictionaryLocal, JSpellDictionaryServlet

public interface JSpellDictionaryAccessor

This interface describes the requirements for any JSpellDictionary object.


Method Summary
 void adjustErrorPositions(int offset)
          Adjust internal positions of any error objects.
 boolean checkCaps(char curChar, char prevChar)
          Check for end of sentence.
 boolean checkCaps(char curChar, char prevChar, boolean hasDigits, boolean capsFlag)
          Check for end of sentence.
 boolean checkWord(JSpellWordBundle word)
          Send an individual JSpellWordBundle to be checked.
 void close()
          Close access to a dictionary.
 int getBatchSize()
          Get the number of words that can be validated by this access interface before getting errors back.
 JSpellErrorInfo getCurrentError()
          Get the current error, useful when rechecking a word to get the capsFlag status.
 boolean getDictionaryReady()
          Return whether JSpellDictionary is ready.
 boolean getForceUpperCase()
          If true, return suggestions in UPPER CASE.
 boolean getIgnoreDoubleWords()
          Return whether this dictionary accessor ignores double words.
 boolean getIgnoreFirstCaps()
          Return whether this dictionary accessor ignores capitalization errors on the first word.
 boolean getIgnoreIrregularCaps()
          Return whether this dictionary accessor ignores irregular capitalization.
 boolean getIgnoreUpper()
          Return whether this dictionary accessor checks capitalized words.
 boolean getIgnoreWordsWithNumbers()
          Return whether this dictionary accessor ignores words with numbers.
 boolean getLearnWords()
          Returns whether this dictionary accessor allows learning of words.
 JSpellErrorInfo getNextError()
          Get error info/suggestions, when null caller may continue sending words to check.
 void ignoreWord(java.lang.String word)
          Add a word to the list of words to ignore/not check.
 void learnWord(java.lang.String word)
          Add a new word to the dictionary.
 void learnWordManual(java.lang.String word)
          Add a new word to the dictionary that is not persisted either to local storage or to a network dictionary.
 void open()
          Opens access to a dictionary.
 void resetAll()
          Reset dictionary and clear any cached errors.
 void resetErrors()
          Reset any cached errors.
 void setBatchSize(int batchSize)
          Set the number of words to validate in one call to the dictionary access interface.
 void setForceUpperCase(boolean forceUpperCase)
          If true, return suggestions in UPPER CASE.
 void setIgnoreDoubleWords(boolean ignoreDoubleWords)
          Ignore double words.
 void setIgnoreFirstCaps(boolean ignoreFirstCaps)
          Ignore irregular capitalization on the first word.
 void setIgnoreIrregularCaps(boolean ignoreIrregularCaps)
          Ignore irregular capitalization.
 void setIgnoreUpper(boolean ignoreWordsInCaps)
          Ignore capitalized words if true.
 void setIgnoreWordsWithNumbers(boolean ignoreWordsWithNumbers)
          Ignore words with numbers.
 

Method Detail

open

void open()
          throws JSpellException
Opens access to a dictionary.

Throws:
JSpellException - An exception.

close

void close()
Close access to a dictionary.


checkWord

boolean checkWord(JSpellWordBundle word)
                  throws java.lang.Exception
Send an individual JSpellWordBundle to be checked.

Parameters:
word - A String containing an individual word.
Returns:
true or false
Throws:
java.lang.Exception - An Exception object.

getNextError

JSpellErrorInfo getNextError()
                             throws java.lang.Exception
Get error info/suggestions, when null caller may continue sending words to check.

Returns:
A JSpellErrorInfo object.
Throws:
java.lang.Exception - An Exception

getBatchSize

int getBatchSize()
Get the number of words that can be validated by this access interface before getting errors back.

Returns:
number of words.

getDictionaryReady

boolean getDictionaryReady()
Return whether JSpellDictionary is ready.

Returns:
true or false

getLearnWords

boolean getLearnWords()
Returns whether this dictionary accessor allows learning of words.

Returns:
true or false

setBatchSize

void setBatchSize(int batchSize)
Set the number of words to validate in one call to the dictionary access interface.

Parameters:
batchSize - number of words

learnWord

void learnWord(java.lang.String word)
Add a new word to the dictionary.

Parameters:
word - A String containing an individual word.

learnWordManual

void learnWordManual(java.lang.String word)
Add a new word to the dictionary that is not persisted either to local storage or to a network dictionary.

Parameters:
word - A String containing an individual word.

ignoreWord

void ignoreWord(java.lang.String word)
Add a word to the list of words to ignore/not check.

Parameters:
word - A String containing an individual word.

getCurrentError

JSpellErrorInfo getCurrentError()
Get the current error, useful when rechecking a word to get the capsFlag status.

Returns:
A JSpellErrorInfo object.

resetAll

void resetAll()
Reset dictionary and clear any cached errors.


resetErrors

void resetErrors()
Reset any cached errors.


setIgnoreIrregularCaps

void setIgnoreIrregularCaps(boolean ignoreIrregularCaps)
Ignore irregular capitalization. Usually called directly by JSpellParser to coordinate capitalization checks and for special cases, such as the letter 'I'.

Parameters:
ignoreIrregularCaps - true or false

getIgnoreIrregularCaps

boolean getIgnoreIrregularCaps()
Return whether this dictionary accessor ignores irregular capitalization.

Returns:
true or false

setIgnoreFirstCaps

void setIgnoreFirstCaps(boolean ignoreFirstCaps)
Ignore irregular capitalization on the first word.

Parameters:
ignoreFirstCaps - true or false

getIgnoreFirstCaps

boolean getIgnoreFirstCaps()
Return whether this dictionary accessor ignores capitalization errors on the first word.

Returns:
true or false

setIgnoreWordsWithNumbers

void setIgnoreWordsWithNumbers(boolean ignoreWordsWithNumbers)
Ignore words with numbers. For example, if chemical symbols such as H20 are often encountered it may be beneficial to set this option to true.

Parameters:
ignoreWordsWithNumbers - true or false

getIgnoreWordsWithNumbers

boolean getIgnoreWordsWithNumbers()
Return whether this dictionary accessor ignores words with numbers.

Returns:
true or false

setIgnoreDoubleWords

void setIgnoreDoubleWords(boolean ignoreDoubleWords)
Ignore double words. For example, if false, then the second 'the' in this sentence would be flagged as an error. The the quick brown fox.

Parameters:
ignoreDoubleWords - true or false

getIgnoreDoubleWords

boolean getIgnoreDoubleWords()
Return whether this dictionary accessor ignores double words.

Returns:
true or false

setIgnoreUpper

void setIgnoreUpper(boolean ignoreWordsInCaps)
Ignore capitalized words if true. Otherwise spell check capitalized words.

Parameters:
ignoreWordsInCaps - true or false

getIgnoreUpper

boolean getIgnoreUpper()
Return whether this dictionary accessor checks capitalized words.

Returns:
true or false

adjustErrorPositions

void adjustErrorPositions(int offset)
Adjust internal positions of any error objects.

Parameters:
offset - number of characters to offset.

setForceUpperCase

void setForceUpperCase(boolean forceUpperCase)
If true, return suggestions in UPPER CASE.

Parameters:
forceUpperCase - true or false

getForceUpperCase

boolean getForceUpperCase()
If true, return suggestions in UPPER CASE.

Returns:
true or false

checkCaps

boolean checkCaps(char curChar,
                  char prevChar)
Check for end of sentence.

Parameters:
curChar - current character.
prevChar - previous character.
Returns:
true or false

checkCaps

boolean checkCaps(char curChar,
                  char prevChar,
                  boolean hasDigits,
                  boolean capsFlag)
Check for end of sentence.

Parameters:
curChar - current character.
prevChar - previous character.
hasDigits - embedded numbers in current word?
capsFlag - previous capitalization state.
Returns:
true or false


JSpell SDK - Spell Checker for the Java ™ Platform
Copyright © 2009 Page Scholar Inc, All Rights Reserved - http://www.jspell.com