public class Hunspell extends Object implements HunspellLibrary
| Modifier and Type | Class and Description |
|---|---|
class |
Hunspell.Dictionary
Class representing a single dictionary.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Hunspell(String libDir)
Constructor for the library, loads the native lib.
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroyDictionary(String baseFileName)
Removes a dictionary from the internal cache.
|
Hunspell.Dictionary |
getDictionary(String baseFileName)
Gets an instance of the dictionary.
|
Hunspell.Dictionary |
getDictionary(String baseFileName,
boolean isUpdateAllowed)
Gets an instance of the dictionary optionally checking to see if it has
changed since the last time it was cached.
|
static Hunspell |
getInstance()
The instance of the HunspellManager, looks for the native lib in the
default directories
|
static Hunspell |
getInstance(String libDir)
The instance of the HunspellManager, looks for the native lib in
the directory specified.
|
String |
getLibFile() |
int |
Hunspell_add(com.sun.jna.Pointer pHunspell,
byte[] word) |
int |
Hunspell_analyze(com.sun.jna.Pointer pHunspell,
com.sun.jna.ptr.PointerByReference slst,
byte[] word)
Analyze word morphology
|
com.sun.jna.Pointer |
Hunspell_create(String affpath,
String dpath)
Create the hunspell instance
|
void |
Hunspell_destroy(com.sun.jna.Pointer pHunspell)
Destroy him my robots...
|
void |
Hunspell_free_list(com.sun.jna.Pointer pHunspell,
com.sun.jna.ptr.PointerByReference slst,
int n)
Free the memory used by the lists created as output from the other functions.
|
String |
Hunspell_get_dic_encoding(com.sun.jna.Pointer pHunspell)
Get the dictionary encoding
|
int |
Hunspell_remove(com.sun.jna.Pointer pHunspell,
byte[] word) |
int |
Hunspell_spell(com.sun.jna.Pointer pHunspell,
byte[] word)
spell(word) - spellcheck word
|
int |
Hunspell_stem(com.sun.jna.Pointer pHunspell,
com.sun.jna.ptr.PointerByReference slst,
byte[] word)
Find stem(s) for a word
|
int |
Hunspell_suggest(com.sun.jna.Pointer pHunspell,
com.sun.jna.ptr.PointerByReference slst,
byte[] word)
Search suggestions
|
static String |
libName()
Calculate the filename of the native hunspell lib.
|
protected Hunspell(String libDir) throws UnsatisfiedLinkError, UnsupportedOperationException
libDir - Optional absolute directory where the native lib can be found.UnsupportedOperationException - if the OS or architecture is simply not supported.UnsatisfiedLinkErrorpublic com.sun.jna.Pointer Hunspell_create(String affpath, String dpath)
HunspellLibraryHunspell_create in interface HunspellLibraryaffpath - The affix filedpath - The dictionary filepublic void Hunspell_destroy(com.sun.jna.Pointer pHunspell)
HunspellLibraryHunspell_destroy in interface HunspellLibrarypHunspell - The Hunspell object returned by Hunspell_createpublic int Hunspell_spell(com.sun.jna.Pointer pHunspell,
byte[] word)
HunspellLibraryHunspell_spell in interface HunspellLibrarypHunspell - The Hunspell object returned by Hunspell_createword - The word to spellcheck.public String Hunspell_get_dic_encoding(com.sun.jna.Pointer pHunspell)
HunspellLibraryHunspell_get_dic_encoding in interface HunspellLibrarypHunspell - : The Hunspell object returned by Hunspell_createpublic int Hunspell_suggest(com.sun.jna.Pointer pHunspell,
com.sun.jna.ptr.PointerByReference slst,
byte[] word)
HunspellLibraryHunspell_suggest in interface HunspellLibrarypHunspell - The Hunspell object returned by Hunspell_createslst - input: pointer to an array of strings pointer and the (bad) word
array of strings pointer (here *slst) may not be initialized
output: number of suggestions in string array, and suggestions in
a newly allocated array of strings (*slts will be NULL when number
of suggestion equals 0.)word - The word to offer suggestions for.public int Hunspell_analyze(com.sun.jna.Pointer pHunspell,
com.sun.jna.ptr.PointerByReference slst,
byte[] word)
HunspellLibraryHunspell_analyze in interface HunspellLibrarypHunspell - The Hunspell object returned by Hunspell_createslst - input: pointer to an array of strings pointer and the word to analyze
array of strings pointer (here *slst) may not be initialized
output: number of analyses in string array, and analyses in
a newly allocated array of strings (*slts will be NULL when number
of analyses equals 0.)word - The word to analyze.public int Hunspell_stem(com.sun.jna.Pointer pHunspell,
com.sun.jna.ptr.PointerByReference slst,
byte[] word)
HunspellLibraryHunspell_stem in interface HunspellLibrarypHunspell - The Hunspell object returned by Hunspell_createslst - input: pointer to an array of strings pointer and the word to be stemmed
array of strings pointer (here *slst) may not be initialized
output: number of stems in string array, and stems in
a newly allocated array of strings (*slts will be NULL when number
of stems equals 0.)word - The word to find stems for.public void Hunspell_free_list(com.sun.jna.Pointer pHunspell,
com.sun.jna.ptr.PointerByReference slst,
int n)
HunspellLibraryHunspell_free_list in interface HunspellLibrarypHunspell - the Hunspell object returned by HunspellLibrary.Hunspell_create(String, String)slst - the PointerByReference (char***) that is used for the suggestion listspublic int Hunspell_add(com.sun.jna.Pointer pHunspell,
byte[] word)
public int Hunspell_remove(com.sun.jna.Pointer pHunspell,
byte[] word)
public static Hunspell getInstance() throws UnsatisfiedLinkError, UnsupportedOperationException
public static Hunspell getInstance(String libDir) throws UnsatisfiedLinkError, UnsupportedOperationException
libDir - Optional absolute directory where the native lib can be found.UnsatisfiedLinkErrorUnsupportedOperationExceptionpublic String getLibFile()
public static String libName() throws UnsupportedOperationException
UnsupportedOperationExceptionpublic Hunspell.Dictionary getDictionary(String baseFileName) throws FileNotFoundException, UnsupportedEncodingException
baseFileName - the base name of the dictionary,
passing /dict/da_DK means that the files /dict/da_DK.dic
and /dict/da_DK.aff get loadedFileNotFoundExceptionUnsupportedEncodingExceptionpublic Hunspell.Dictionary getDictionary(String baseFileName, boolean isUpdateAllowed) throws FileNotFoundException, UnsupportedEncodingException
baseFileName - the base name of the dictionary,
passing /dict/da_DK means that the files /dict/da_DK.dic
and /dict/da_DK.aff get loadedisUpdateAllowed - FileNotFoundExceptionUnsupportedEncodingExceptionpublic void destroyDictionary(String baseFileName)
baseFileName - the base name of the dictionary, as passed to
getDictionary()Copyright © 2019. All rights reserved.