YAZ 5.35.1
stem_UTF_8_swedish.c
Go to the documentation of this file.
1
2/* This file was generated automatically by the Snowball to ANSI C compiler */
3
4#include "../runtime/header.h"
5
6#ifdef __cplusplus
7extern "C"
8{
9#endif
10 extern int swedish_UTF_8_stem (struct SN_env *z);
11#ifdef __cplusplus
12}
13#endif
14static int r_other_suffix (struct SN_env *z);
15static int r_consonant_pair (struct SN_env *z);
16static int r_main_suffix (struct SN_env *z);
17static int r_mark_regions (struct SN_env *z);
18#ifdef __cplusplus
19extern "C"
20{
21#endif
22
23
24 extern struct SN_env *swedish_UTF_8_create_env (void);
25 extern void swedish_UTF_8_close_env (struct SN_env *z);
26
27
28#ifdef __cplusplus
29}
30#endif
31static const symbol s_0_0[1] = { 'a' };
32static const symbol s_0_1[4] = { 'a', 'r', 'n', 'a' };
33static const symbol s_0_2[4] = { 'e', 'r', 'n', 'a' };
34static const symbol s_0_3[7] = { 'h', 'e', 't', 'e', 'r', 'n', 'a' };
35static const symbol s_0_4[4] = { 'o', 'r', 'n', 'a' };
36static const symbol s_0_5[2] = { 'a', 'd' };
37static const symbol s_0_6[1] = { 'e' };
38static const symbol s_0_7[3] = { 'a', 'd', 'e' };
39static const symbol s_0_8[4] = { 'a', 'n', 'd', 'e' };
40static const symbol s_0_9[4] = { 'a', 'r', 'n', 'e' };
41static const symbol s_0_10[3] = { 'a', 'r', 'e' };
42static const symbol s_0_11[4] = { 'a', 's', 't', 'e' };
43static const symbol s_0_12[2] = { 'e', 'n' };
44static const symbol s_0_13[5] = { 'a', 'n', 'd', 'e', 'n' };
45static const symbol s_0_14[4] = { 'a', 'r', 'e', 'n' };
46static const symbol s_0_15[5] = { 'h', 'e', 't', 'e', 'n' };
47static const symbol s_0_16[3] = { 'e', 'r', 'n' };
48static const symbol s_0_17[2] = { 'a', 'r' };
49static const symbol s_0_18[2] = { 'e', 'r' };
50static const symbol s_0_19[5] = { 'h', 'e', 't', 'e', 'r' };
51static const symbol s_0_20[2] = { 'o', 'r' };
52static const symbol s_0_21[1] = { 's' };
53static const symbol s_0_22[2] = { 'a', 's' };
54static const symbol s_0_23[5] = { 'a', 'r', 'n', 'a', 's' };
55static const symbol s_0_24[5] = { 'e', 'r', 'n', 'a', 's' };
56static const symbol s_0_25[5] = { 'o', 'r', 'n', 'a', 's' };
57static const symbol s_0_26[2] = { 'e', 's' };
58static const symbol s_0_27[4] = { 'a', 'd', 'e', 's' };
59static const symbol s_0_28[5] = { 'a', 'n', 'd', 'e', 's' };
60static const symbol s_0_29[3] = { 'e', 'n', 's' };
61static const symbol s_0_30[5] = { 'a', 'r', 'e', 'n', 's' };
62static const symbol s_0_31[6] = { 'h', 'e', 't', 'e', 'n', 's' };
63static const symbol s_0_32[4] = { 'e', 'r', 'n', 's' };
64static const symbol s_0_33[2] = { 'a', 't' };
65static const symbol s_0_34[5] = { 'a', 'n', 'd', 'e', 't' };
66static const symbol s_0_35[3] = { 'h', 'e', 't' };
67static const symbol s_0_36[3] = { 'a', 's', 't' };
68
69static const struct among a_0[37] = {
70/* 0 */ {1, s_0_0, -1, 1, 0},
71/* 1 */ {4, s_0_1, 0, 1, 0},
72/* 2 */ {4, s_0_2, 0, 1, 0},
73/* 3 */ {7, s_0_3, 2, 1, 0},
74/* 4 */ {4, s_0_4, 0, 1, 0},
75/* 5 */ {2, s_0_5, -1, 1, 0},
76/* 6 */ {1, s_0_6, -1, 1, 0},
77/* 7 */ {3, s_0_7, 6, 1, 0},
78/* 8 */ {4, s_0_8, 6, 1, 0},
79/* 9 */ {4, s_0_9, 6, 1, 0},
80/* 10 */ {3, s_0_10, 6, 1, 0},
81/* 11 */ {4, s_0_11, 6, 1, 0},
82/* 12 */ {2, s_0_12, -1, 1, 0},
83/* 13 */ {5, s_0_13, 12, 1, 0},
84/* 14 */ {4, s_0_14, 12, 1, 0},
85/* 15 */ {5, s_0_15, 12, 1, 0},
86/* 16 */ {3, s_0_16, -1, 1, 0},
87/* 17 */ {2, s_0_17, -1, 1, 0},
88/* 18 */ {2, s_0_18, -1, 1, 0},
89/* 19 */ {5, s_0_19, 18, 1, 0},
90/* 20 */ {2, s_0_20, -1, 1, 0},
91/* 21 */ {1, s_0_21, -1, 2, 0},
92/* 22 */ {2, s_0_22, 21, 1, 0},
93/* 23 */ {5, s_0_23, 22, 1, 0},
94/* 24 */ {5, s_0_24, 22, 1, 0},
95/* 25 */ {5, s_0_25, 22, 1, 0},
96/* 26 */ {2, s_0_26, 21, 1, 0},
97/* 27 */ {4, s_0_27, 26, 1, 0},
98/* 28 */ {5, s_0_28, 26, 1, 0},
99/* 29 */ {3, s_0_29, 21, 1, 0},
100/* 30 */ {5, s_0_30, 29, 1, 0},
101/* 31 */ {6, s_0_31, 29, 1, 0},
102/* 32 */ {4, s_0_32, 21, 1, 0},
103/* 33 */ {2, s_0_33, -1, 1, 0},
104/* 34 */ {5, s_0_34, -1, 1, 0},
105/* 35 */ {3, s_0_35, -1, 1, 0},
106/* 36 */ {3, s_0_36, -1, 1, 0}
107};
108
109static const symbol s_1_0[2] = { 'd', 'd' };
110static const symbol s_1_1[2] = { 'g', 'd' };
111static const symbol s_1_2[2] = { 'n', 'n' };
112static const symbol s_1_3[2] = { 'd', 't' };
113static const symbol s_1_4[2] = { 'g', 't' };
114static const symbol s_1_5[2] = { 'k', 't' };
115static const symbol s_1_6[2] = { 't', 't' };
116
117static const struct among a_1[7] = {
118/* 0 */ {2, s_1_0, -1, -1, 0},
119/* 1 */ {2, s_1_1, -1, -1, 0},
120/* 2 */ {2, s_1_2, -1, -1, 0},
121/* 3 */ {2, s_1_3, -1, -1, 0},
122/* 4 */ {2, s_1_4, -1, -1, 0},
123/* 5 */ {2, s_1_5, -1, -1, 0},
124/* 6 */ {2, s_1_6, -1, -1, 0}
125};
126
127static const symbol s_2_0[2] = { 'i', 'g' };
128static const symbol s_2_1[3] = { 'l', 'i', 'g' };
129static const symbol s_2_2[3] = { 'e', 'l', 's' };
130static const symbol s_2_3[5] = { 'f', 'u', 'l', 'l', 't' };
131static const symbol s_2_4[5] = { 'l', 0xC3, 0xB6, 's', 't' };
132
133static const struct among a_2[5] = {
134/* 0 */ {2, s_2_0, -1, 1, 0},
135/* 1 */ {3, s_2_1, 0, 1, 0},
136/* 2 */ {3, s_2_2, -1, 1, 0},
137/* 3 */ {5, s_2_3, -1, 3, 0},
138/* 4 */ {5, s_2_4, -1, 2, 0}
139};
140
141static const unsigned char g_v[] =
142 { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 32 };
143
144static const unsigned char g_s_ending[] = { 119, 127, 149 };
145
146static const symbol s_0[] = { 'l', 0xC3, 0xB6, 's' };
147static const symbol s_1[] = { 'f', 'u', 'l', 'l' };
148
149static int
151{
152 z->I[0] = z->l;
153 {
154 int c_test = z->c; /* test, line 29 */
155 {
156 int ret = skip_utf8 (z->p, z->c, 0, z->l, +3);
157 if (ret < 0)
158 return 0;
159 z->c = ret; /* hop, line 29 */
160 }
161 z->I[1] = z->c; /* setmark x, line 29 */
162 z->c = c_test;
163 }
164 if (out_grouping_U (z, g_v, 97, 246, 1) < 0)
165 return 0; /* goto *//* grouping v, line 30 */
166 { /* gopast *//* non v, line 30 */
167 int ret = in_grouping_U (z, g_v, 97, 246, 1);
168 if (ret < 0)
169 return 0;
170 z->c += ret;
171 }
172 z->I[0] = z->c; /* setmark p1, line 30 */
173 /* try, line 31 */
174 if (!(z->I[0] < z->I[1]))
175 goto lab0;
176 z->I[0] = z->I[1];
177lab0:
178 return 1;
179}
180
181static int
183{
184 int among_var;
185 {
186 int mlimit; /* setlimit, line 37 */
187 int m1 = z->l - z->c;
188 (void) m1;
189 if (z->c < z->I[0])
190 return 0;
191 z->c = z->I[0]; /* tomark, line 37 */
192 mlimit = z->lb;
193 z->lb = z->c;
194 z->c = z->l - m1;
195 z->ket = z->c; /* [, line 37 */
196 if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3
197 || !((1851442 >> (z->p[z->c - 1] & 0x1f)) & 1))
198 {
199 z->lb = mlimit;
200 return 0;
201 }
202 among_var = find_among_b (z, a_0, 37); /* substring, line 37 */
203 if (!(among_var))
204 {
205 z->lb = mlimit;
206 return 0;
207 }
208 z->bra = z->c; /* ], line 37 */
209 z->lb = mlimit;
210 }
211 switch (among_var)
212 {
213 case 0:
214 return 0;
215 case 1:
216 {
217 int ret = slice_del (z); /* delete, line 44 */
218 if (ret < 0)
219 return ret;
220 }
221 break;
222 case 2:
223 if (in_grouping_b_U (z, g_s_ending, 98, 121, 0))
224 return 0;
225 {
226 int ret = slice_del (z); /* delete, line 46 */
227 if (ret < 0)
228 return ret;
229 }
230 break;
231 }
232 return 1;
233}
234
235static int
237{
238 {
239 int mlimit; /* setlimit, line 50 */
240 int m1 = z->l - z->c;
241 (void) m1;
242 if (z->c < z->I[0])
243 return 0;
244 z->c = z->I[0]; /* tomark, line 50 */
245 mlimit = z->lb;
246 z->lb = z->c;
247 z->c = z->l - m1;
248 {
249 int m2 = z->l - z->c;
250 (void) m2; /* and, line 52 */
251 if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3
252 || !((1064976 >> (z->p[z->c - 1] & 0x1f)) & 1))
253 {
254 z->lb = mlimit;
255 return 0;
256 }
257 if (!(find_among_b (z, a_1, 7)))
258 {
259 z->lb = mlimit;
260 return 0;
261 } /* among, line 51 */
262 z->c = z->l - m2;
263 z->ket = z->c; /* [, line 52 */
264 {
265 int ret = skip_utf8 (z->p, z->c, z->lb, 0, -1);
266 if (ret < 0)
267 {
268 z->lb = mlimit;
269 return 0;
270 }
271 z->c = ret; /* next, line 52 */
272 }
273 z->bra = z->c; /* ], line 52 */
274 {
275 int ret = slice_del (z); /* delete, line 52 */
276 if (ret < 0)
277 return ret;
278 }
279 }
280 z->lb = mlimit;
281 }
282 return 1;
283}
284
285static int
287{
288 int among_var;
289 {
290 int mlimit; /* setlimit, line 55 */
291 int m1 = z->l - z->c;
292 (void) m1;
293 if (z->c < z->I[0])
294 return 0;
295 z->c = z->I[0]; /* tomark, line 55 */
296 mlimit = z->lb;
297 z->lb = z->c;
298 z->c = z->l - m1;
299 z->ket = z->c; /* [, line 56 */
300 if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3
301 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1))
302 {
303 z->lb = mlimit;
304 return 0;
305 }
306 among_var = find_among_b (z, a_2, 5); /* substring, line 56 */
307 if (!(among_var))
308 {
309 z->lb = mlimit;
310 return 0;
311 }
312 z->bra = z->c; /* ], line 56 */
313 switch (among_var)
314 {
315 case 0:
316 {
317 z->lb = mlimit;
318 return 0;
319 }
320 case 1:
321 {
322 int ret = slice_del (z); /* delete, line 57 */
323 if (ret < 0)
324 return ret;
325 }
326 break;
327 case 2:
328 {
329 int ret = slice_from_s (z, 4, s_0); /* <-, line 58 */
330 if (ret < 0)
331 return ret;
332 }
333 break;
334 case 3:
335 {
336 int ret = slice_from_s (z, 4, s_1); /* <-, line 59 */
337 if (ret < 0)
338 return ret;
339 }
340 break;
341 }
342 z->lb = mlimit;
343 }
344 return 1;
345}
346
347extern int
349{
350 {
351 int c1 = z->c; /* do, line 66 */
352 {
353 int ret = r_mark_regions (z);
354 if (ret == 0)
355 goto lab0; /* call mark_regions, line 66 */
356 if (ret < 0)
357 return ret;
358 }
359 lab0:
360 z->c = c1;
361 }
362 z->lb = z->c;
363 z->c = z->l; /* backwards, line 67 */
364
365 {
366 int m2 = z->l - z->c;
367 (void) m2; /* do, line 68 */
368 {
369 int ret = r_main_suffix (z);
370 if (ret == 0)
371 goto lab1; /* call main_suffix, line 68 */
372 if (ret < 0)
373 return ret;
374 }
375 lab1:
376 z->c = z->l - m2;
377 }
378 {
379 int m3 = z->l - z->c;
380 (void) m3; /* do, line 69 */
381 {
382 int ret = r_consonant_pair (z);
383 if (ret == 0)
384 goto lab2; /* call consonant_pair, line 69 */
385 if (ret < 0)
386 return ret;
387 }
388 lab2:
389 z->c = z->l - m3;
390 }
391 {
392 int m4 = z->l - z->c;
393 (void) m4; /* do, line 70 */
394 {
395 int ret = r_other_suffix (z);
396 if (ret == 0)
397 goto lab3; /* call other_suffix, line 70 */
398 if (ret < 0)
399 return ret;
400 }
401 lab3:
402 z->c = z->l - m4;
403 }
404 z->c = z->lb;
405 return 1;
406}
407
408extern struct SN_env *
410{
411 return SN_create_env (0, 2, 0);
412}
413
414extern void
416{
417 SN_close_env (z, 0);
418}
struct SN_env * SN_create_env(int S_size, int I_size, int B_size)
Definition api.c:6
void SN_close_env(struct SN_env *z, int S_size)
Definition api.c:50
unsigned char symbol
Definition api.h:2
int find_among_b(struct SN_env *z, const struct among *v, int v_size)
Definition utilities.c:400
int out_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition utilities.c:170
int slice_del(struct SN_env *z)
Definition utilities.c:573
int in_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition utilities.c:134
int skip_utf8(const symbol *p, int c, int lb, int l, int n)
Definition utilities.c:42
int in_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition utilities.c:152
int slice_from_s(struct SN_env *z, int s_size, const symbol *s)
Definition utilities.c:559
static const symbol s_0_27[4]
static const struct among a_2[5]
static const symbol s_0_2[4]
static const symbol s_1_5[2]
static const symbol s_0_5[2]
static const symbol s_1_6[2]
static const symbol s_0_33[2]
static const symbol s_1_2[2]
static const symbol s_0_10[3]
static int r_other_suffix(struct SN_env *z)
static const symbol s_0_0[1]
static int r_consonant_pair(struct SN_env *z)
int swedish_UTF_8_stem(struct SN_env *z)
static const struct among a_1[7]
static const symbol s_0_35[3]
static const symbol s_0_21[1]
static const symbol s_2_0[2]
static int r_main_suffix(struct SN_env *z)
static const symbol s_1_3[2]
static const symbol s_2_1[3]
static const symbol s_1_0[2]
static const symbol s_0_6[1]
static const symbol s_0_25[5]
static const symbol s_0_15[5]
static const symbol s_0_17[2]
static const struct among a_0[37]
static const symbol s_0_23[5]
static const symbol s_0_34[5]
static const symbol s_0_30[5]
static const symbol s_2_4[5]
static const symbol s_1_1[2]
static const symbol s_0_16[3]
static const symbol s_0_19[5]
static const symbol s_0_18[2]
static const symbol s_0_26[2]
static const symbol s_0_24[5]
static const symbol s_2_3[5]
static const symbol s_0_9[4]
static const symbol s_0_20[2]
struct SN_env * swedish_UTF_8_create_env(void)
static const symbol s_0_4[4]
void swedish_UTF_8_close_env(struct SN_env *z)
static const symbol s_0_11[4]
static const symbol s_0_14[4]
static const symbol s_1[]
static const symbol s_1_4[2]
static const symbol s_2_2[3]
static int r_mark_regions(struct SN_env *z)
static const symbol s_0_8[4]
static const symbol s_0_28[5]
static const symbol s_0_31[6]
static const symbol s_0_12[2]
static const symbol s_0_13[5]
static const symbol s_0_7[3]
static const symbol s_0_36[3]
static const symbol s_0_22[2]
static const unsigned char g_v[]
static const unsigned char g_s_ending[]
static const symbol s_0_29[3]
static const symbol s_0_32[4]
static const symbol s_0_1[4]
static const symbol s_0[]
static const symbol s_0_3[7]
Definition api.h:14
int lb
Definition api.h:16
symbol * p
Definition api.h:15
int * I
Definition api.h:18
int ket
Definition api.h:16
int c
Definition api.h:16
int bra
Definition api.h:16
int l
Definition api.h:16
Definition header.h:16