1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/extensions/spellcheck/hunspell/src/hunspell.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,152 @@ 1.4 +/******* BEGIN LICENSE BLOCK ******* 1.5 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 1.6 + * 1.7 + * The contents of this file are subject to the Mozilla Public License Version 1.8 + * 1.1 (the "License"); you may not use this file except in compliance with 1.9 + * the License. You may obtain a copy of the License at 1.10 + * http://www.mozilla.org/MPL/ 1.11 + * 1.12 + * Software distributed under the License is distributed on an "AS IS" basis, 1.13 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 1.14 + * for the specific language governing rights and limitations under the 1.15 + * License. 1.16 + * 1.17 + * The Initial Developers of the Original Code are Kevin Hendricks (MySpell) 1.18 + * and László Németh (Hunspell). Portions created by the Initial Developers 1.19 + * are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved. 1.20 + * 1.21 + * Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca) 1.22 + * David Einstein (deinst@world.std.com) 1.23 + * László Németh (nemethl@gyorsposta.hu) 1.24 + * Caolan McNamara (caolanm@redhat.com) 1.25 + * Davide Prina 1.26 + * Giuseppe Modugno 1.27 + * Gianluca Turconi 1.28 + * Simon Brouwer 1.29 + * Noll Janos 1.30 + * Biro Arpad 1.31 + * Goldman Eleonora 1.32 + * Sarlos Tamas 1.33 + * Bencsath Boldizsar 1.34 + * Halacsy Peter 1.35 + * Dvornik Laszlo 1.36 + * Gefferth Andras 1.37 + * Nagy Viktor 1.38 + * Varga Daniel 1.39 + * Chris Halls 1.40 + * Rene Engelhard 1.41 + * Bram Moolenaar 1.42 + * Dafydd Jones 1.43 + * Harri Pitkanen 1.44 + * Andras Timar 1.45 + * Tor Lillqvist 1.46 + * 1.47 + * Alternatively, the contents of this file may be used under the terms of 1.48 + * either the GNU General Public License Version 2 or later (the "GPL"), or 1.49 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 1.50 + * in which case the provisions of the GPL or the LGPL are applicable instead 1.51 + * of those above. If you wish to allow use of your version of this file only 1.52 + * under the terms of either the GPL or the LGPL, and not to allow others to 1.53 + * use your version of this file under the terms of the MPL, indicate your 1.54 + * decision by deleting the provisions above and replace them with the notice 1.55 + * and other provisions required by the GPL or the LGPL. If you do not delete 1.56 + * the provisions above, a recipient may use your version of this file under 1.57 + * the terms of any one of the MPL, the GPL or the LGPL. 1.58 + * 1.59 + ******* END LICENSE BLOCK *******/ 1.60 + 1.61 +#ifndef _MYSPELLMGR_H_ 1.62 +#define _MYSPELLMGR_H_ 1.63 + 1.64 +#include "hunvisapi.h" 1.65 + 1.66 +#ifdef __cplusplus 1.67 +extern "C" { 1.68 +#endif 1.69 + 1.70 +typedef struct Hunhandle Hunhandle; 1.71 + 1.72 +LIBHUNSPELL_DLL_EXPORTED Hunhandle *Hunspell_create(const char * affpath, const char * dpath); 1.73 + 1.74 +LIBHUNSPELL_DLL_EXPORTED Hunhandle *Hunspell_create_key(const char * affpath, const char * dpath, 1.75 + const char * key); 1.76 + 1.77 +LIBHUNSPELL_DLL_EXPORTED void Hunspell_destroy(Hunhandle *pHunspell); 1.78 + 1.79 +/* spell(word) - spellcheck word 1.80 + * output: 0 = bad word, not 0 = good word 1.81 + */ 1.82 +LIBHUNSPELL_DLL_EXPORTED int Hunspell_spell(Hunhandle *pHunspell, const char *); 1.83 + 1.84 +LIBHUNSPELL_DLL_EXPORTED char *Hunspell_get_dic_encoding(Hunhandle *pHunspell); 1.85 + 1.86 +/* suggest(suggestions, word) - search suggestions 1.87 + * input: pointer to an array of strings pointer and the (bad) word 1.88 + * array of strings pointer (here *slst) may not be initialized 1.89 + * output: number of suggestions in string array, and suggestions in 1.90 + * a newly allocated array of strings (*slts will be NULL when number 1.91 + * of suggestion equals 0.) 1.92 + */ 1.93 +LIBHUNSPELL_DLL_EXPORTED int Hunspell_suggest(Hunhandle *pHunspell, char*** slst, const char * word); 1.94 + 1.95 + /* morphological functions */ 1.96 + 1.97 + /* analyze(result, word) - morphological analysis of the word */ 1.98 + 1.99 +LIBHUNSPELL_DLL_EXPORTED int Hunspell_analyze(Hunhandle *pHunspell, char*** slst, const char * word); 1.100 + 1.101 + /* stem(result, word) - stemmer function */ 1.102 + 1.103 +LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem(Hunhandle *pHunspell, char*** slst, const char * word); 1.104 + 1.105 + /* stem(result, analysis, n) - get stems from a morph. analysis 1.106 + * example: 1.107 + * char ** result, result2; 1.108 + * int n1 = Hunspell_analyze(result, "words"); 1.109 + * int n2 = Hunspell_stem2(result2, result, n1); 1.110 + */ 1.111 + 1.112 +LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem2(Hunhandle *pHunspell, char*** slst, char** desc, int n); 1.113 + 1.114 + /* generate(result, word, word2) - morphological generation by example(s) */ 1.115 + 1.116 +LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate(Hunhandle *pHunspell, char*** slst, const char * word, 1.117 + const char * word2); 1.118 + 1.119 + /* generate(result, word, desc, n) - generation by morph. description(s) 1.120 + * example: 1.121 + * char ** result; 1.122 + * char * affix = "is:plural"; // description depends from dictionaries, too 1.123 + * int n = Hunspell_generate2(result, "word", &affix, 1); 1.124 + * for (int i = 0; i < n; i++) printf("%s\n", result[i]); 1.125 + */ 1.126 + 1.127 +LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate2(Hunhandle *pHunspell, char*** slst, const char * word, 1.128 + char** desc, int n); 1.129 + 1.130 + /* functions for run-time modification of the dictionary */ 1.131 + 1.132 + /* add word to the run-time dictionary */ 1.133 + 1.134 +LIBHUNSPELL_DLL_EXPORTED int Hunspell_add(Hunhandle *pHunspell, const char * word); 1.135 + 1.136 + /* add word to the run-time dictionary with affix flags of 1.137 + * the example (a dictionary word): Hunspell will recognize 1.138 + * affixed forms of the new word, too. 1.139 + */ 1.140 + 1.141 +LIBHUNSPELL_DLL_EXPORTED int Hunspell_add_with_affix(Hunhandle *pHunspell, const char * word, const char * example); 1.142 + 1.143 + /* remove word from the run-time dictionary */ 1.144 + 1.145 +LIBHUNSPELL_DLL_EXPORTED int Hunspell_remove(Hunhandle *pHunspell, const char * word); 1.146 + 1.147 + /* free suggestion lists */ 1.148 + 1.149 +LIBHUNSPELL_DLL_EXPORTED void Hunspell_free_list(Hunhandle *pHunspell, char *** slst, int n); 1.150 + 1.151 +#ifdef __cplusplus 1.152 +} 1.153 +#endif 1.154 + 1.155 +#endif