9 #include "baseaffix.hxx"
10 #include "hashmgr.hxx"
12 #include "replist.hxx"
14 // check flag duplication
15 #define dupSFX (1 << 0)
16 #define dupPFX (1 << 1)
21 class LIBHUNSPELL_DLL_EXPORTED AffixMgr
24 PfxEntry
* pStart
[SETSIZE
];
25 SfxEntry
* sStart
[SETSIZE
];
26 PfxEntry
* pFlag
[SETSIZE
];
27 SfxEntry
* sFlag
[SETSIZE
];
34 struct cs_info
* csconv
;
42 FLAG compoundforbidflag
;
43 FLAG compoundpermitflag
;
46 int checkcompoundcase
;
47 int checkcompoundtriple
;
63 patentry
* checkcpdtable
;
66 flagentry
* defcpdtable
;
77 w_char
* cpdvowels_utf16
;
78 int cpdvowels_utf16_len
;
79 char * cpdsyllablenum
;
80 const char * pfxappnd
; // BUG: not stateless
81 const char * sfxappnd
; // BUG: not stateless
82 FLAG sfxflag
; // BUG: not stateless
83 char * derived
; // BUG: not stateless
84 SfxEntry
* sfx
; // BUG: not stateless
85 PfxEntry
* pfx
; // BUG: not stateless
88 unsigned short * wordchars_utf16
;
89 int wordchars_utf16_len
;
91 unsigned short * ignorechars_utf16
;
92 int ignorechars_utf16_len
;
107 int havecontclass
; // boolean variable
108 char contclasses
[CONTSIZE
]; // flags of possible continuing classes (twofold affix)
112 AffixMgr(const char * affpath
, HashMgr
** ptr
, int * md
,
113 const char * key
= NULL
);
115 struct hentry
* affix_check(const char * word
, int len
,
116 const unsigned short needflag
= (unsigned short) 0,
117 char in_compound
= IN_CPD_NOT
);
118 struct hentry
* prefix_check(const char * word
, int len
,
119 char in_compound
, const FLAG needflag
= FLAG_NULL
);
120 inline int isSubset(const char * s1
, const char * s2
);
121 struct hentry
* prefix_check_twosfx(const char * word
, int len
,
122 char in_compound
, const FLAG needflag
= FLAG_NULL
);
123 inline int isRevSubset(const char * s1
, const char * end_of_s2
, int len
);
124 struct hentry
* suffix_check(const char * word
, int len
, int sfxopts
,
125 PfxEntry
* ppfx
, char ** wlst
, int maxSug
, int * ns
,
126 const FLAG cclass
= FLAG_NULL
, const FLAG needflag
= FLAG_NULL
,
127 char in_compound
= IN_CPD_NOT
);
128 struct hentry
* suffix_check_twosfx(const char * word
, int len
,
129 int sfxopts
, PfxEntry
* ppfx
, const FLAG needflag
= FLAG_NULL
);
131 char * affix_check_morph(const char * word
, int len
,
132 const FLAG needflag
= FLAG_NULL
, char in_compound
= IN_CPD_NOT
);
133 char * prefix_check_morph(const char * word
, int len
,
134 char in_compound
, const FLAG needflag
= FLAG_NULL
);
135 char * suffix_check_morph (const char * word
, int len
, int sfxopts
,
136 PfxEntry
* ppfx
, const FLAG cclass
= FLAG_NULL
,
137 const FLAG needflag
= FLAG_NULL
, char in_compound
= IN_CPD_NOT
);
139 char * prefix_check_twosfx_morph(const char * word
, int len
,
140 char in_compound
, const FLAG needflag
= FLAG_NULL
);
141 char * suffix_check_twosfx_morph(const char * word
, int len
,
142 int sfxopts
, PfxEntry
* ppfx
, const FLAG needflag
= FLAG_NULL
);
144 char * morphgen(char * ts
, int wl
, const unsigned short * ap
,
145 unsigned short al
, char * morph
, char * targetmorph
, int level
);
147 int expand_rootword(struct guessword
* wlst
, int maxn
, const char * ts
,
148 int wl
, const unsigned short * ap
, unsigned short al
, char * bad
,
151 short get_syllable (const char * word
, int wlen
);
152 int cpdrep_check(const char * word
, int len
);
153 int cpdpat_check(const char * word
, int len
, hentry
* r1
, hentry
* r2
,
155 int defcpd_check(hentry
*** words
, short wnum
, hentry
* rv
,
156 hentry
** rwords
, char all
);
157 int cpdcase_check(const char * word
, int len
);
158 inline int candidate_check(const char * word
, int len
);
159 void setcminmax(int * cmin
, int * cmax
, const char * word
, int len
);
160 struct hentry
* compound_check(const char * word
, int len
, short wordnum
,
161 short numsyllable
, short maxwordnum
, short wnum
, hentry
** words
,
162 char hu_mov_rule
, char is_sug
, int * info
);
164 int compound_check_morph(const char * word
, int len
, short wordnum
,
165 short numsyllable
, short maxwordnum
, short wnum
, hentry
** words
,
166 char hu_mov_rule
, char ** result
, char * partresult
);
168 struct hentry
* lookup(const char * word
);
169 int get_numrep() const;
170 struct replentry
* get_reptable() const;
171 RepList
* get_iconvtable() const;
172 RepList
* get_oconvtable() const;
173 struct phonetable
* get_phonetable() const;
174 int get_nummap() const;
175 struct mapentry
* get_maptable() const;
176 int get_numbreak() const;
177 char ** get_breaktable() const;
178 char * get_encoding();
179 int get_langnum() const;
180 char * get_key_string();
181 char * get_try_string() const;
182 const char * get_wordchars() const;
183 unsigned short * get_wordchars_utf16(int * len
) const;
184 char * get_ignore() const;
185 unsigned short * get_ignore_utf16(int * len
) const;
186 int get_compound() const;
187 FLAG
get_compoundflag() const;
188 FLAG
get_compoundbegin() const;
189 FLAG
get_forbiddenword() const;
190 FLAG
get_nosuggest() const;
191 FLAG
get_nongramsuggest() const;
192 FLAG
get_needaffix() const;
193 FLAG
get_onlyincompound() const;
194 FLAG
get_compoundroot() const;
195 FLAG
get_lemma_present() const;
196 int get_checknum() const;
197 const char * get_prefix() const;
198 const char * get_suffix() const;
199 const char * get_derived() const;
200 const char * get_version() const;
201 int have_contclass() const;
202 int get_utf8() const;
203 int get_complexprefixes() const;
204 char * get_suffixed(char ) const;
205 int get_maxngramsugs() const;
206 int get_maxcpdsugs() const;
207 int get_maxdiff() const;
208 int get_onlymaxdiff() const;
209 int get_nosplitsugs() const;
210 int get_sugswithdots(void) const;
211 FLAG
get_keepcase(void) const;
212 FLAG
get_forceucase(void) const;
213 FLAG
get_warn(void) const;
214 int get_forbidwarn(void) const;
215 int get_checksharps(void) const;
216 char * encode_flag(unsigned short aflag
) const;
217 int get_fullstrip() const;
220 int parse_file(const char * affpath
, const char * key
);
221 int parse_flag(char * line
, unsigned short * out
, FileMgr
* af
);
222 int parse_num(char * line
, int * out
, FileMgr
* af
);
223 int parse_cpdsyllable(char * line
, FileMgr
* af
);
224 int parse_reptable(char * line
, FileMgr
* af
);
225 int parse_convtable(char * line
, FileMgr
* af
, RepList
** rl
, const char * keyword
);
226 int parse_phonetable(char * line
, FileMgr
* af
);
227 int parse_maptable(char * line
, FileMgr
* af
);
228 int parse_breaktable(char * line
, FileMgr
* af
);
229 int parse_checkcpdtable(char * line
, FileMgr
* af
);
230 int parse_defcpdtable(char * line
, FileMgr
* af
);
231 int parse_affix(char * line
, const char at
, FileMgr
* af
, char * dupflags
);
233 void reverse_condition(char *);
234 void debugflag(char * result
, unsigned short flag
);
236 int encodeit(affentry
&entry
, char * cs
);
237 int build_pfxtree(PfxEntry
* pfxptr
);
238 int build_sfxtree(SfxEntry
* sfxptr
);
239 int process_pfx_order();
240 int process_sfx_order();
241 PfxEntry
* process_pfx_in_order(PfxEntry
* ptr
, PfxEntry
* nptr
);
242 SfxEntry
* process_sfx_in_order(SfxEntry
* ptr
, SfxEntry
* nptr
);
243 int process_pfx_tree_to_list();
244 int process_sfx_tree_to_list();
245 int redundant_condition(char, char * strip
, int stripl
,
246 const char * cond
, int);