Package org.omegat.core.spellchecker
Class SpellChecker
- java.lang.Object
-
- org.omegat.core.spellchecker.SpellChecker
-
- All Implemented Interfaces:
ISpellChecker
public class SpellChecker extends java.lang.Object implements ISpellChecker
Common spell checker interface for use any spellchecker providers.
-
-
Field Summary
Fields Modifier and Type Field Description static java.io.File
DEFAULT_DICTIONARY_DIR
-
Constructor Summary
Constructors Constructor Description SpellChecker()
Creates a new instance of SpellChecker
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
destroy the libraryjava.util.List<Token>
getMisspelledTokens(java.lang.String text)
Get a list of misspelled tokens from the given textvoid
ignoreWord(java.lang.String word)
Add a word to the list of ignored wordsvoid
initialize()
Initialize the library for the given project.boolean
isCorrect(java.lang.String word)
Check the word.boolean
isIgnoredWord(java.lang.String word)
Determine if the given word is on the ignored listboolean
isLearnedWord(java.lang.String word)
Determine if the given word is on the learned listvoid
learnWord(java.lang.String word)
Add a word to the list of correct wordsvoid
saveWordLists()
Save the word lists to diskjava.util.List<java.lang.String>
suggest(java.lang.String word)
return a list of strings as suggestions
-
-
-
Method Detail
-
initialize
public void initialize()
Initialize the library for the given project. Loads the lists of ignored and learned words for the project- Specified by:
initialize
in interfaceISpellChecker
-
destroy
public void destroy()
destroy the library- Specified by:
destroy
in interfaceISpellChecker
-
saveWordLists
public void saveWordLists()
Save the word lists to disk- Specified by:
saveWordLists
in interfaceISpellChecker
-
isCorrect
public boolean isCorrect(java.lang.String word)
Check the word. If it is ignored or learned (valid), returns true. Otherwise false.- Specified by:
isCorrect
in interfaceISpellChecker
-
suggest
public java.util.List<java.lang.String> suggest(java.lang.String word)
return a list of strings as suggestions- Specified by:
suggest
in interfaceISpellChecker
-
ignoreWord
public void ignoreWord(java.lang.String word)
Add a word to the list of ignored words- Specified by:
ignoreWord
in interfaceISpellChecker
-
learnWord
public void learnWord(java.lang.String word)
Add a word to the list of correct words- Specified by:
learnWord
in interfaceISpellChecker
-
isIgnoredWord
public boolean isIgnoredWord(java.lang.String word)
Description copied from interface:ISpellChecker
Determine if the given word is on the ignored list- Specified by:
isIgnoredWord
in interfaceISpellChecker
-
isLearnedWord
public boolean isLearnedWord(java.lang.String word)
Description copied from interface:ISpellChecker
Determine if the given word is on the learned list- Specified by:
isLearnedWord
in interfaceISpellChecker
-
getMisspelledTokens
public java.util.List<Token> getMisspelledTokens(java.lang.String text)
Description copied from interface:ISpellChecker
Get a list of misspelled tokens from the given text- Specified by:
getMisspelledTokens
in interfaceISpellChecker
-
-