Class SpellChecker

  • All Implemented Interfaces:
    ISpellChecker

    public class SpellChecker
    extends java.lang.Object
    implements ISpellChecker
    Common spell checker interface for use any spellchecker providers.
    • 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 library
      java.util.List<Token> getMisspelledTokens​(java.lang.String text)
      Get a list of misspelled tokens from the given text
      void ignoreWord​(java.lang.String word)
      Add a word to the list of ignored words
      void 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 list
      boolean isLearnedWord​(java.lang.String word)
      Determine if the given word is on the learned list
      void learnWord​(java.lang.String word)
      Add a word to the list of correct words
      void saveWordLists()
      Save the word lists to disk
      java.util.List<java.lang.String> suggest​(java.lang.String word)
      return a list of strings as suggestions
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_DICTIONARY_DIR

        public static final java.io.File DEFAULT_DICTIONARY_DIR
    • Constructor Detail

      • SpellChecker

        public SpellChecker()
        Creates a new instance of SpellChecker
    • 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 interface ISpellChecker
      • destroy

        public void destroy()
        destroy the library
        Specified by:
        destroy in interface ISpellChecker
      • saveWordLists

        public void saveWordLists()
        Save the word lists to disk
        Specified by:
        saveWordLists in interface ISpellChecker
      • 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 interface ISpellChecker
      • suggest

        public java.util.List<java.lang.String> suggest​(java.lang.String word)
        return a list of strings as suggestions
        Specified by:
        suggest in interface ISpellChecker
      • ignoreWord

        public void ignoreWord​(java.lang.String word)
        Add a word to the list of ignored words
        Specified by:
        ignoreWord in interface ISpellChecker
      • learnWord

        public void learnWord​(java.lang.String word)
        Add a word to the list of correct words
        Specified by:
        learnWord in interface ISpellChecker
      • 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 interface ISpellChecker
      • 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 interface ISpellChecker
      • 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 interface ISpellChecker