Hunspell(const char *affpath, const char *dpath);
Hunspell(const char *affpath, const char *dpath, const char * key);
~Hunspell();
int add_dic(const char *dpath);
int add_dic(const char *dpath, const char *key);
int spell(const char *word);
int spell(const char *word, int *info, char **root);
int suggest(char***slst, const char *word);
int analyze(char***slst, const char *word);
int stem(char***slst, const char *word);
int stem(char***slst, char **morph, int n);
int generate(char***slst, const char *word, const char *word2);
int generate(char***slst, const char *word, char **desc, int n);
void free_list(char ***slst, int n);
int add(const char *word);
int add_with_affix(const char *word, const char *example);
int remove(const char *word);
char * get_dic_encoding();
const char * get_wordchars();
unsigned short * get_wordchars_utf16(int *len);
struct cs_info * get_csconv();
The optional C header contains the C interface of the C++ library with Hunspell_create and Hunspell_destroy constructor and destructor, and an extra HunHandle parameter (the allocated object) in the wrapper functions (see in the C header file hunspell.h).
The basic spelling functions, spell() and suggest() can be used for stemming, morphological generation and analysis by XML input texts (see XML API).
The suggest() function has two input parameters, a reference variable of the output suggestion list, and an input word. The function returns the number of the suggestions. The reference variable will contain the address of the newly allocated suggestion list or NULL, if the return value of suggest() is zero. Maximal number of the suggestions is limited in the source code.
The spell() and suggest() can recognize XML input, see the XML API section.
The extended stem() and generate() use the results of a morphological analysis:
char ** result, result2; int n1 = analyze(&result, "words"); int n2 = stem(&result2, result, n1);
The morphological annotation of the Hunspell library has fixed (two letter and a colon) field identifiers, see the hunspell(4) manual page.
char ** result; char * affix = "is:plural"; // description depends from dictionaries, too int n = generate(&result, "word", &affix, 1); for (int i = 0; i < n; i++) printf("%s, result[i]);
The get_dic_encoding() function returns "ISO8859-1" or the character encoding defined in the affix file with the "SET" keyword.
The get_csconv() function returns the 8-bit character case table of the encoding of the dictionary.
The get_wordchars() and get_wordchars_utf16() return the extra word characters definied in affix file for tokenization by the "WORDCHARS" keyword.
The get_version() returns the version string of the library.
The suggest() function stems, analyzes and generates the forms of the input word, if it was added by one of the following "SPELLML" syntaxes:
<?xml?> <query type="analyze"> <word>dogs</word> </query>
<?xml?> <query type="stem"> <word>dogs</word> </query>
<?xml?> <query type="generate"> <word>dog</word> <word>cats</word> </query>
<?xml?> <query type="generate"> <word>dog</word> <code><a>is:pl</a><a>is:poss</a></code> </query>
The outputs of the type="stem" query and the stem() library function are the same. The output of the type="analyze" query is a string contained a <code><a>result1</a><a>result2</a>...</code> element. This element can be used in the second syntax of the type="generate" query.
Author of International Ispell is Geoff Kuenning.
Author of MySpell is Kevin Hendricks.
Author of Hunspell is László Németh.
Author of the original C API is Caolan McNamara.
Author of the Aspell table-driven phonetic transcription algorithm and code is Björn Jacke.
See also THANKS and Changelog files of Hunspell distribution.