2
This file is part of RoboJournal.
3
Copyright (c) 2014 by Will Kraft <pwizard@gmail.com>.
5
RoboJournal is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
10
RoboJournal is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with RoboJournal. If not, see <http://www.gnu.org/licenses/>.
19
/* ***** BEGIN LICENSE BLOCK *****
20
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
22
* The contents of this file are subject to the Mozilla Public License Version
23
* 1.1 (the "License"); you may not use this file except in compliance with
24
* the License. You may obtain a copy of the License at
25
* http://www.mozilla.org/MPL/
27
* Software distributed under the License is distributed on an "AS IS" basis,
28
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
29
* for the specific language governing rights and limitations under the
32
* The Original Code is Hunspell, based on MySpell.
34
* The Initial Developers of the Original Code are
35
* Kevin Hendricks (MySpell) and Laszlo Nemeth (Hunspell).
36
* Portions created by the Initial Developers are Copyright (C) 2002-2005
37
* the Initial Developers. All Rights Reserved.
63
* Alternatively, the contents of this file may be used under the terms of
64
* either the GNU General Public License Version 2 or later (the "GPL"), or
65
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
66
* in which case the provisions of the GPL or the LGPL are applicable instead
67
* of those above. If you wish to allow use of your version of this file only
68
* under the terms of either the GPL or the LGPL, and not to allow others to
69
* use your version of this file under the terms of the MPL, indicate your
70
* decision by deleting the provisions above and replace them with the notice
71
* and other provisions required by the GPL or the LGPL. If you do not delete
72
* the provisions above, a recipient may use your version of this file under
73
* the terms of any one of the MPL, the GPL or the LGPL.
75
* ***** END LICENSE BLOCK ***** */
77
#ifndef _MYSPELLMGR_H_
78
#define _MYSPELLMGR_H_
80
#include "hunvisapi.h"
86
typedef struct Hunhandle Hunhandle;
88
LIBHUNSPELL_DLL_EXPORTED Hunhandle *Hunspell_create(const char * affpath, const char * dpath);
90
LIBHUNSPELL_DLL_EXPORTED Hunhandle *Hunspell_create_key(const char * affpath, const char * dpath,
93
LIBHUNSPELL_DLL_EXPORTED void Hunspell_destroy(Hunhandle *pHunspell);
95
/* spell(word) - spellcheck word
96
* output: 0 = bad word, not 0 = good word
98
LIBHUNSPELL_DLL_EXPORTED int Hunspell_spell(Hunhandle *pHunspell, const char *);
100
LIBHUNSPELL_DLL_EXPORTED char *Hunspell_get_dic_encoding(Hunhandle *pHunspell);
102
/* suggest(suggestions, word) - search suggestions
103
* input: pointer to an array of strings pointer and the (bad) word
104
* array of strings pointer (here *slst) may not be initialized
105
* output: number of suggestions in string array, and suggestions in
106
* a newly allocated array of strings (*slts will be NULL when number
107
* of suggestion equals 0.)
109
LIBHUNSPELL_DLL_EXPORTED int Hunspell_suggest(Hunhandle *pHunspell, char*** slst, const char * word);
111
/* morphological functions */
113
/* analyze(result, word) - morphological analysis of the word */
115
LIBHUNSPELL_DLL_EXPORTED int Hunspell_analyze(Hunhandle *pHunspell, char*** slst, const char * word);
117
/* stem(result, word) - stemmer function */
119
LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem(Hunhandle *pHunspell, char*** slst, const char * word);
121
/* stem(result, analysis, n) - get stems from a morph. analysis
123
* char ** result, result2;
124
* int n1 = Hunspell_analyze(result, "words");
125
* int n2 = Hunspell_stem2(result2, result, n1);
128
LIBHUNSPELL_DLL_EXPORTED int Hunspell_stem2(Hunhandle *pHunspell, char*** slst, char** desc, int n);
130
/* generate(result, word, word2) - morphological generation by example(s) */
132
LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate(Hunhandle *pHunspell, char*** slst, const char * word,
135
/* generate(result, word, desc, n) - generation by morph. description(s)
138
* char * affix = "is:plural"; // description depends from dictionaries, too
139
* int n = Hunspell_generate2(result, "word", &affix, 1);
140
* for (int i = 0; i < n; i++) printf("%s\n", result[i]);
143
LIBHUNSPELL_DLL_EXPORTED int Hunspell_generate2(Hunhandle *pHunspell, char*** slst, const char * word,
146
/* functions for run-time modification of the dictionary */
148
/* add word to the run-time dictionary */
150
LIBHUNSPELL_DLL_EXPORTED int Hunspell_add(Hunhandle *pHunspell, const char * word);
152
/* add word to the run-time dictionary with affix flags of
153
* the example (a dictionary word): Hunspell will recognize
154
* affixed forms of the new word, too.
157
LIBHUNSPELL_DLL_EXPORTED int Hunspell_add_with_affix(Hunhandle *pHunspell, const char * word, const char * example);
159
/* remove word from the run-time dictionary */
161
LIBHUNSPELL_DLL_EXPORTED int Hunspell_remove(Hunhandle *pHunspell, const char * word);
163
/* free suggestion lists */
165
LIBHUNSPELL_DLL_EXPORTED void Hunspell_free_list(Hunhandle *pHunspell, char *** slst, int n);