PostgreSQL Source Code git master
stem_UTF_8_finnish.c
Go to the documentation of this file.
1/* Generated from finnish.sbl by Snowball 3.0.0 - https://snowballstem.org/ */
2
4
5#include <stddef.h>
6
7#include "snowball_runtime.h"
8
9struct SN_local {
10 struct SN_env z;
11 int i_p2;
12 int i_p1;
13 unsigned char b_ending_removed;
14 symbol * s_x;
15};
16
17typedef struct SN_local SN_local;
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22extern int finnish_UTF_8_stem(struct SN_env * z);
23#ifdef __cplusplus
24}
25#endif
26
27static int r_tidy(struct SN_env * z);
28static int r_other_endings(struct SN_env * z);
29static int r_t_plural(struct SN_env * z);
30static int r_i_plural(struct SN_env * z);
31static int r_case_ending(struct SN_env * z);
32static int r_VI(struct SN_env * z);
33static int r_LONG(struct SN_env * z);
34static int r_possessive(struct SN_env * z);
35static int r_particle_etc(struct SN_env * z);
36static int r_R2(struct SN_env * z);
37static int r_mark_regions(struct SN_env * z);
38
39static const symbol s_0[] = { 'k', 's', 'e' };
40static const symbol s_1[] = { 'k', 's', 'i' };
41static const symbol s_2[] = { 0xC3, 0xA4 };
42static const symbol s_3[] = { 0xC3, 0xB6 };
43static const symbol s_4[] = { 'i', 'e' };
44static const symbol s_5[] = { 'p', 'o' };
45static const symbol s_6[] = { 'p', 'o' };
46
47static const symbol s_0_0[2] = { 'p', 'a' };
48static const symbol s_0_1[3] = { 's', 't', 'i' };
49static const symbol s_0_2[4] = { 'k', 'a', 'a', 'n' };
50static const symbol s_0_3[3] = { 'h', 'a', 'n' };
51static const symbol s_0_4[3] = { 'k', 'i', 'n' };
52static const symbol s_0_5[4] = { 'h', 0xC3, 0xA4, 'n' };
53static const symbol s_0_6[6] = { 'k', 0xC3, 0xA4, 0xC3, 0xA4, 'n' };
54static const symbol s_0_7[2] = { 'k', 'o' };
55static const symbol s_0_8[3] = { 'p', 0xC3, 0xA4 };
56static const symbol s_0_9[3] = { 'k', 0xC3, 0xB6 };
57static const struct among a_0[10] = {
58{ 2, s_0_0, 0, 1, 0},
59{ 3, s_0_1, 0, 2, 0},
60{ 4, s_0_2, 0, 1, 0},
61{ 3, s_0_3, 0, 1, 0},
62{ 3, s_0_4, 0, 1, 0},
63{ 4, s_0_5, 0, 1, 0},
64{ 6, s_0_6, 0, 1, 0},
65{ 2, s_0_7, 0, 1, 0},
66{ 3, s_0_8, 0, 1, 0},
67{ 3, s_0_9, 0, 1, 0}
68};
69
70static const symbol s_1_0[3] = { 'l', 'l', 'a' };
71static const symbol s_1_1[2] = { 'n', 'a' };
72static const symbol s_1_2[3] = { 's', 's', 'a' };
73static const symbol s_1_3[2] = { 't', 'a' };
74static const symbol s_1_4[3] = { 'l', 't', 'a' };
75static const symbol s_1_5[3] = { 's', 't', 'a' };
76static const struct among a_1[6] = {
77{ 3, s_1_0, 0, -1, 0},
78{ 2, s_1_1, 0, -1, 0},
79{ 3, s_1_2, 0, -1, 0},
80{ 2, s_1_3, 0, -1, 0},
81{ 3, s_1_4, -1, -1, 0},
82{ 3, s_1_5, -2, -1, 0}
83};
84
85static const symbol s_2_0[4] = { 'l', 'l', 0xC3, 0xA4 };
86static const symbol s_2_1[3] = { 'n', 0xC3, 0xA4 };
87static const symbol s_2_2[4] = { 's', 's', 0xC3, 0xA4 };
88static const symbol s_2_3[3] = { 't', 0xC3, 0xA4 };
89static const symbol s_2_4[4] = { 'l', 't', 0xC3, 0xA4 };
90static const symbol s_2_5[4] = { 's', 't', 0xC3, 0xA4 };
91static const struct among a_2[6] = {
92{ 4, s_2_0, 0, -1, 0},
93{ 3, s_2_1, 0, -1, 0},
94{ 4, s_2_2, 0, -1, 0},
95{ 3, s_2_3, 0, -1, 0},
96{ 4, s_2_4, -1, -1, 0},
97{ 4, s_2_5, -2, -1, 0}
98};
99
100static const symbol s_3_0[3] = { 'l', 'l', 'e' };
101static const symbol s_3_1[3] = { 'i', 'n', 'e' };
102static const struct among a_3[2] = {
103{ 3, s_3_0, 0, -1, 0},
104{ 3, s_3_1, 0, -1, 0}
105};
106
107static const symbol s_4_0[3] = { 'n', 's', 'a' };
108static const symbol s_4_1[3] = { 'm', 'm', 'e' };
109static const symbol s_4_2[3] = { 'n', 'n', 'e' };
110static const symbol s_4_3[2] = { 'n', 'i' };
111static const symbol s_4_4[2] = { 's', 'i' };
112static const symbol s_4_5[2] = { 'a', 'n' };
113static const symbol s_4_6[2] = { 'e', 'n' };
114static const symbol s_4_7[3] = { 0xC3, 0xA4, 'n' };
115static const symbol s_4_8[4] = { 'n', 's', 0xC3, 0xA4 };
116static const struct among a_4[9] = {
117{ 3, s_4_0, 0, 3, 0},
118{ 3, s_4_1, 0, 3, 0},
119{ 3, s_4_2, 0, 3, 0},
120{ 2, s_4_3, 0, 2, 0},
121{ 2, s_4_4, 0, 1, 0},
122{ 2, s_4_5, 0, 4, 0},
123{ 2, s_4_6, 0, 6, 0},
124{ 3, s_4_7, 0, 5, 0},
125{ 4, s_4_8, 0, 3, 0}
126};
127
128static const symbol s_5_0[2] = { 'a', 'a' };
129static const symbol s_5_1[2] = { 'e', 'e' };
130static const symbol s_5_2[2] = { 'i', 'i' };
131static const symbol s_5_3[2] = { 'o', 'o' };
132static const symbol s_5_4[2] = { 'u', 'u' };
133static const symbol s_5_5[4] = { 0xC3, 0xA4, 0xC3, 0xA4 };
134static const symbol s_5_6[4] = { 0xC3, 0xB6, 0xC3, 0xB6 };
135static const struct among a_5[7] = {
136{ 2, s_5_0, 0, -1, 0},
137{ 2, s_5_1, 0, -1, 0},
138{ 2, s_5_2, 0, -1, 0},
139{ 2, s_5_3, 0, -1, 0},
140{ 2, s_5_4, 0, -1, 0},
141{ 4, s_5_5, 0, -1, 0},
142{ 4, s_5_6, 0, -1, 0}
143};
144
145static const symbol s_6_0[1] = { 'a' };
146static const symbol s_6_1[3] = { 'l', 'l', 'a' };
147static const symbol s_6_2[2] = { 'n', 'a' };
148static const symbol s_6_3[3] = { 's', 's', 'a' };
149static const symbol s_6_4[2] = { 't', 'a' };
150static const symbol s_6_5[3] = { 'l', 't', 'a' };
151static const symbol s_6_6[3] = { 's', 't', 'a' };
152static const symbol s_6_7[3] = { 't', 't', 'a' };
153static const symbol s_6_8[3] = { 'l', 'l', 'e' };
154static const symbol s_6_9[3] = { 'i', 'n', 'e' };
155static const symbol s_6_10[3] = { 'k', 's', 'i' };
156static const symbol s_6_11[1] = { 'n' };
157static const symbol s_6_12[3] = { 'h', 'a', 'n' };
158static const symbol s_6_13[3] = { 'd', 'e', 'n' };
159static const symbol s_6_14[4] = { 's', 'e', 'e', 'n' };
160static const symbol s_6_15[3] = { 'h', 'e', 'n' };
161static const symbol s_6_16[4] = { 't', 't', 'e', 'n' };
162static const symbol s_6_17[3] = { 'h', 'i', 'n' };
163static const symbol s_6_18[4] = { 's', 'i', 'i', 'n' };
164static const symbol s_6_19[3] = { 'h', 'o', 'n' };
165static const symbol s_6_20[4] = { 'h', 0xC3, 0xA4, 'n' };
166static const symbol s_6_21[4] = { 'h', 0xC3, 0xB6, 'n' };
167static const symbol s_6_22[2] = { 0xC3, 0xA4 };
168static const symbol s_6_23[4] = { 'l', 'l', 0xC3, 0xA4 };
169static const symbol s_6_24[3] = { 'n', 0xC3, 0xA4 };
170static const symbol s_6_25[4] = { 's', 's', 0xC3, 0xA4 };
171static const symbol s_6_26[3] = { 't', 0xC3, 0xA4 };
172static const symbol s_6_27[4] = { 'l', 't', 0xC3, 0xA4 };
173static const symbol s_6_28[4] = { 's', 't', 0xC3, 0xA4 };
174static const symbol s_6_29[4] = { 't', 't', 0xC3, 0xA4 };
175static const struct among a_6[30] = {
176{ 1, s_6_0, 0, 8, 0},
177{ 3, s_6_1, -1, -1, 0},
178{ 2, s_6_2, -2, -1, 0},
179{ 3, s_6_3, -3, -1, 0},
180{ 2, s_6_4, -4, -1, 0},
181{ 3, s_6_5, -1, -1, 0},
182{ 3, s_6_6, -2, -1, 0},
183{ 3, s_6_7, -3, 2, 0},
184{ 3, s_6_8, 0, -1, 0},
185{ 3, s_6_9, 0, -1, 0},
186{ 3, s_6_10, 0, -1, 0},
187{ 1, s_6_11, 0, 7, 0},
188{ 3, s_6_12, -1, 1, 0},
189{ 3, s_6_13, -2, -1, 1},
190{ 4, s_6_14, -3, -1, 2},
191{ 3, s_6_15, -4, 2, 0},
192{ 4, s_6_16, -5, -1, 1},
193{ 3, s_6_17, -6, 3, 0},
194{ 4, s_6_18, -7, -1, 1},
195{ 3, s_6_19, -8, 4, 0},
196{ 4, s_6_20, -9, 5, 0},
197{ 4, s_6_21, -10, 6, 0},
198{ 2, s_6_22, 0, 8, 0},
199{ 4, s_6_23, -1, -1, 0},
200{ 3, s_6_24, -2, -1, 0},
201{ 4, s_6_25, -3, -1, 0},
202{ 3, s_6_26, -4, -1, 0},
203{ 4, s_6_27, -1, -1, 0},
204{ 4, s_6_28, -2, -1, 0},
205{ 4, s_6_29, -3, 2, 0}
206};
207
208static int af_6(struct SN_env * z) {
209 switch (z->af) {
210 case 1: return r_VI(z);
211 case 2: return r_LONG(z);
212 }
213 return -1;
214}
215
216static const symbol s_7_0[3] = { 'e', 'j', 'a' };
217static const symbol s_7_1[3] = { 'm', 'm', 'a' };
218static const symbol s_7_2[4] = { 'i', 'm', 'm', 'a' };
219static const symbol s_7_3[3] = { 'm', 'p', 'a' };
220static const symbol s_7_4[4] = { 'i', 'm', 'p', 'a' };
221static const symbol s_7_5[3] = { 'm', 'm', 'i' };
222static const symbol s_7_6[4] = { 'i', 'm', 'm', 'i' };
223static const symbol s_7_7[3] = { 'm', 'p', 'i' };
224static const symbol s_7_8[4] = { 'i', 'm', 'p', 'i' };
225static const symbol s_7_9[4] = { 'e', 'j', 0xC3, 0xA4 };
226static const symbol s_7_10[4] = { 'm', 'm', 0xC3, 0xA4 };
227static const symbol s_7_11[5] = { 'i', 'm', 'm', 0xC3, 0xA4 };
228static const symbol s_7_12[4] = { 'm', 'p', 0xC3, 0xA4 };
229static const symbol s_7_13[5] = { 'i', 'm', 'p', 0xC3, 0xA4 };
230static const struct among a_7[14] = {
231{ 3, s_7_0, 0, -1, 0},
232{ 3, s_7_1, 0, 1, 0},
233{ 4, s_7_2, -1, -1, 0},
234{ 3, s_7_3, 0, 1, 0},
235{ 4, s_7_4, -1, -1, 0},
236{ 3, s_7_5, 0, 1, 0},
237{ 4, s_7_6, -1, -1, 0},
238{ 3, s_7_7, 0, 1, 0},
239{ 4, s_7_8, -1, -1, 0},
240{ 4, s_7_9, 0, -1, 0},
241{ 4, s_7_10, 0, 1, 0},
242{ 5, s_7_11, -1, -1, 0},
243{ 4, s_7_12, 0, 1, 0},
244{ 5, s_7_13, -1, -1, 0}
245};
246
247static const symbol s_9_0[3] = { 'm', 'm', 'a' };
248static const symbol s_9_1[4] = { 'i', 'm', 'm', 'a' };
249static const struct among a_9[2] = {
250{ 3, s_9_0, 0, 1, 0},
251{ 4, s_9_1, -1, -1, 0}
252};
253
254static const unsigned char g_AEI[] = { 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8 };
255
256static const unsigned char g_C[] = { 119, 223, 119, 1 };
257
258static const unsigned char g_V1[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 };
259
260static const unsigned char g_V2[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 };
261
262static const unsigned char g_particle_end[] = { 17, 97, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 };
263
264static int r_mark_regions(struct SN_env * z) {
265 ((SN_local *)z)->i_p1 = z->l;
266 ((SN_local *)z)->i_p2 = z->l;
267 {
268 int ret = out_grouping_U(z, g_V1, 97, 246, 1);
269 if (ret < 0) return 0;
270 z->c += ret;
271 }
272 {
273 int ret = in_grouping_U(z, g_V1, 97, 246, 1);
274 if (ret < 0) return 0;
275 z->c += ret;
276 }
277 ((SN_local *)z)->i_p1 = z->c;
278 {
279 int ret = out_grouping_U(z, g_V1, 97, 246, 1);
280 if (ret < 0) return 0;
281 z->c += ret;
282 }
283 {
284 int ret = in_grouping_U(z, g_V1, 97, 246, 1);
285 if (ret < 0) return 0;
286 z->c += ret;
287 }
288 ((SN_local *)z)->i_p2 = z->c;
289 return 1;
290}
291
292static int r_R2(struct SN_env * z) {
293 return ((SN_local *)z)->i_p2 <= z->c;
294}
295
296static int r_particle_etc(struct SN_env * z) {
297 int among_var;
298 {
299 int v_1;
300 if (z->c < ((SN_local *)z)->i_p1) return 0;
301 v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
302 z->ket = z->c;
303 among_var = find_among_b(z, a_0, 10, 0);
304 if (!among_var) { z->lb = v_1; return 0; }
305 z->bra = z->c;
306 z->lb = v_1;
307 }
308 switch (among_var) {
309 case 1:
310 if (in_grouping_b_U(z, g_particle_end, 97, 246, 0)) return 0;
311 break;
312 case 2:
313 {
314 int ret = r_R2(z);
315 if (ret <= 0) return ret;
316 }
317 break;
318 }
319 {
320 int ret = slice_del(z);
321 if (ret < 0) return ret;
322 }
323 return 1;
324}
325
326static int r_possessive(struct SN_env * z) {
327 int among_var;
328 {
329 int v_1;
330 if (z->c < ((SN_local *)z)->i_p1) return 0;
331 v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
332 z->ket = z->c;
333 among_var = find_among_b(z, a_4, 9, 0);
334 if (!among_var) { z->lb = v_1; return 0; }
335 z->bra = z->c;
336 z->lb = v_1;
337 }
338 switch (among_var) {
339 case 1:
340 {
341 int v_2 = z->l - z->c;
342 if (z->c <= z->lb || z->p[z->c - 1] != 'k') goto lab0;
343 z->c--;
344 return 0;
345 lab0:
346 z->c = z->l - v_2;
347 }
348 {
349 int ret = slice_del(z);
350 if (ret < 0) return ret;
351 }
352 break;
353 case 2:
354 {
355 int ret = slice_del(z);
356 if (ret < 0) return ret;
357 }
358 z->ket = z->c;
359 if (!(eq_s_b(z, 3, s_0))) return 0;
360 z->bra = z->c;
361 {
362 int ret = slice_from_s(z, 3, s_1);
363 if (ret < 0) return ret;
364 }
365 break;
366 case 3:
367 {
368 int ret = slice_del(z);
369 if (ret < 0) return ret;
370 }
371 break;
372 case 4:
373 if (z->c - 1 <= z->lb || z->p[z->c - 1] != 97) return 0;
374 if (!find_among_b(z, a_1, 6, 0)) return 0;
375 {
376 int ret = slice_del(z);
377 if (ret < 0) return ret;
378 }
379 break;
380 case 5:
381 if (z->c - 2 <= z->lb || z->p[z->c - 1] != 164) return 0;
382 if (!find_among_b(z, a_2, 6, 0)) return 0;
383 {
384 int ret = slice_del(z);
385 if (ret < 0) return ret;
386 }
387 break;
388 case 6:
389 if (z->c - 2 <= z->lb || z->p[z->c - 1] != 101) return 0;
390 if (!find_among_b(z, a_3, 2, 0)) return 0;
391 {
392 int ret = slice_del(z);
393 if (ret < 0) return ret;
394 }
395 break;
396 }
397 return 1;
398}
399
400static int r_LONG(struct SN_env * z) {
401 return find_among_b(z, a_5, 7, 0) != 0;
402}
403
404static int r_VI(struct SN_env * z) {
405 if (z->c <= z->lb || z->p[z->c - 1] != 'i') return 0;
406 z->c--;
407 return !in_grouping_b_U(z, g_V2, 97, 246, 0);
408}
409
410static int r_case_ending(struct SN_env * z) {
411 int among_var;
412 {
413 int v_1;
414 if (z->c < ((SN_local *)z)->i_p1) return 0;
415 v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
416 z->ket = z->c;
417 among_var = find_among_b(z, a_6, 30, af_6);
418 if (!among_var) { z->lb = v_1; return 0; }
419 z->bra = z->c;
420 z->lb = v_1;
421 }
422 switch (among_var) {
423 case 1:
424 if (z->c <= z->lb || z->p[z->c - 1] != 'a') return 0;
425 z->c--;
426 break;
427 case 2:
428 if (z->c <= z->lb || z->p[z->c - 1] != 'e') return 0;
429 z->c--;
430 break;
431 case 3:
432 if (z->c <= z->lb || z->p[z->c - 1] != 'i') return 0;
433 z->c--;
434 break;
435 case 4:
436 if (z->c <= z->lb || z->p[z->c - 1] != 'o') return 0;
437 z->c--;
438 break;
439 case 5:
440 if (!(eq_s_b(z, 2, s_2))) return 0;
441 break;
442 case 6:
443 if (!(eq_s_b(z, 2, s_3))) return 0;
444 break;
445 case 7:
446 {
447 int v_2 = z->l - z->c;
448 {
449 int v_3 = z->l - z->c;
450 do {
451 int v_4 = z->l - z->c;
452 {
453 int ret = r_LONG(z);
454 if (ret == 0) goto lab1;
455 if (ret < 0) return ret;
456 }
457 break;
458 lab1:
459 z->c = z->l - v_4;
460 if (!(eq_s_b(z, 2, s_4))) { z->c = z->l - v_2; goto lab0; }
461 } while (0);
462 z->c = z->l - v_3;
463 {
464 int ret = skip_b_utf8(z->p, z->c, z->lb, 1);
465 if (ret < 0) { z->c = z->l - v_2; goto lab0; }
466 z->c = ret;
467 }
468 }
469 z->bra = z->c;
470 lab0:
471 ;
472 }
473 break;
474 case 8:
475 if (in_grouping_b_U(z, g_V1, 97, 246, 0)) return 0;
476 if (in_grouping_b_U(z, g_C, 98, 122, 0)) return 0;
477 break;
478 }
479 {
480 int ret = slice_del(z);
481 if (ret < 0) return ret;
482 }
483 ((SN_local *)z)->b_ending_removed = 1;
484 return 1;
485}
486
487static int r_other_endings(struct SN_env * z) {
488 int among_var;
489 {
490 int v_1;
491 if (z->c < ((SN_local *)z)->i_p2) return 0;
492 v_1 = z->lb; z->lb = ((SN_local *)z)->i_p2;
493 z->ket = z->c;
494 among_var = find_among_b(z, a_7, 14, 0);
495 if (!among_var) { z->lb = v_1; return 0; }
496 z->bra = z->c;
497 z->lb = v_1;
498 }
499 switch (among_var) {
500 case 1:
501 {
502 int v_2 = z->l - z->c;
503 if (!(eq_s_b(z, 2, s_5))) goto lab0;
504 return 0;
505 lab0:
506 z->c = z->l - v_2;
507 }
508 break;
509 }
510 {
511 int ret = slice_del(z);
512 if (ret < 0) return ret;
513 }
514 return 1;
515}
516
517static int r_i_plural(struct SN_env * z) {
518 {
519 int v_1;
520 if (z->c < ((SN_local *)z)->i_p1) return 0;
521 v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
522 z->ket = z->c;
523 if (z->c <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 106)) { z->lb = v_1; return 0; }
524 z->c--;
525 z->bra = z->c;
526 z->lb = v_1;
527 }
528 {
529 int ret = slice_del(z);
530 if (ret < 0) return ret;
531 }
532 return 1;
533}
534
535static int r_t_plural(struct SN_env * z) {
536 int among_var;
537 {
538 int v_1;
539 if (z->c < ((SN_local *)z)->i_p1) return 0;
540 v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
541 z->ket = z->c;
542 if (z->c <= z->lb || z->p[z->c - 1] != 't') { z->lb = v_1; return 0; }
543 z->c--;
544 z->bra = z->c;
545 {
546 int v_2 = z->l - z->c;
547 if (in_grouping_b_U(z, g_V1, 97, 246, 0)) { z->lb = v_1; return 0; }
548 z->c = z->l - v_2;
549 }
550 {
551 int ret = slice_del(z);
552 if (ret < 0) return ret;
553 }
554 z->lb = v_1;
555 }
556 {
557 int v_3;
558 if (z->c < ((SN_local *)z)->i_p2) return 0;
559 v_3 = z->lb; z->lb = ((SN_local *)z)->i_p2;
560 z->ket = z->c;
561 if (z->c - 2 <= z->lb || z->p[z->c - 1] != 97) { z->lb = v_3; return 0; }
562 among_var = find_among_b(z, a_9, 2, 0);
563 if (!among_var) { z->lb = v_3; return 0; }
564 z->bra = z->c;
565 z->lb = v_3;
566 }
567 switch (among_var) {
568 case 1:
569 {
570 int v_4 = z->l - z->c;
571 if (!(eq_s_b(z, 2, s_6))) goto lab0;
572 return 0;
573 lab0:
574 z->c = z->l - v_4;
575 }
576 break;
577 }
578 {
579 int ret = slice_del(z);
580 if (ret < 0) return ret;
581 }
582 return 1;
583}
584
585static int r_tidy(struct SN_env * z) {
586 {
587 int v_1;
588 if (z->c < ((SN_local *)z)->i_p1) return 0;
589 v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
590 {
591 int v_2 = z->l - z->c;
592 {
593 int v_3 = z->l - z->c;
594 {
595 int ret = r_LONG(z);
596 if (ret == 0) goto lab0;
597 if (ret < 0) return ret;
598 }
599 z->c = z->l - v_3;
600 z->ket = z->c;
601 {
602 int ret = skip_b_utf8(z->p, z->c, z->lb, 1);
603 if (ret < 0) goto lab0;
604 z->c = ret;
605 }
606 z->bra = z->c;
607 {
608 int ret = slice_del(z);
609 if (ret < 0) return ret;
610 }
611 }
612 lab0:
613 z->c = z->l - v_2;
614 }
615 {
616 int v_4 = z->l - z->c;
617 z->ket = z->c;
618 if (in_grouping_b_U(z, g_AEI, 97, 228, 0)) goto lab1;
619 z->bra = z->c;
620 if (in_grouping_b_U(z, g_C, 98, 122, 0)) goto lab1;
621 {
622 int ret = slice_del(z);
623 if (ret < 0) return ret;
624 }
625 lab1:
626 z->c = z->l - v_4;
627 }
628 {
629 int v_5 = z->l - z->c;
630 z->ket = z->c;
631 if (z->c <= z->lb || z->p[z->c - 1] != 'j') goto lab2;
632 z->c--;
633 z->bra = z->c;
634 do {
635 int v_6 = z->l - z->c;
636 if (z->c <= z->lb || z->p[z->c - 1] != 'o') goto lab3;
637 z->c--;
638 break;
639 lab3:
640 z->c = z->l - v_6;
641 if (z->c <= z->lb || z->p[z->c - 1] != 'u') goto lab2;
642 z->c--;
643 } while (0);
644 {
645 int ret = slice_del(z);
646 if (ret < 0) return ret;
647 }
648 lab2:
649 z->c = z->l - v_5;
650 }
651 {
652 int v_7 = z->l - z->c;
653 z->ket = z->c;
654 if (z->c <= z->lb || z->p[z->c - 1] != 'o') goto lab4;
655 z->c--;
656 z->bra = z->c;
657 if (z->c <= z->lb || z->p[z->c - 1] != 'j') goto lab4;
658 z->c--;
659 {
660 int ret = slice_del(z);
661 if (ret < 0) return ret;
662 }
663 lab4:
664 z->c = z->l - v_7;
665 }
666 z->lb = v_1;
667 }
668 if (in_grouping_b_U(z, g_V1, 97, 246, 1) < 0) return 0;
669 z->ket = z->c;
670 if (in_grouping_b_U(z, g_C, 98, 122, 0)) return 0;
671 z->bra = z->c;
672 {
673 int ret = slice_to(z, &((SN_local *)z)->s_x);
674 if (ret < 0) return ret;
675 }
676 if (!(eq_v_b(z, ((SN_local *)z)->s_x))) return 0;
677 {
678 int ret = slice_del(z);
679 if (ret < 0) return ret;
680 }
681 return 1;
682}
683
684extern int finnish_UTF_8_stem(struct SN_env * z) {
685 {
686 int v_1 = z->c;
687 {
688 int ret = r_mark_regions(z);
689 if (ret < 0) return ret;
690 }
691 z->c = v_1;
692 }
693 ((SN_local *)z)->b_ending_removed = 0;
694 z->lb = z->c; z->c = z->l;
695 {
696 int v_2 = z->l - z->c;
697 {
698 int ret = r_particle_etc(z);
699 if (ret < 0) return ret;
700 }
701 z->c = z->l - v_2;
702 }
703 {
704 int v_3 = z->l - z->c;
705 {
706 int ret = r_possessive(z);
707 if (ret < 0) return ret;
708 }
709 z->c = z->l - v_3;
710 }
711 {
712 int v_4 = z->l - z->c;
713 {
714 int ret = r_case_ending(z);
715 if (ret < 0) return ret;
716 }
717 z->c = z->l - v_4;
718 }
719 {
720 int v_5 = z->l - z->c;
721 {
722 int ret = r_other_endings(z);
723 if (ret < 0) return ret;
724 }
725 z->c = z->l - v_5;
726 }
727 do {
728 if (!((SN_local *)z)->b_ending_removed) goto lab0;
729 {
730 int v_6 = z->l - z->c;
731 {
732 int ret = r_i_plural(z);
733 if (ret < 0) return ret;
734 }
735 z->c = z->l - v_6;
736 }
737 break;
738 lab0:
739 {
740 int v_7 = z->l - z->c;
741 {
742 int ret = r_t_plural(z);
743 if (ret < 0) return ret;
744 }
745 z->c = z->l - v_7;
746 }
747 } while (0);
748 {
749 int v_8 = z->l - z->c;
750 {
751 int ret = r_tidy(z);
752 if (ret < 0) return ret;
753 }
754 z->c = z->l - v_8;
755 }
756 z->c = z->lb;
757 return 1;
758}
759
760extern struct SN_env * finnish_UTF_8_create_env(void) {
761 struct SN_env * z = SN_new_env(sizeof(SN_local));
762 if (z) {
763 ((SN_local *)z)->b_ending_removed = 0;
764 ((SN_local *)z)->s_x = NULL;
765 ((SN_local *)z)->i_p2 = 0;
766 ((SN_local *)z)->i_p1 = 0;
767
768 if ((((SN_local *)z)->s_x = create_s()) == NULL) {
770 return NULL;
771 }
772 }
773 return z;
774}
775
776extern void finnish_UTF_8_close_env(struct SN_env * z) {
777 if (z) {
778 lose_s(((SN_local *)z)->s_x);
779 }
780 SN_delete_env(z);
781}
782
void SN_delete_env(struct SN_env *z)
Definition: api.c:18
struct SN_env * SN_new_env(int alloc_size)
Definition: api.c:5
unsigned char symbol
Definition: api.h:4
struct SN_env * finnish_UTF_8_create_env(void)
static const symbol s_0_2[4]
static int r_case_ending(struct SN_env *z)
static const symbol s_2[]
static const unsigned char g_C[]
static const symbol s_6_24[3]
static const struct among a_3[2]
static const symbol s_6_21[4]
static const symbol s_4[]
static const symbol s_7_13[5]
static const struct among a_7[14]
static const unsigned char g_V1[]
static const symbol s_4_1[3]
static const symbol s_5_6[4]
static const symbol s_1_5[3]
static const symbol s_7_7[3]
static const symbol s_6_17[3]
static const symbol s_0_3[3]
static int af_6(struct SN_env *z)
static const symbol s_9_0[3]
static const symbol s_5_3[2]
static const unsigned char g_particle_end[]
static const symbol s_6_1[3]
static const struct among a_5[7]
static const symbol s_5_0[2]
static const symbol s_2_3[3]
static int r_tidy(struct SN_env *z)
static const struct among a_2[6]
static const symbol s_6_15[3]
static const symbol s_1_3[2]
static const symbol s_2_1[3]
static const symbol s_6_12[3]
static const symbol s_6[]
static const symbol s_0_0[2]
static const symbol s_0_5[4]
static const symbol s_6_20[4]
static const symbol s_6_29[4]
static const symbol s_3[]
static const symbol s_2_2[4]
static const symbol s_4_6[2]
static const symbol s_6_6[3]
static const symbol s_3_0[3]
static const symbol s_4_4[2]
static const symbol s_7_1[3]
static const symbol s_0_7[2]
static const symbol s_2_4[4]
static const symbol s_7_12[4]
static const symbol s_7_9[4]
static const symbol s_6_5[3]
static int r_R2(struct SN_env *z)
static const symbol s_7_6[4]
static const symbol s_6_4[2]
static const symbol s_0_8[3]
static const symbol s_6_19[3]
static const symbol s_6_10[3]
static const symbol s_7_5[3]
static const symbol s_6_27[4]
static const symbol s_3_1[3]
static const symbol s_6_13[3]
static const symbol s_1_1[2]
static const symbol s_7_8[4]
static const symbol s_6_18[4]
static const symbol s_6_9[3]
static int r_other_endings(struct SN_env *z)
static int r_t_plural(struct SN_env *z)
static const unsigned char g_V2[]
static const symbol s_7_0[3]
static const symbol s_0_1[3]
static const symbol s_6_2[2]
static int r_VI(struct SN_env *z)
int finnish_UTF_8_stem(struct SN_env *z)
static const symbol s_6_7[3]
static const struct among a_4[9]
static const symbol s_5_4[2]
static const symbol s_6_22[2]
static int r_LONG(struct SN_env *z)
static const symbol s_6_16[4]
static const symbol s_0_9[3]
static const symbol s_7_2[4]
static const struct among a_6[30]
static int r_i_plural(struct SN_env *z)
static const symbol s_6_11[1]
static const symbol s_7_4[4]
static const struct among a_1[6]
static const symbol s_1[]
static const symbol s_5_5[4]
static const symbol s_9_1[4]
static const symbol s_1_2[3]
static const symbol s_6_8[3]
static const symbol s_5_2[2]
static const struct among a_9[2]
static int r_possessive(struct SN_env *z)
static const symbol s_6_14[4]
static int r_mark_regions(struct SN_env *z)
static const symbol s_7_3[3]
static const unsigned char g_AEI[]
static const symbol s_2_0[4]
static const symbol s_6_23[4]
static const symbol s_1_0[3]
static const symbol s_6_0[1]
static const symbol s_6_3[3]
static const symbol s_0_6[6]
static const struct among a_0[10]
static const symbol s_4_3[2]
static const symbol s_4_8[4]
static const symbol s_5_1[2]
static const symbol s_1_4[3]
static const symbol s_6_25[4]
static const symbol s_6_26[3]
static const symbol s_2_5[4]
static int r_particle_etc(struct SN_env *z)
void finnish_UTF_8_close_env(struct SN_env *z)
static const symbol s_6_28[4]
static const symbol s_7_10[4]
static const symbol s_4_7[3]
static const symbol s_5[]
static const symbol s_4_2[3]
static const symbol s_4_0[3]
static const symbol s_7_11[5]
static const symbol s_4_5[2]
static const symbol s_0[]
static const symbol s_0_4[3]
Definition: api.h:15
int af
Definition: api.h:18
int lb
Definition: api.h:17
symbol * p
Definition: api.h:16
int ket
Definition: api.h:17
int c
Definition: api.h:17
int bra
Definition: api.h:17
int l
Definition: api.h:17
unsigned char b_ending_removed
struct SN_env z
int out_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:157
int in_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:133
int eq_v_b(struct SN_env *z, const symbol *p)
Definition: utilities.c:245
SNOWBALL_ERR slice_from_s(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.c:432
SNOWBALL_ERR slice_to(struct SN_env *z, symbol **p)
Definition: utilities.c:478
void lose_s(symbol *p)
Definition: utilities.c:31
int find_among_b(struct SN_env *z, const struct among *v, int v_size, int(*call_among_func)(struct SN_env *))
Definition: utilities.c:315
int in_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:145
int skip_b_utf8(const symbol *p, int c, int limit, int n)
Definition: utilities.c:68
int eq_s_b(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.c:236
SNOWBALL_ERR slice_del(struct SN_env *z)
Definition: utilities.c:443
symbol * create_s(void)
Definition: utilities.c:20