tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

hunspell.h (6691B)


      1 /* ***** BEGIN LICENSE BLOCK *****
      2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
      3 *
      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/
      8 *
      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
     12 * License.
     13 *
     14 * The Original Code is Hunspell, based on MySpell.
     15 *
     16 * The Initial Developers of the Original Code are
     17 * Kevin Hendricks (MySpell) and Németh László (Hunspell).
     18 * Portions created by the Initial Developers are Copyright (C) 2002-2005
     19 * the Initial Developers. All Rights Reserved.
     20 *
     21 * Contributor(s): David Einstein, Davide Prina, Giuseppe Modugno,
     22 * Gianluca Turconi, Simon Brouwer, Noll János, Bíró Árpád,
     23 * Goldman Eleonóra, Sarlós Tamás, Bencsáth Boldizsár, Halácsy Péter,
     24 * Dvornik László, Gefferth András, Nagy Viktor, Varga Dániel, Chris Halls,
     25 * Rene Engelhard, Bram Moolenaar, Dafydd Jones, Harri Pitkänen
     26 *
     27 * Alternatively, the contents of this file may be used under the terms of
     28 * either the GNU General Public License Version 2 or later (the "GPL"), or
     29 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
     30 * in which case the provisions of the GPL or the LGPL are applicable instead
     31 * of those above. If you wish to allow use of your version of this file only
     32 * under the terms of either the GPL or the LGPL, and not to allow others to
     33 * use your version of this file under the terms of the MPL, indicate your
     34 * decision by deleting the provisions above and replace them with the notice
     35 * and other provisions required by the GPL or the LGPL. If you do not delete
     36 * the provisions above, a recipient may use your version of this file under
     37 * the terms of any one of the MPL, the GPL or the LGPL.
     38 *
     39 * ***** END LICENSE BLOCK ***** */
     40 
     41 #ifndef MYSPELLMGR_H_
     42 #define MYSPELLMGR_H_
     43 
     44 #include "hunvisapi.h"
     45 
     46 #ifdef __cplusplus
     47 extern "C" {
     48 #endif
     49 
     50 typedef struct Hunhandle Hunhandle;
     51 
     52 LIBHUNSPELL_DLL_EXPORTED Hunhandle* Hunspell_create(const char* affpath,
     53                                                    const char* dpath);
     54 
     55 LIBHUNSPELL_DLL_EXPORTED Hunhandle* Hunspell_create_key(const char* affpath,
     56                                                        const char* dpath,
     57                                                        const char* key);
     58 
     59 LIBHUNSPELL_DLL_EXPORTED void Hunspell_destroy(Hunhandle* pHunspell);
     60 
     61 /* load extra dictionaries (only dic files)
     62 * output: 0 = additional dictionary slots available, 1 = slots are now full*/
     63 LIBHUNSPELL_DLL_EXPORTED int Hunspell_add_dic(Hunhandle* pHunspell,
     64                                              const char* dpath);
     65 
     66 /* spell(word) - spellcheck word
     67 * output: 0 = bad word, not 0 = good word
     68 */
     69 LIBHUNSPELL_DLL_EXPORTED int Hunspell_spell(Hunhandle* pHunspell, const char*);
     70 
     71 LIBHUNSPELL_DLL_EXPORTED char* Hunspell_get_dic_encoding(Hunhandle* pHunspell);
     72 
     73 /* suggest(suggestions, word) - search suggestions
     74 * input: pointer to an array of strings pointer and the (bad) word
     75 *   array of strings pointer (here *slst) may not be initialized
     76 * output: number of suggestions in string array, and suggestions in
     77 *   a newly allocated array of strings (*slts will be NULL when number
     78 *   of suggestion equals 0.)
     79 */
     80 LIBHUNSPELL_DLL_EXPORTED int Hunspell_suggest(Hunhandle* pHunspell,
     81                                              char*** slst,
     82                                              const char* word);
     83 
     84 /* morphological functions */
     85 
     86 /* analyze(result, word) - morphological analysis of the word */
     87 
     88 LIBHUNSPELL_DLL_EXPORTED int Hunspell_analyze(Hunhandle* pHunspell,
     89                                              char*** slst,
     90                                              const char* word);
     91 
     92 /* stem(result, word) - stemmer function */
     93 
     94 LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem(Hunhandle* pHunspell,
     95                                           char*** slst,
     96                                           const char* word);
     97 
     98 /* stem(result, analysis, n) - get stems from a morph. analysis
     99 * example:
    100 * char ** result, result2;
    101 * int n1 = Hunspell_analyze(result, "words");
    102 * int n2 = Hunspell_stem2(result2, result, n1);
    103 */
    104 
    105 LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem2(Hunhandle* pHunspell,
    106                                            char*** slst,
    107                                            char** desc,
    108                                            int n);
    109 
    110 /* generate(result, word, word2) - morphological generation by example(s) */
    111 
    112 LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate(Hunhandle* pHunspell,
    113                                               char*** slst,
    114                                               const char* word,
    115                                               const char* word2);
    116 
    117 /* generate(result, word, desc, n) - generation by morph. description(s)
    118 * example:
    119 * char ** result;
    120 * char * affix = "is:plural"; // description depends from dictionaries, too
    121 * int n = Hunspell_generate2(result, "word", &affix, 1);
    122 * for (int i = 0; i < n; i++) printf("%s\n", result[i]);
    123 */
    124 
    125 LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate2(Hunhandle* pHunspell,
    126                                                char*** slst,
    127                                                const char* word,
    128                                                char** desc,
    129                                                int n);
    130 
    131 /* functions for run-time modification of the dictionary */
    132 
    133 /* add word to the run-time dictionary */
    134 
    135 LIBHUNSPELL_DLL_EXPORTED int Hunspell_add(Hunhandle* pHunspell,
    136                                          const char* word);
    137 
    138 /* add word to the run-time dictionary with affix flags of
    139 * the example (a dictionary word): Hunspell will recognize
    140 * affixed forms of the new word, too.
    141 */
    142 
    143 LIBHUNSPELL_DLL_EXPORTED int Hunspell_add_with_affix(Hunhandle* pHunspell,
    144                                                     const char* word,
    145                                                     const char* example);
    146 
    147 /* remove word from the run-time dictionary */
    148 
    149 LIBHUNSPELL_DLL_EXPORTED int Hunspell_remove(Hunhandle* pHunspell,
    150                                             const char* word);
    151 
    152 /* free suggestion lists */
    153 
    154 LIBHUNSPELL_DLL_EXPORTED void Hunspell_free_list(Hunhandle* pHunspell,
    155                                                 char*** slst,
    156                                                 int n);
    157 
    158 #ifdef __cplusplus
    159 }
    160 #endif
    161 
    162 #endif