Tizen 2.1 base
[external/enchant.git] / src / myspell / hunspell.h
1 #ifndef _MYSPELLMGR_H_
2 #define _MYSPELLMGR_H_
3
4 #include "hunvisapi.h"
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 typedef struct Hunhandle Hunhandle;
11
12 LIBHUNSPELL_DLL_EXPORTED Hunhandle *Hunspell_create(const char * affpath, const char * dpath);
13
14 LIBHUNSPELL_DLL_EXPORTED Hunhandle *Hunspell_create_key(const char * affpath, const char * dpath,
15     const char * key);
16
17 LIBHUNSPELL_DLL_EXPORTED void Hunspell_destroy(Hunhandle *pHunspell);
18
19 /* spell(word) - spellcheck word
20  * output: 0 = bad word, not 0 = good word
21  */
22 LIBHUNSPELL_DLL_EXPORTED int Hunspell_spell(Hunhandle *pHunspell, const char *);
23
24 LIBHUNSPELL_DLL_EXPORTED char *Hunspell_get_dic_encoding(Hunhandle *pHunspell);
25
26 /* suggest(suggestions, word) - search suggestions
27  * input: pointer to an array of strings pointer and the (bad) word
28  *   array of strings pointer (here *slst) may not be initialized
29  * output: number of suggestions in string array, and suggestions in
30  *   a newly allocated array of strings (*slts will be NULL when number
31  *   of suggestion equals 0.)
32  */
33 LIBHUNSPELL_DLL_EXPORTED int Hunspell_suggest(Hunhandle *pHunspell, char*** slst, const char * word);
34
35  /* morphological functions */
36
37  /* analyze(result, word) - morphological analysis of the word */
38
39 LIBHUNSPELL_DLL_EXPORTED int Hunspell_analyze(Hunhandle *pHunspell, char*** slst, const char * word);
40
41  /* stem(result, word) - stemmer function */
42
43 LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem(Hunhandle *pHunspell, char*** slst, const char * word);
44
45  /* stem(result, analysis, n) - get stems from a morph. analysis
46   * example:
47   * char ** result, result2;
48   * int n1 = Hunspell_analyze(result, "words");
49   * int n2 = Hunspell_stem2(result2, result, n1);   
50   */
51
52 LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem2(Hunhandle *pHunspell, char*** slst, char** desc, int n);
53
54  /* generate(result, word, word2) - morphological generation by example(s) */
55
56 LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate(Hunhandle *pHunspell, char*** slst, const char * word,
57     const char * word2);
58
59  /* generate(result, word, desc, n) - generation by morph. description(s)
60   * example:
61   * char ** result;
62   * char * affix = "is:plural"; // description depends from dictionaries, too
63   * int n = Hunspell_generate2(result, "word", &affix, 1);
64   * for (int i = 0; i < n; i++) printf("%s\n", result[i]);
65   */
66
67 LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate2(Hunhandle *pHunspell, char*** slst, const char * word,
68     char** desc, int n);
69
70   /* functions for run-time modification of the dictionary */
71
72   /* add word to the run-time dictionary */
73   
74 LIBHUNSPELL_DLL_EXPORTED int Hunspell_add(Hunhandle *pHunspell, const char * word);
75
76   /* add word to the run-time dictionary with affix flags of
77    * the example (a dictionary word): Hunspell will recognize
78    * affixed forms of the new word, too.
79    */
80   
81 LIBHUNSPELL_DLL_EXPORTED int Hunspell_add_with_affix(Hunhandle *pHunspell, const char * word, const char * example);
82
83   /* remove word from the run-time dictionary */
84
85 LIBHUNSPELL_DLL_EXPORTED int Hunspell_remove(Hunhandle *pHunspell, const char * word);
86
87   /* free suggestion lists */
88
89 LIBHUNSPELL_DLL_EXPORTED void Hunspell_free_list(Hunhandle *pHunspell, char *** slst, int n);
90
91 #ifdef __cplusplus
92 }
93 #endif
94
95 #endif