Class Hunspell.Dictionary

java.lang.Object
org.languagetool.rules.spelling.hunspell.Hunspell.Dictionary
Enclosing class:
Hunspell

public class Hunspell.Dictionary extends Object
Class representing a single dictionary.
  • Method Details

    • destroy

      public void destroy()
      Deallocate the dictionary.
    • getWordChars

      public String getWordChars()
      Used to query what are word-characters
      Returns:
      A string composed of characters that are parts of words, even if they are not alphabetic.
    • misspelled

      public boolean misspelled(String word)
      Check if a word is spelled correctly
      Parameters:
      word - The word to check.
      Returns:
      true if the word is not correctly spelled
    • stringToBytes

      protected byte[] stringToBytes(String str) throws UnsupportedEncodingException
      Convert a Java string to a zero terminated byte array, in the encoding of the dictionary, as expected by the hunspell functions.
      Throws:
      UnsupportedEncodingException
    • suggest

      public List<String> suggest(String word) throws CharacterCodingException
      Returns a list of suggestions
      Parameters:
      word - The word to check and offer suggestions for
      Throws:
      CharacterCodingException
    • addWord

      public void addWord(String word) throws UnsupportedEncodingException
      Adds a word to the runtime dictionary.
      Parameters:
      word - Word to be added.
      Throws:
      UnsupportedEncodingException