com.ephox.editlive.spelling
Interface SpellChecker


public interface SpellChecker

Since:
8.0

Method Summary
 void addWord(String word)
          Notifies the SpellChecker that the user has requested a word be added to their custom dictionary.
 String autoCorrect(String word)
          Queries for an auto-correction of a word.
 boolean correct(String word)
          Queries if a word is spelt correctly.
 List<String> suggest(String word)
          Basic "suggest corrections" method.
 

Method Detail

correct

boolean correct(String word)
Queries if a word is spelt correctly. The separation of "is correct" and "suggest corrections" allows performance optimisation of features like the as-you-type spell checking, which doesn't need the list of suggestions as soon as it finds a misspelt word.

Parameters:
word -
Returns:
true if the word is correctly spelt

suggest

List<String> suggest(String word)
Basic "suggest corrections" method.

Parameters:
word -
Returns:
List of corrections of word, or empty list if it is correct.

addWord

void addWord(String word)
Notifies the SpellChecker that the user has requested a word be added to their custom dictionary. EditLive! will handle persisting the custom dictionary, this is intended as an update to the list of strings passed to SpellerLoader.load(Collection) rather than mutating that collection after the SpellChecker has loaded.

Parameters:
word -

autoCorrect

String autoCorrect(String word)
Queries for an auto-correction of a word. This is used by the Auto Correct feature every time the user finishes typing a word.

NOTE:Do not simply return the first result from suggest(String). This will result in undesirable behaviour for users. If your dictionary does not have an auto-correct feature, return null every time.

Parameters:
word -
Returns:
An auto-correction if one is available, otherwise null.

Copyright (c) 2005-2012 Ephox Pty Ltd. All rights reserved.