4
#include "affixmgr.hxx"
5
#include "suggestmgr.hxx"
8
#define SPELL_COMPOUND (1 << 0)
9
#define SPELL_FORBIDDEN (1 << 1)
10
#define SPELL_ALLCAP (1 << 2)
11
#define SPELL_NOCAP (1 << 3)
12
#define SPELL_INITCAP (1 << 4)
14
#define SPELL_XML "<?xml?>"
17
#define MAXSUGGESTION 15
20
#ifndef _MYSPELLMGR_HXX_
21
#define _MYSPELLMGR_HXX_
23
class LIBHUNSPELL_DLL_EXPORTED Hunspell
26
HashMgr* pHMgr[MAXDIC];
31
struct cs_info * csconv;
39
/* Hunspell(aff, dic) - constructor of Hunspell class
40
* input: path of affix file and dictionary file
43
Hunspell(const char * affpath, const char * dpath, const char * key = NULL);
46
/* load extra dictionaries (only dic files) */
47
int add_dic(const char * dpath, const char * key = NULL);
49
/* spell(word) - spellcheck word
50
* output: 0 = bad word, not 0 = good word
53
* info: information bit array, fields:
54
* SPELL_COMPOUND = a compound word
55
* SPELL_FORBIDDEN = an explicit forbidden word
56
* root: root (stem), when input is a word with affix(es)
59
int spell(const char * word, int * info = NULL, char ** root = NULL);
61
/* suggest(suggestions, word) - search suggestions
62
* input: pointer to an array of strings pointer and the (bad) word
63
* array of strings pointer (here *slst) may not be initialized
64
* output: number of suggestions in string array, and suggestions in
65
* a newly allocated array of strings (*slts will be NULL when number
66
* of suggestion equals 0.)
69
int suggest(char*** slst, const char * word);
71
/* deallocate suggestion lists */
73
void free_list(char *** slst, int n);
75
char * get_dic_encoding();
77
/* morphological functions */
79
/* analyze(result, word) - morphological analysis of the word */
81
int analyze(char*** slst, const char * word);
83
/* stem(result, word) - stemmer function */
85
int stem(char*** slst, const char * word);
87
/* stem(result, analysis, n) - get stems from a morph. analysis
89
* char ** result, result2;
90
* int n1 = analyze(&result, "words");
91
* int n2 = stem(&result2, result, n1);
94
int stem(char*** slst, char ** morph, int n);
96
/* generate(result, word, word2) - morphological generation by example(s) */
98
int generate(char*** slst, const char * word, const char * word2);
100
/* generate(result, word, desc, n) - generation by morph. description(s)
103
* char * affix = "is:plural"; // description depends from dictionaries, too
104
* int n = generate(&result, "word", &affix, 1);
105
* for (int i = 0; i < n; i++) printf("%s\n", result[i]);
108
int generate(char*** slst, const char * word, char ** desc, int n);
110
/* functions for run-time modification of the dictionary */
112
/* add word to the run-time dictionary */
114
int add(const char * word);
116
/* add word to the run-time dictionary with affix flags of
117
* the example (a dictionary word): Hunspell will recognize
118
* affixed forms of the new word, too.
121
int add_with_affix(const char * word, const char * example);
123
/* remove word from the run-time dictionary */
125
int remove(const char * word);
129
/* get extra word characters definied in affix file for tokenization */
130
const char * get_wordchars();
131
unsigned short * get_wordchars_utf16(int * len);
133
struct cs_info * get_csconv();
134
const char * get_version();
136
int get_langnum() const;
138
/* experimental and deprecated functions */
140
#ifdef HUNSPELL_EXPERIMENTAL
141
/* suffix is an affix flag string, similarly in dictionary files */
142
int put_word_suffix(const char * word, const char * suffix);
143
char * morph_with_correction(const char * word);
145
/* spec. suggestions */
146
int suggest_auto(char*** slst, const char * word);
147
int suggest_pos_stems(char*** slst, const char * word);
151
int cleanword(char *, const char *, int * pcaptype, int * pabbrev);
152
int cleanword2(char *, const char *, w_char *, int * w_len, int * pcaptype, int * pabbrev);
153
void mkinitcap(char *);
154
int mkinitcap2(char * p, w_char * u, int nc);
155
int mkinitsmall2(char * p, w_char * u, int nc);
156
void mkallcap(char *);
157
int mkallcap2(char * p, w_char * u, int nc);
158
void mkallsmall(char *);
159
int mkallsmall2(char * p, w_char * u, int nc);
160
struct hentry * checkword(const char *, int * info, char **root);
161
char * sharps_u8_l1(char * dest, char * source);
162
hentry * spellsharps(char * base, char *, int, int, char * tmp, int * info, char **root);
163
int is_keepcase(const hentry * rv);
164
int insert_sug(char ***slst, char * word, int ns);
165
void cat_result(char * result, char * st);
166
char * stem_description(const char * desc);
167
int spellml(char*** slst, const char * word);
168
int get_xml_par(char * dest, const char * par, int maxl);
169
const char * get_xml_pos(const char * s, const char * attr);
170
int get_xml_list(char ***slst, char * list, const char * tag);
171
int check_xml_par(const char * q, const char * attr, const char * value);