Class Hunspell.Dictionary
java.lang.Object
org.languagetool.rules.spelling.hunspell.Hunspell.Dictionary
- Enclosing class:
- Hunspell
Class representing a single dictionary.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a word to the runtime dictionary.void
destroy()
Deallocate the dictionary.Used to query what are word-charactersprivate String
getWordCharsFromFile
(File affixFile) boolean
misspelled
(String word) Check if a word is spelled correctlyprotected byte[]
stringToBytes
(String str) Convert a Java string to a zero terminated byte array, in the encoding of the dictionary, as expected by the hunspell functions.Returns a list of suggestions
-
Field Details
-
hunspellDict
private com.sun.jna.Pointer hunspellDictThe pointer to the hunspell object as returned by the hunspell constructor. -
encoding
The encoding used by this dictionary -
wordChars
-
-
Constructor Details
-
Dictionary
Dictionary(String baseFileName) throws IOException Creates an instance of the dictionary.- Parameters:
baseFileName
- the base name of the dictionary,- Throws:
IOException
-
-
Method Details
-
destroy
public void destroy()Deallocate the dictionary. -
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
Check if a word is spelled correctly- Parameters:
word
- The word to check.- Returns:
- true if the
word
is not correctly spelled
-
stringToBytes
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
Returns a list of suggestions- Parameters:
word
- The word to check and offer suggestions for- Throws:
CharacterCodingException
-
getWordCharsFromFile
- Throws:
IOException
-
addWord
Adds a word to the runtime dictionary.- Parameters:
word
- Word to be added.- Throws:
UnsupportedEncodingException
-