public abstract class JSpellDictionary extends java.lang.Object implements JSpellDictionaryAccessor
Modifier and Type | Field and Description |
---|---|
protected int |
batchCount
This variable is used internally.
|
protected int |
batchSize
This variable determines the number of words to send to the server in a single 'batch'.
|
static java.lang.String |
defaultCountry
System default country.
|
static java.lang.String |
defaultLanguage
System default language.
|
static java.lang.String |
defaultVersion
Default version.
|
protected java.util.Vector |
errors
A Vector containing the errors returned by the spell checker.
|
protected java.lang.String |
language
Descriptive name of language, e.g.
|
protected boolean |
learnWords
If true, the user (local or server) may permanently add words to the dictionary.
|
protected int |
maxSuggestions
The maximum number of suggestions to return.
|
protected Suggestions |
suggestions
The suggestions for the incorrect word.
|
Constructor and Description |
---|
JSpellDictionary()
Constructs a JSpellDictionary object.
|
Modifier and Type | Method and Description |
---|---|
void |
adjustErrorPositions(int offset)
Used to adjust the internal position references of the errors returned by the
spell checker.
|
boolean |
checkCaps(char curChar,
char prevChar)
This method determines if JSpell is at the end of a sentence.
|
boolean |
checkCaps(char curChar,
char prevChar,
boolean hasDigits,
boolean capsFlag)
This method determines if JSpell is at the end of a sentence.
|
boolean |
checkWord(JSpellWordBundle word)
Sends words to be checked by the dictionary.
|
int |
getBatchSize()
Get the number of words that can be validated by this access interface
before getting errors back
|
JSpellErrorInfo |
getCurrentError()
Returns the current error from the dictionary.
|
java.lang.String |
getDictionaryCountry()
Returns the country of the dictionary.
|
java.lang.String |
getDictionaryLanguage()
Returns the language of the dictionary.
|
boolean |
getDictionaryReady()
Retrieves the ready state of the dictionary.
|
java.lang.String |
getDictionaryVersion()
Returns the version of the dictionary.
|
boolean |
getForceUpperCase()
Is this dictionary configured to return suggestions in UPPER CASE.
|
boolean |
getIgnoreDoubleWords()
Returns the ignoreDoubleWords variable.
|
boolean |
getIgnoreFirstCaps()
Return whether this dictionary accessor ignores capitalization errors on the first word.
|
boolean |
getIgnoreIrregularCaps()
Returns ignoreIrregularCaps variable.
|
boolean |
getIgnoreUpper()
Returns the ignoreUpper variable.
|
boolean |
getIgnoreWordsWithNumbers()
Returns the ignoreWordsWithNumbers variable.
|
java.lang.String |
getLanguage()
Descriptive text name for language, e.g.
|
boolean |
getLearnWords()
Can words be added to the dictionary?
|
JSpellErrorInfo |
getNextError()
Retrieves the next error from the dictionary.
|
void |
ignoreWord(java.lang.String word)
Add a word to the list of words to ignore/not check.
|
protected void |
init()
Initializes the JSpellDictionary object by creating the HashMaps, Vectors and
other internal structures used by the JSpellDictionary object.
|
boolean |
isValidWord(java.lang.String word)
Check if a word is already valid.
|
void |
learnWord(java.lang.String word)
Add a new word to the dictionary.
|
void |
learnWordManual(java.lang.String word)
Add a word to the internal dictionary but don't persist it
to local storage or a network dictionary.
|
void |
resetAll()
Resets the state of the dictionary.
|
void |
resetErrors()
Resets any pending errors.
|
void |
setBatchSize(int batchSize)
Set the number of words to validate in one call to the dictionary
access interface.
|
protected void |
setDictionaryReady(boolean newValue)
Sets the ready state of the dictionary.
|
void |
setForceUpperCase(boolean forceUpperCase)
When true, causes all suggestions to be in UPPER CASE.
|
void |
setIgnoreDoubleWords(boolean ignoreDoubleWords)
Sets the ignoreDoubleWords variable.
|
void |
setIgnoreFirstCaps(boolean ignoreFirstCaps)
Ignore irregular capitalization on the first word.
|
void |
setIgnoreIrregularCaps(boolean ignoreIrregularCaps)
When false, JSpell will flag an error if a word is at the beginning of a
sentence but is not capitalized.
|
void |
setIgnoreUpper(boolean ignoreUpper)
Sets the ignoreUpper variable.
|
void |
setIgnoreWordsWithNumbers(boolean ignoreWordsWithNumbers)
Sets the ignoreWordsWithNumbers variable.
|
void |
setLanguage(java.lang.String language)
Descriptive text name for language, e.g.
|
void |
setLearnWords(boolean learnWords)
Can words be added to the dictionary.
|
void |
setMaxSuggestions(int count)
Sets the maximum number of suggestions that the spell checker engine should
return.
|
void |
validWordsPut(java.lang.String word)
Add a to the in memory dictionary only, to save disk access when validating words.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, open
protected int batchSize
protected int batchCount
protected Suggestions suggestions
protected int maxSuggestions
protected boolean learnWords
protected java.util.Vector errors
protected java.lang.String language
public static java.lang.String defaultLanguage
public static java.lang.String defaultCountry
public static java.lang.String defaultVersion
public JSpellDictionary()
protected void init()
protected void setDictionaryReady(boolean newValue)
newValue
- Is dictionary ready?public boolean getDictionaryReady()
getDictionaryReady
in interface JSpellDictionaryAccessor
public void setForceUpperCase(boolean forceUpperCase)
setForceUpperCase
in interface JSpellDictionaryAccessor
forceUpperCase
- true or falsepublic boolean getForceUpperCase()
getForceUpperCase
in interface JSpellDictionaryAccessor
public void setLearnWords(boolean learnWords)
learnWords
- true or falsepublic boolean getLearnWords()
getLearnWords
in interface JSpellDictionaryAccessor
public void setLanguage(java.lang.String language)
language
- a String.public java.lang.String getLanguage()
public final java.lang.String getDictionaryLanguage()
public final java.lang.String getDictionaryCountry()
public final java.lang.String getDictionaryVersion()
public int getBatchSize()
getBatchSize
in interface JSpellDictionaryAccessor
public void setIgnoreIrregularCaps(boolean ignoreIrregularCaps)
setIgnoreIrregularCaps
in interface JSpellDictionaryAccessor
ignoreIrregularCaps
- true or falsepublic boolean getIgnoreIrregularCaps()
getIgnoreIrregularCaps
in interface JSpellDictionaryAccessor
public void setIgnoreFirstCaps(boolean ignoreFirstCaps)
setIgnoreFirstCaps
in interface JSpellDictionaryAccessor
ignoreFirstCaps
- true or falsepublic boolean getIgnoreFirstCaps()
getIgnoreFirstCaps
in interface JSpellDictionaryAccessor
public void setIgnoreUpper(boolean ignoreUpper)
setIgnoreUpper
in interface JSpellDictionaryAccessor
ignoreUpper
- true or falsepublic boolean getIgnoreUpper()
getIgnoreUpper
in interface JSpellDictionaryAccessor
public void setIgnoreDoubleWords(boolean ignoreDoubleWords)
setIgnoreDoubleWords
in interface JSpellDictionaryAccessor
ignoreDoubleWords
- true or falsepublic boolean getIgnoreDoubleWords()
getIgnoreDoubleWords
in interface JSpellDictionaryAccessor
public void setIgnoreWordsWithNumbers(boolean ignoreWordsWithNumbers)
setIgnoreWordsWithNumbers
in interface JSpellDictionaryAccessor
ignoreWordsWithNumbers
- true or falsepublic boolean getIgnoreWordsWithNumbers()
getIgnoreWordsWithNumbers
in interface JSpellDictionaryAccessor
public void setMaxSuggestions(int count)
count
- number of suggestionspublic void setBatchSize(int batchSize)
setBatchSize
in interface JSpellDictionaryAccessor
batchSize
- number of words for each batchpublic void validWordsPut(java.lang.String word)
public boolean isValidWord(java.lang.String word)
public void learnWord(java.lang.String word)
learnWord
in interface JSpellDictionaryAccessor
word
- A string containing an individual word.public void learnWordManual(java.lang.String word)
learnWordManual
in interface JSpellDictionaryAccessor
word
- A string containing an individual word.public void ignoreWord(java.lang.String word)
ignoreWord
in interface JSpellDictionaryAccessor
word
- A string containing an individual word.public void resetAll()
resetAll
in interface JSpellDictionaryAccessor
public void resetErrors()
resetErrors
in interface JSpellDictionaryAccessor
public void adjustErrorPositions(int offset)
adjustErrorPositions
in interface JSpellDictionaryAccessor
offset
- The number of characters by which to adjust the remaining errors.public JSpellErrorInfo getNextError() throws java.lang.Exception
getNextError
in interface JSpellDictionaryAccessor
java.lang.Exception
- The exception that occurred during processing.public JSpellErrorInfo getCurrentError()
getCurrentError
in interface JSpellDictionaryAccessor
public boolean checkWord(JSpellWordBundle word) throws java.lang.Exception
checkWord
in interface JSpellDictionaryAccessor
word
- A String containing an individual word.java.lang.Exception
- The Exception object when an error occurs.public boolean checkCaps(char curChar, char prevChar)
checkCaps
in interface JSpellDictionaryAccessor
curChar
- The current character.prevChar
- The previous character.public boolean checkCaps(char curChar, char prevChar, boolean hasDigits, boolean capsFlag)
checkCaps
in interface JSpellDictionaryAccessor
curChar
- The current character.prevChar
- The previous character.hasDigits
- Word contains digits.capsFlag
- Is caps checking enabled?JSpell SDK - Spell Checker for the Java Platform
Copyright © 2009-2019 Page Scholar Inc, All Rights Reserved - https://www.jspell.com