Age Owner Branch data TLA Line data Source code
1 : : /* Generated by Snowball 2.2.0 - https://snowballstem.org/ */
2 : :
3 : : #include "header.h"
4 : :
5 : : #ifdef __cplusplus
6 : : extern "C" {
7 : : #endif
8 : : extern int danish_ISO_8859_1_stem(struct SN_env * z);
9 : : #ifdef __cplusplus
10 : : }
11 : : #endif
12 : : static int r_undouble(struct SN_env * z);
13 : : static int r_other_suffix(struct SN_env * z);
14 : : static int r_consonant_pair(struct SN_env * z);
15 : : static int r_main_suffix(struct SN_env * z);
16 : : static int r_mark_regions(struct SN_env * z);
17 : : #ifdef __cplusplus
18 : : extern "C" {
19 : : #endif
20 : :
21 : :
22 : : extern struct SN_env * danish_ISO_8859_1_create_env(void);
23 : : extern void danish_ISO_8859_1_close_env(struct SN_env * z);
24 : :
25 : :
26 : : #ifdef __cplusplus
27 : : }
28 : : #endif
29 : : static const symbol s_0_0[3] = { 'h', 'e', 'd' };
30 : : static const symbol s_0_1[5] = { 'e', 't', 'h', 'e', 'd' };
31 : : static const symbol s_0_2[4] = { 'e', 'r', 'e', 'd' };
32 : : static const symbol s_0_3[1] = { 'e' };
33 : : static const symbol s_0_4[5] = { 'e', 'r', 'e', 'd', 'e' };
34 : : static const symbol s_0_5[4] = { 'e', 'n', 'd', 'e' };
35 : : static const symbol s_0_6[6] = { 'e', 'r', 'e', 'n', 'd', 'e' };
36 : : static const symbol s_0_7[3] = { 'e', 'n', 'e' };
37 : : static const symbol s_0_8[4] = { 'e', 'r', 'n', 'e' };
38 : : static const symbol s_0_9[3] = { 'e', 'r', 'e' };
39 : : static const symbol s_0_10[2] = { 'e', 'n' };
40 : : static const symbol s_0_11[5] = { 'h', 'e', 'd', 'e', 'n' };
41 : : static const symbol s_0_12[4] = { 'e', 'r', 'e', 'n' };
42 : : static const symbol s_0_13[2] = { 'e', 'r' };
43 : : static const symbol s_0_14[5] = { 'h', 'e', 'd', 'e', 'r' };
44 : : static const symbol s_0_15[4] = { 'e', 'r', 'e', 'r' };
45 : : static const symbol s_0_16[1] = { 's' };
46 : : static const symbol s_0_17[4] = { 'h', 'e', 'd', 's' };
47 : : static const symbol s_0_18[2] = { 'e', 's' };
48 : : static const symbol s_0_19[5] = { 'e', 'n', 'd', 'e', 's' };
49 : : static const symbol s_0_20[7] = { 'e', 'r', 'e', 'n', 'd', 'e', 's' };
50 : : static const symbol s_0_21[4] = { 'e', 'n', 'e', 's' };
51 : : static const symbol s_0_22[5] = { 'e', 'r', 'n', 'e', 's' };
52 : : static const symbol s_0_23[4] = { 'e', 'r', 'e', 's' };
53 : : static const symbol s_0_24[3] = { 'e', 'n', 's' };
54 : : static const symbol s_0_25[6] = { 'h', 'e', 'd', 'e', 'n', 's' };
55 : : static const symbol s_0_26[5] = { 'e', 'r', 'e', 'n', 's' };
56 : : static const symbol s_0_27[3] = { 'e', 'r', 's' };
57 : : static const symbol s_0_28[3] = { 'e', 't', 's' };
58 : : static const symbol s_0_29[5] = { 'e', 'r', 'e', 't', 's' };
59 : : static const symbol s_0_30[2] = { 'e', 't' };
60 : : static const symbol s_0_31[4] = { 'e', 'r', 'e', 't' };
61 : :
62 : : static const struct among a_0[32] =
63 : : {
64 : : { 3, s_0_0, -1, 1, 0},
65 : : { 5, s_0_1, 0, 1, 0},
66 : : { 4, s_0_2, -1, 1, 0},
67 : : { 1, s_0_3, -1, 1, 0},
68 : : { 5, s_0_4, 3, 1, 0},
69 : : { 4, s_0_5, 3, 1, 0},
70 : : { 6, s_0_6, 5, 1, 0},
71 : : { 3, s_0_7, 3, 1, 0},
72 : : { 4, s_0_8, 3, 1, 0},
73 : : { 3, s_0_9, 3, 1, 0},
74 : : { 2, s_0_10, -1, 1, 0},
75 : : { 5, s_0_11, 10, 1, 0},
76 : : { 4, s_0_12, 10, 1, 0},
77 : : { 2, s_0_13, -1, 1, 0},
78 : : { 5, s_0_14, 13, 1, 0},
79 : : { 4, s_0_15, 13, 1, 0},
80 : : { 1, s_0_16, -1, 2, 0},
81 : : { 4, s_0_17, 16, 1, 0},
82 : : { 2, s_0_18, 16, 1, 0},
83 : : { 5, s_0_19, 18, 1, 0},
84 : : { 7, s_0_20, 19, 1, 0},
85 : : { 4, s_0_21, 18, 1, 0},
86 : : { 5, s_0_22, 18, 1, 0},
87 : : { 4, s_0_23, 18, 1, 0},
88 : : { 3, s_0_24, 16, 1, 0},
89 : : { 6, s_0_25, 24, 1, 0},
90 : : { 5, s_0_26, 24, 1, 0},
91 : : { 3, s_0_27, 16, 1, 0},
92 : : { 3, s_0_28, 16, 1, 0},
93 : : { 5, s_0_29, 28, 1, 0},
94 : : { 2, s_0_30, -1, 1, 0},
95 : : { 4, s_0_31, 30, 1, 0}
96 : : };
97 : :
98 : : static const symbol s_1_0[2] = { 'g', 'd' };
99 : : static const symbol s_1_1[2] = { 'd', 't' };
100 : : static const symbol s_1_2[2] = { 'g', 't' };
101 : : static const symbol s_1_3[2] = { 'k', 't' };
102 : :
103 : : static const struct among a_1[4] =
104 : : {
105 : : { 2, s_1_0, -1, -1, 0},
106 : : { 2, s_1_1, -1, -1, 0},
107 : : { 2, s_1_2, -1, -1, 0},
108 : : { 2, s_1_3, -1, -1, 0}
109 : : };
110 : :
111 : : static const symbol s_2_0[2] = { 'i', 'g' };
112 : : static const symbol s_2_1[3] = { 'l', 'i', 'g' };
113 : : static const symbol s_2_2[4] = { 'e', 'l', 'i', 'g' };
114 : : static const symbol s_2_3[3] = { 'e', 'l', 's' };
115 : : static const symbol s_2_4[4] = { 'l', 0xF8, 's', 't' };
116 : :
117 : : static const struct among a_2[5] =
118 : : {
119 : : { 2, s_2_0, -1, 1, 0},
120 : : { 3, s_2_1, 0, 1, 0},
121 : : { 4, s_2_2, 1, 1, 0},
122 : : { 3, s_2_3, -1, 1, 0},
123 : : { 4, s_2_4, -1, 2, 0}
124 : : };
125 : :
126 : : static const unsigned char g_c[] = { 119, 223, 119, 1 };
127 : :
128 : : static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 };
129 : :
130 : : static const unsigned char g_s_ending[] = { 239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 };
131 : :
132 : : static const symbol s_0[] = { 's', 't' };
133 : : static const symbol s_1[] = { 'i', 'g' };
134 : : static const symbol s_2[] = { 'l', 0xF8, 's' };
135 : :
1660 peter@eisentraut.org 136 :UBC 0 : static int r_mark_regions(struct SN_env * z) {
137 : 0 : z->I[1] = z->l;
138 : 0 : { int c_test1 = z->c;
139 : 0 : z->c = z->c + 3;
140 [ # # ]: 0 : if (z->c > z->l) return 0;
141 : 0 : z->I[0] = z->c;
2539 tgl@sss.pgh.pa.us 142 : 0 : z->c = c_test1;
143 : : }
144 : :
1660 peter@eisentraut.org 145 [ # # ]: 0 : if (out_grouping(z, g_v, 97, 248, 1) < 0) return 0;
146 : :
147 : : {
6591 tgl@sss.pgh.pa.us 148 : 0 : int ret = in_grouping(z, g_v, 97, 248, 1);
149 [ # # ]: 0 : if (ret < 0) return 0;
150 : 0 : z->c += ret;
151 : : }
1660 peter@eisentraut.org 152 : 0 : z->I[1] = z->c;
153 : :
200 tgl@sss.pgh.pa.us 154 [ # # ]: 0 : if (z->I[1] >= z->I[0]) goto lab0;
1660 peter@eisentraut.org 155 : 0 : z->I[1] = z->I[0];
6591 tgl@sss.pgh.pa.us 156 : 0 : lab0:
157 : 0 : return 1;
158 : : }
159 : :
1660 peter@eisentraut.org 160 : 0 : static int r_main_suffix(struct SN_env * z) {
161 : : int among_var;
162 : :
163 : : { int mlimit1;
164 [ # # ]: 0 : if (z->c < z->I[1]) return 0;
165 : 0 : mlimit1 = z->lb; z->lb = z->I[1];
166 : 0 : z->ket = z->c;
167 [ # # # # : 0 : if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851440 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit1; return 0; }
# # ]
2539 tgl@sss.pgh.pa.us 168 : 0 : among_var = find_among_b(z, a_0, 32);
200 169 [ # # ]: 0 : if (!among_var) { z->lb = mlimit1; return 0; }
1660 peter@eisentraut.org 170 : 0 : z->bra = z->c;
2539 tgl@sss.pgh.pa.us 171 : 0 : z->lb = mlimit1;
172 : : }
1660 peter@eisentraut.org 173 [ # # # ]: 0 : switch (among_var) {
6591 tgl@sss.pgh.pa.us 174 : 0 : case 1:
1660 peter@eisentraut.org 175 : 0 : { int ret = slice_del(z);
6591 tgl@sss.pgh.pa.us 176 [ # # ]: 0 : if (ret < 0) return ret;
177 : : }
178 : 0 : break;
179 : 0 : case 2:
1660 peter@eisentraut.org 180 [ # # ]: 0 : if (in_grouping_b(z, g_s_ending, 97, 229, 0)) return 0;
181 : 0 : { int ret = slice_del(z);
6591 tgl@sss.pgh.pa.us 182 [ # # ]: 0 : if (ret < 0) return ret;
183 : : }
184 : 0 : break;
185 : : }
186 : 0 : return 1;
187 : : }
188 : :
1660 peter@eisentraut.org 189 : 0 : static int r_consonant_pair(struct SN_env * z) {
190 : 0 : { int m_test1 = z->l - z->c;
191 : :
192 : : { int mlimit2;
193 [ # # ]: 0 : if (z->c < z->I[1]) return 0;
194 : 0 : mlimit2 = z->lb; z->lb = z->I[1];
195 : 0 : z->ket = z->c;
196 [ # # # # : 0 : if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 116)) { z->lb = mlimit2; return 0; }
# # ]
200 tgl@sss.pgh.pa.us 197 [ # # ]: 0 : if (!find_among_b(z, a_1, 4)) { z->lb = mlimit2; return 0; }
1660 peter@eisentraut.org 198 : 0 : z->bra = z->c;
2539 tgl@sss.pgh.pa.us 199 : 0 : z->lb = mlimit2;
200 : : }
201 : 0 : z->c = z->l - m_test1;
202 : : }
6591 203 [ # # ]: 0 : if (z->c <= z->lb) return 0;
1660 peter@eisentraut.org 204 : 0 : z->c--;
205 : 0 : z->bra = z->c;
206 : 0 : { int ret = slice_del(z);
6591 tgl@sss.pgh.pa.us 207 [ # # ]: 0 : if (ret < 0) return ret;
208 : : }
209 : 0 : return 1;
210 : : }
211 : :
1660 peter@eisentraut.org 212 : 0 : static int r_other_suffix(struct SN_env * z) {
213 : : int among_var;
214 : 0 : { int m1 = z->l - z->c; (void)m1;
215 : 0 : z->ket = z->c;
216 [ # # ]: 0 : if (!(eq_s_b(z, 2, s_0))) goto lab0;
217 : 0 : z->bra = z->c;
218 [ # # ]: 0 : if (!(eq_s_b(z, 2, s_1))) goto lab0;
219 : 0 : { int ret = slice_del(z);
6591 tgl@sss.pgh.pa.us 220 [ # # ]: 0 : if (ret < 0) return ret;
221 : : }
222 : 0 : lab0:
223 : 0 : z->c = z->l - m1;
224 : : }
225 : :
226 : : { int mlimit2;
1660 peter@eisentraut.org 227 [ # # ]: 0 : if (z->c < z->I[1]) return 0;
228 : 0 : mlimit2 = z->lb; z->lb = z->I[1];
229 : 0 : z->ket = z->c;
230 [ # # # # : 0 : if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit2; return 0; }
# # ]
2539 tgl@sss.pgh.pa.us 231 : 0 : among_var = find_among_b(z, a_2, 5);
200 232 [ # # ]: 0 : if (!among_var) { z->lb = mlimit2; return 0; }
1660 peter@eisentraut.org 233 : 0 : z->bra = z->c;
2539 tgl@sss.pgh.pa.us 234 : 0 : z->lb = mlimit2;
235 : : }
1660 peter@eisentraut.org 236 [ # # # ]: 0 : switch (among_var) {
6591 tgl@sss.pgh.pa.us 237 : 0 : case 1:
1660 peter@eisentraut.org 238 : 0 : { int ret = slice_del(z);
6591 tgl@sss.pgh.pa.us 239 [ # # ]: 0 : if (ret < 0) return ret;
240 : : }
1660 peter@eisentraut.org 241 : 0 : { int m3 = z->l - z->c; (void)m3;
242 : 0 : { int ret = r_consonant_pair(z);
6591 tgl@sss.pgh.pa.us 243 [ # # ]: 0 : if (ret < 0) return ret;
244 : : }
245 : 0 : z->c = z->l - m3;
246 : : }
247 : 0 : break;
248 : 0 : case 2:
1660 peter@eisentraut.org 249 : 0 : { int ret = slice_from_s(z, 3, s_2);
6591 tgl@sss.pgh.pa.us 250 [ # # ]: 0 : if (ret < 0) return ret;
251 : : }
252 : 0 : break;
253 : : }
254 : 0 : return 1;
255 : : }
256 : :
1660 peter@eisentraut.org 257 : 0 : static int r_undouble(struct SN_env * z) {
258 : :
259 : : { int mlimit1;
260 [ # # ]: 0 : if (z->c < z->I[1]) return 0;
261 : 0 : mlimit1 = z->lb; z->lb = z->I[1];
262 : 0 : z->ket = z->c;
263 [ # # ]: 0 : if (in_grouping_b(z, g_c, 98, 122, 0)) { z->lb = mlimit1; return 0; }
264 : 0 : z->bra = z->c;
265 : 0 : z->S[0] = slice_to(z, z->S[0]);
266 [ # # ]: 0 : if (z->S[0] == 0) return -1;
2539 tgl@sss.pgh.pa.us 267 : 0 : z->lb = mlimit1;
268 : : }
1660 peter@eisentraut.org 269 [ # # ]: 0 : if (!(eq_v_b(z, z->S[0]))) return 0;
270 : 0 : { int ret = slice_del(z);
6591 tgl@sss.pgh.pa.us 271 [ # # ]: 0 : if (ret < 0) return ret;
272 : : }
273 : 0 : return 1;
274 : : }
275 : :
1660 peter@eisentraut.org 276 : 0 : extern int danish_ISO_8859_1_stem(struct SN_env * z) {
277 : 0 : { int c1 = z->c;
278 : 0 : { int ret = r_mark_regions(z);
6591 tgl@sss.pgh.pa.us 279 [ # # ]: 0 : if (ret < 0) return ret;
280 : : }
281 : 0 : z->c = c1;
282 : : }
1660 peter@eisentraut.org 283 : 0 : z->lb = z->c; z->c = z->l;
284 : :
285 : 0 : { int m2 = z->l - z->c; (void)m2;
286 : 0 : { int ret = r_main_suffix(z);
6591 tgl@sss.pgh.pa.us 287 [ # # ]: 0 : if (ret < 0) return ret;
288 : : }
289 : 0 : z->c = z->l - m2;
290 : : }
1660 peter@eisentraut.org 291 : 0 : { int m3 = z->l - z->c; (void)m3;
292 : 0 : { int ret = r_consonant_pair(z);
6591 tgl@sss.pgh.pa.us 293 [ # # ]: 0 : if (ret < 0) return ret;
294 : : }
295 : 0 : z->c = z->l - m3;
296 : : }
1660 peter@eisentraut.org 297 : 0 : { int m4 = z->l - z->c; (void)m4;
298 : 0 : { int ret = r_other_suffix(z);
6591 tgl@sss.pgh.pa.us 299 [ # # ]: 0 : if (ret < 0) return ret;
300 : : }
301 : 0 : z->c = z->l - m4;
302 : : }
1660 peter@eisentraut.org 303 : 0 : { int m5 = z->l - z->c; (void)m5;
304 : 0 : { int ret = r_undouble(z);
6591 tgl@sss.pgh.pa.us 305 [ # # ]: 0 : if (ret < 0) return ret;
306 : : }
307 : 0 : z->c = z->l - m5;
308 : : }
309 : 0 : z->c = z->lb;
310 : 0 : return 1;
311 : : }
312 : :
1660 peter@eisentraut.org 313 : 0 : extern struct SN_env * danish_ISO_8859_1_create_env(void) { return SN_create_env(1, 2); }
314 : :
6591 tgl@sss.pgh.pa.us 315 : 0 : extern void danish_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 1); }
316 : :
|