Merge branch 'win7-taskbar'
[TortoiseGit.git] / ext / hunspell / suggestmgr.hxx
blob70af7f13f94c2f392a0d34c845fa7b0a99b66c19
1 #ifndef _SUGGESTMGR_HXX_
2 #define _SUGGESTMGR_HXX_
4 #define MAXSWL 100
5 #define MAXSWUTF8L (MAXSWL * 4)
6 #define MAX_ROOTS 100
7 #define MAX_WORDS 100
8 #define MAX_GUESS 100
9 #define MAXNGRAMSUGS 5
11 #define MINTIMER 500
12 #define MAXPLUSTIMER 500
14 #define NGRAM_IGNORE_LENGTH 0
15 #define NGRAM_LONGER_WORSE 1
16 #define NGRAM_ANY_MISMATCH 2
18 #include "atypes.hxx"
19 #include "affixmgr.hxx"
20 #include "hashmgr.hxx"
21 #include "langnum.hxx"
22 #include <time.h>
24 enum { LCS_UP, LCS_LEFT, LCS_UPLEFT };
26 class SuggestMgr
28 char * ctry;
29 int ctryl;
30 w_char * ctry_utf;
32 AffixMgr* pAMgr;
33 int maxSug;
34 struct cs_info * csconv;
35 int utf8;
36 int nosplitsugs;
37 int maxngramsugs;
38 int complexprefixes;
41 public:
42 SuggestMgr(const char * tryme, int maxn, AffixMgr *aptr);
43 ~SuggestMgr();
45 int suggest(char*** slst, const char * word, int nsug);
46 int ngsuggest(char ** wlst, char * word, HashMgr* pHMgr);
47 int suggest_auto(char*** slst, const char * word, int nsug);
48 int suggest_stems(char*** slst, const char * word, int nsug);
49 int suggest_pos_stems(char*** slst, const char * word, int nsug);
51 char * suggest_morph(const char * word);
52 char * suggest_morph_for_spelling_error(const char * word);
54 private:
55 int testsug(char** wlst, const char * candidate, int wl, int ns, int cpdsuggest,
56 int * timer, time_t * timelimit);
57 int checkword(const char *, int, int, int *, time_t *);
58 int check_forbidden(const char *, int);
60 int capchars(char **, const char *, int, int);
61 int replchars(char**, const char *, int, int);
62 int doubletwochars(char**, const char *, int, int);
63 int forgotchar(char **, const char *, int, int);
64 int swapchar(char **, const char *, int, int);
65 int longswapchar(char **, const char *, int, int);
66 int movechar(char **, const char *, int, int);
67 int extrachar(char **, const char *, int, int);
68 int badchar(char **, const char *, int, int);
69 int twowords(char **, const char *, int, int);
70 int fixstems(char **, const char *, int);
72 int capchars_utf(char **, const w_char *, int wl, int, int);
73 int doubletwochars_utf(char**, const w_char *, int wl, int, int);
74 int forgotchar_utf(char**, const w_char *, int wl, int, int);
75 int extrachar_utf(char**, const w_char *, int wl, int, int);
76 int badchar_utf(char **, const w_char *, int wl, int, int);
77 int swapchar_utf(char **, const w_char *, int wl, int, int);
78 int longswapchar_utf(char **, const w_char *, int, int, int);
79 int movechar_utf(char **, const w_char *, int, int, int);
81 int mapchars(char**, const char *, int);
82 int map_related(const char *, int, char ** wlst, int, const mapentry*, int, int *, time_t *);
83 int map_related_utf(w_char *, int, int, char ** wlst, int, const mapentry*, int, int *, time_t *);
84 int ngram(int n, char * s1, const char * s2, int uselen);
85 int mystrlen(const char * word);
86 int equalfirstletter(char * s1, const char * s2);
87 int commoncharacterpositions(char * s1, const char * s2, int * is_swap);
88 void bubblesort( char ** rwd, int * rsc, int n);
89 void lcs(const char * s, const char * s2, int * l1, int * l2, char ** result);
90 int lcslen(const char * s, const char* s2);
94 #endif