Interface WebappSpellchecker
@API(type=NOT_EXTENDABLE,
src=PUBLIC)
public interface WebappSpellchecker
-
Method Summary
Modifier and TypeMethodDescriptioncheck
(List<TextChunkDescriptor> textDescriptors) Performs a spellcheck of the given text descriptors.getSuggestionsForWordAtPosition
(int position) Gets the suggestions for the word at a certain position.Get the current custom terms dictionary to be applied when doing spell checking actions.getTextDescriptors
(int startOffset, int endOffset) Returns the list of descriptors for chunks of text between the given offsets.void
replaceWithSuggestion
(int startOffset, int endOffset, String newWord) Replaces word at a certain position.void
setDefaultLanguage
(String lang) Sets the default language to be used for spell checking if an xml:lang attribute is not specified.void
setSpellcheckingEngine
(String lang, SpellcheckingEngine checker) Sets the default spellchecker for a language.void
setTermsDictionary
(Dictionary apiDict) Set a custom terms dictionary to be used on spell checking actions.
-
Method Details
-
getSuggestionsForWordAtPosition
SpellSuggestionsInfo getSuggestionsForWordAtPosition(int position) throws BadLocationException, IOException Gets the suggestions for the word at a certain position.- Parameters:
position
- Position in the document.- Returns:
- List of spellchecking suggestions for the word.
- Throws:
BadLocationException
IOException
-
replaceWithSuggestion
void replaceWithSuggestion(int startOffset, int endOffset, String newWord) throws BadLocationException, IOException Replaces word at a certain position.- Parameters:
startOffset
- Start offset for replacement.endOffset
- End offset for replacement.newWord
- Word to be inserted.- Throws:
BadLocationException
IOException
-
getTextDescriptors
Returns the list of descriptors for chunks of text between the given offsets.- Parameters:
startOffset
- The start offset.endOffset
- The end offset.- Returns:
- The list of text descriptors.
-
check
Performs a spellcheck of the given text descriptors. This method is thread-safe. Can be called on multiple threads and can also be called while other threads are modifying the document.- Parameters:
textDescriptors
- The text descriptors.- Returns:
- The list of spelling problems.
- Throws:
IOException
- If there is a problem reading the dictionaries.
-
getTermsDictionary
Dictionary getTermsDictionary()Get the current custom terms dictionary to be applied when doing spell checking actions.- Returns:
- Returns the custom terms dictionary.
- Since:
- 21
-
setTermsDictionary
Set a custom terms dictionary to be used on spell checking actions.- Parameters:
apiDict
- The terms dictionary to set.- Since:
- 21
-
setDefaultLanguage
Sets the default language to be used for spell checking if an xml:lang attribute is not specified. Examples of format: en_US, fr_FR, de_DE, jp_JP, it_IT, nl_NL- Parameters:
lang
- The language used to be used for spell checking.- Since:
- 21
-
setSpellcheckingEngine
Sets the default spellchecker for a language. Examples of language format: en_US, fr_FR, de_DE, jp_JP, it_IT, nl_NL- Parameters:
lang
- The language to be handled by the spell checking engine.checker
- The spell checking engine to be used for the language.- Since:
- 21
-