1 /******* BEGIN LICENSE BLOCK *******
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
14 * The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
15 * and László Németh (Hunspell). Portions created by the Initial Developers
16 * are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
18 * Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
19 * David Einstein (deinst@world.std.com)
20 * László Németh (nemethl@gyorsposta.hu)
43 * Alternatively, the contents of this file may be used under the terms of
44 * either the GNU General Public License Version 2 or later (the "GPL"), or
45 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
46 * in which case the provisions of the GPL or the LGPL are applicable instead
47 * of those above. If you wish to allow use of your version of this file only
48 * under the terms of either the GPL or the LGPL, and not to allow others to
49 * use your version of this file under the terms of the MPL, indicate your
50 * decision by deleting the provisions above and replace them with the notice
51 * and other provisions required by the GPL or the LGPL. If you do not delete
52 * the provisions above, a recipient may use your version of this file under
53 * the terms of any one of the MPL, the GPL or the LGPL.
55 ******* END LICENSE BLOCK *******/
57 #ifndef _MYSPELLMGR_H_
58 #define _MYSPELLMGR_H_
64 typedef struct Hunhandle Hunhandle
;
67 #define DLL __declspec ( dllexport )
72 DLL Hunhandle
*Hunspell_create(const char * affpath
, const char * dpath
);
74 DLL Hunhandle
*Hunspell_create_key(const char * affpath
, const char * dpath
,
77 DLL
void Hunspell_destroy(Hunhandle
*pHunspell
);
79 /* spell(word) - spellcheck word
80 * output: 0 = bad word, not 0 = good word
82 DLL
int Hunspell_spell(Hunhandle
*pHunspell
, const char *);
84 DLL
char *Hunspell_get_dic_encoding(Hunhandle
*pHunspell
);
86 /* suggest(suggestions, word) - search suggestions
87 * input: pointer to an array of strings pointer and the (bad) word
88 * array of strings pointer (here *slst) may not be initialized
89 * output: number of suggestions in string array, and suggestions in
90 * a newly allocated array of strings (*slts will be NULL when number
91 * of suggestion equals 0.)
93 DLL
int Hunspell_suggest(Hunhandle
*pHunspell
, char*** slst
, const char * word
);
95 /* morphological functions */
97 /* analyze(result, word) - morphological analysis of the word */
99 DLL
int Hunspell_analyze(Hunhandle
*pHunspell
, char*** slst
, const char * word
);
101 /* stem(result, word) - stemmer function */
103 DLL
int Hunspell_stem(Hunhandle
*pHunspell
, char*** slst
, const char * word
);
105 /* stem(result, analysis, n) - get stems from a morph. analysis
107 * char ** result, result2;
108 * int n1 = Hunspell_analyze(result, "words");
109 * int n2 = Hunspell_stem2(result2, result, n1);
112 DLL
int Hunspell_stem2(Hunhandle
*pHunspell
, char*** slst
, char** desc
, int n
);
114 /* generate(result, word, word2) - morphological generation by example(s) */
116 DLL
int Hunspell_generate(Hunhandle
*pHunspell
, char*** slst
, const char * word
,
119 /* generate(result, word, desc, n) - generation by morph. description(s)
122 * char * affix = "is:plural"; // description depends from dictionaries, too
123 * int n = Hunspell_generate2(result, "word", &affix, 1);
124 * for (int i = 0; i < n; i++) printf("%s\n", result[i]);
127 DLL
int Hunspell_generate2(Hunhandle
*pHunspell
, char*** slst
, const char * word
,
130 /* functions for run-time modification of the dictionary */
132 /* add word to the run-time dictionary */
134 DLL
int Hunspell_add(Hunhandle
*pHunspell
, const char * word
);
136 /* add word to the run-time dictionary with affix flags of
137 * the example (a dictionary word): Hunspell will recognize
138 * affixed forms of the new word, too.
141 DLL
int Hunspell_add_with_affix(Hunhandle
*pHunspell
, const char * word
, const char * example
);
143 /* remove word from the run-time dictionary */
145 DLL
int Hunspell_remove(Hunhandle
*pHunspell
, const char * word
);
147 /* free suggestion lists */
149 DLL
void Hunspell_free_list(Hunhandle
*pHunspell
, char *** slst
, int n
);