-
Notifications
You must be signed in to change notification settings - Fork 6
/
stem_UTF_8_irish.c
470 lines (441 loc) · 13.9 KB
/
stem_UTF_8_irish.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
/* Generated by Snowball 2.2.0 - https://snowballstem.org/ */
#include "header.h"
#ifdef __cplusplus
extern "C" {
#endif
extern int irish_UTF_8_stem(struct SN_env * z);
#ifdef __cplusplus
}
#endif
static int r_verb_sfx(struct SN_env * z);
static int r_deriv(struct SN_env * z);
static int r_noun_sfx(struct SN_env * z);
static int r_mark_regions(struct SN_env * z);
static int r_initial_morph(struct SN_env * z);
static int r_RV(struct SN_env * z);
static int r_R2(struct SN_env * z);
static int r_R1(struct SN_env * z);
#ifdef __cplusplus
extern "C" {
#endif
extern struct SN_env * irish_UTF_8_create_env(void);
extern void irish_UTF_8_close_env(struct SN_env * z);
#ifdef __cplusplus
}
#endif
static const symbol s_0_0[2] = { 'b', '\'' };
static const symbol s_0_1[2] = { 'b', 'h' };
static const symbol s_0_2[3] = { 'b', 'h', 'f' };
static const symbol s_0_3[2] = { 'b', 'p' };
static const symbol s_0_4[2] = { 'c', 'h' };
static const symbol s_0_5[2] = { 'd', '\'' };
static const symbol s_0_6[4] = { 'd', '\'', 'f', 'h' };
static const symbol s_0_7[2] = { 'd', 'h' };
static const symbol s_0_8[2] = { 'd', 't' };
static const symbol s_0_9[2] = { 'f', 'h' };
static const symbol s_0_10[2] = { 'g', 'c' };
static const symbol s_0_11[2] = { 'g', 'h' };
static const symbol s_0_12[2] = { 'h', '-' };
static const symbol s_0_13[2] = { 'm', '\'' };
static const symbol s_0_14[2] = { 'm', 'b' };
static const symbol s_0_15[2] = { 'm', 'h' };
static const symbol s_0_16[2] = { 'n', '-' };
static const symbol s_0_17[2] = { 'n', 'd' };
static const symbol s_0_18[2] = { 'n', 'g' };
static const symbol s_0_19[2] = { 'p', 'h' };
static const symbol s_0_20[2] = { 's', 'h' };
static const symbol s_0_21[2] = { 't', '-' };
static const symbol s_0_22[2] = { 't', 'h' };
static const symbol s_0_23[2] = { 't', 's' };
static const struct among a_0[24] =
{
{ 2, s_0_0, -1, 1, 0},
{ 2, s_0_1, -1, 4, 0},
{ 3, s_0_2, 1, 2, 0},
{ 2, s_0_3, -1, 8, 0},
{ 2, s_0_4, -1, 5, 0},
{ 2, s_0_5, -1, 1, 0},
{ 4, s_0_6, 5, 2, 0},
{ 2, s_0_7, -1, 6, 0},
{ 2, s_0_8, -1, 9, 0},
{ 2, s_0_9, -1, 2, 0},
{ 2, s_0_10, -1, 5, 0},
{ 2, s_0_11, -1, 7, 0},
{ 2, s_0_12, -1, 1, 0},
{ 2, s_0_13, -1, 1, 0},
{ 2, s_0_14, -1, 4, 0},
{ 2, s_0_15, -1, 10, 0},
{ 2, s_0_16, -1, 1, 0},
{ 2, s_0_17, -1, 6, 0},
{ 2, s_0_18, -1, 7, 0},
{ 2, s_0_19, -1, 8, 0},
{ 2, s_0_20, -1, 3, 0},
{ 2, s_0_21, -1, 1, 0},
{ 2, s_0_22, -1, 9, 0},
{ 2, s_0_23, -1, 3, 0}
};
static const symbol s_1_0[7] = { 0xC3, 0xAD, 'o', 'c', 'h', 't', 'a' };
static const symbol s_1_1[8] = { 'a', 0xC3, 0xAD, 'o', 'c', 'h', 't', 'a' };
static const symbol s_1_2[3] = { 'i', 'r', 'e' };
static const symbol s_1_3[4] = { 'a', 'i', 'r', 'e' };
static const symbol s_1_4[3] = { 'a', 'b', 'h' };
static const symbol s_1_5[4] = { 'e', 'a', 'b', 'h' };
static const symbol s_1_6[3] = { 'i', 'b', 'h' };
static const symbol s_1_7[4] = { 'a', 'i', 'b', 'h' };
static const symbol s_1_8[3] = { 'a', 'm', 'h' };
static const symbol s_1_9[4] = { 'e', 'a', 'm', 'h' };
static const symbol s_1_10[3] = { 'i', 'm', 'h' };
static const symbol s_1_11[4] = { 'a', 'i', 'm', 'h' };
static const symbol s_1_12[6] = { 0xC3, 0xAD, 'o', 'c', 'h', 't' };
static const symbol s_1_13[7] = { 'a', 0xC3, 0xAD, 'o', 'c', 'h', 't' };
static const symbol s_1_14[4] = { 'i', 'r', 0xC3, 0xAD };
static const symbol s_1_15[5] = { 'a', 'i', 'r', 0xC3, 0xAD };
static const struct among a_1[16] =
{
{ 7, s_1_0, -1, 1, 0},
{ 8, s_1_1, 0, 1, 0},
{ 3, s_1_2, -1, 2, 0},
{ 4, s_1_3, 2, 2, 0},
{ 3, s_1_4, -1, 1, 0},
{ 4, s_1_5, 4, 1, 0},
{ 3, s_1_6, -1, 1, 0},
{ 4, s_1_7, 6, 1, 0},
{ 3, s_1_8, -1, 1, 0},
{ 4, s_1_9, 8, 1, 0},
{ 3, s_1_10, -1, 1, 0},
{ 4, s_1_11, 10, 1, 0},
{ 6, s_1_12, -1, 1, 0},
{ 7, s_1_13, 12, 1, 0},
{ 4, s_1_14, -1, 2, 0},
{ 5, s_1_15, 14, 2, 0}
};
static const symbol s_2_0[9] = { 0xC3, 0xB3, 'i', 'd', 'e', 'a', 'c', 'h', 'a' };
static const symbol s_2_1[7] = { 'p', 'a', 't', 'a', 'c', 'h', 'a' };
static const symbol s_2_2[5] = { 'a', 'c', 'h', 't', 'a' };
static const symbol s_2_3[8] = { 'a', 'r', 'c', 'a', 'c', 'h', 't', 'a' };
static const symbol s_2_4[6] = { 'e', 'a', 'c', 'h', 't', 'a' };
static const symbol s_2_5[12] = { 'g', 'r', 'a', 'f', 'a', 0xC3, 0xAD, 'o', 'c', 'h', 't', 'a' };
static const symbol s_2_6[5] = { 'p', 'a', 'i', 't', 'e' };
static const symbol s_2_7[3] = { 'a', 'c', 'h' };
static const symbol s_2_8[4] = { 'e', 'a', 'c', 'h' };
static const symbol s_2_9[8] = { 0xC3, 0xB3, 'i', 'd', 'e', 'a', 'c', 'h' };
static const symbol s_2_10[7] = { 'g', 'i', 'n', 'e', 'a', 'c', 'h' };
static const symbol s_2_11[6] = { 'p', 'a', 't', 'a', 'c', 'h' };
static const symbol s_2_12[10] = { 'g', 'r', 'a', 'f', 'a', 0xC3, 0xAD, 'o', 'c', 'h' };
static const symbol s_2_13[7] = { 'p', 'a', 't', 'a', 'i', 'g', 'h' };
static const symbol s_2_14[7] = { 0xC3, 0xB3, 'i', 'd', 'i', 'g', 'h' };
static const symbol s_2_15[8] = { 'a', 'c', 'h', 't', 0xC3, 0xBA, 'i', 'l' };
static const symbol s_2_16[9] = { 'e', 'a', 'c', 'h', 't', 0xC3, 0xBA, 'i', 'l' };
static const symbol s_2_17[6] = { 'g', 'i', 'n', 'e', 'a', 's' };
static const symbol s_2_18[5] = { 'g', 'i', 'n', 'i', 's' };
static const symbol s_2_19[4] = { 'a', 'c', 'h', 't' };
static const symbol s_2_20[7] = { 'a', 'r', 'c', 'a', 'c', 'h', 't' };
static const symbol s_2_21[5] = { 'e', 'a', 'c', 'h', 't' };
static const symbol s_2_22[11] = { 'g', 'r', 'a', 'f', 'a', 0xC3, 0xAD, 'o', 'c', 'h', 't' };
static const symbol s_2_23[10] = { 'a', 'r', 'c', 'a', 'c', 'h', 't', 'a', 0xC3, 0xAD };
static const symbol s_2_24[14] = { 'g', 'r', 'a', 'f', 'a', 0xC3, 0xAD, 'o', 'c', 'h', 't', 'a', 0xC3, 0xAD };
static const struct among a_2[25] =
{
{ 9, s_2_0, -1, 6, 0},
{ 7, s_2_1, -1, 5, 0},
{ 5, s_2_2, -1, 1, 0},
{ 8, s_2_3, 2, 2, 0},
{ 6, s_2_4, 2, 1, 0},
{ 12, s_2_5, -1, 4, 0},
{ 5, s_2_6, -1, 5, 0},
{ 3, s_2_7, -1, 1, 0},
{ 4, s_2_8, 7, 1, 0},
{ 8, s_2_9, 8, 6, 0},
{ 7, s_2_10, 8, 3, 0},
{ 6, s_2_11, 7, 5, 0},
{ 10, s_2_12, -1, 4, 0},
{ 7, s_2_13, -1, 5, 0},
{ 7, s_2_14, -1, 6, 0},
{ 8, s_2_15, -1, 1, 0},
{ 9, s_2_16, 15, 1, 0},
{ 6, s_2_17, -1, 3, 0},
{ 5, s_2_18, -1, 3, 0},
{ 4, s_2_19, -1, 1, 0},
{ 7, s_2_20, 19, 2, 0},
{ 5, s_2_21, 19, 1, 0},
{ 11, s_2_22, -1, 4, 0},
{ 10, s_2_23, -1, 2, 0},
{ 14, s_2_24, -1, 4, 0}
};
static const symbol s_3_0[4] = { 'i', 'm', 'i', 'd' };
static const symbol s_3_1[5] = { 'a', 'i', 'm', 'i', 'd' };
static const symbol s_3_2[5] = { 0xC3, 0xAD, 'm', 'i', 'd' };
static const symbol s_3_3[6] = { 'a', 0xC3, 0xAD, 'm', 'i', 'd' };
static const symbol s_3_4[3] = { 'a', 'd', 'h' };
static const symbol s_3_5[4] = { 'e', 'a', 'd', 'h' };
static const symbol s_3_6[5] = { 'f', 'a', 'i', 'd', 'h' };
static const symbol s_3_7[4] = { 'f', 'i', 'd', 'h' };
static const symbol s_3_8[4] = { 0xC3, 0xA1, 'i', 'l' };
static const symbol s_3_9[3] = { 'a', 'i', 'n' };
static const symbol s_3_10[4] = { 't', 'e', 'a', 'r' };
static const symbol s_3_11[3] = { 't', 'a', 'r' };
static const struct among a_3[12] =
{
{ 4, s_3_0, -1, 1, 0},
{ 5, s_3_1, 0, 1, 0},
{ 5, s_3_2, -1, 1, 0},
{ 6, s_3_3, 2, 1, 0},
{ 3, s_3_4, -1, 2, 0},
{ 4, s_3_5, 4, 2, 0},
{ 5, s_3_6, -1, 1, 0},
{ 4, s_3_7, -1, 1, 0},
{ 4, s_3_8, -1, 2, 0},
{ 3, s_3_9, -1, 2, 0},
{ 4, s_3_10, -1, 2, 0},
{ 3, s_3_11, -1, 2, 0}
};
static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 4, 2 };
static const symbol s_0[] = { 'f' };
static const symbol s_1[] = { 's' };
static const symbol s_2[] = { 'b' };
static const symbol s_3[] = { 'c' };
static const symbol s_4[] = { 'd' };
static const symbol s_5[] = { 'g' };
static const symbol s_6[] = { 'p' };
static const symbol s_7[] = { 't' };
static const symbol s_8[] = { 'm' };
static const symbol s_9[] = { 'a', 'r', 'c' };
static const symbol s_10[] = { 'g', 'i', 'n' };
static const symbol s_11[] = { 'g', 'r', 'a', 'f' };
static const symbol s_12[] = { 'p', 'a', 'i', 't', 'e' };
static const symbol s_13[] = { 0xC3, 0xB3, 'i', 'd' };
static int r_mark_regions(struct SN_env * z) {
z->I[2] = z->l;
z->I[1] = z->l;
z->I[0] = z->l;
{ int c1 = z->c;
{
int ret = out_grouping_U(z, g_v, 97, 250, 1);
if (ret < 0) goto lab0;
z->c += ret;
}
z->I[2] = z->c;
{
int ret = in_grouping_U(z, g_v, 97, 250, 1);
if (ret < 0) goto lab0;
z->c += ret;
}
z->I[1] = z->c;
{
int ret = out_grouping_U(z, g_v, 97, 250, 1);
if (ret < 0) goto lab0;
z->c += ret;
}
{
int ret = in_grouping_U(z, g_v, 97, 250, 1);
if (ret < 0) goto lab0;
z->c += ret;
}
z->I[0] = z->c;
lab0:
z->c = c1;
}
return 1;
}
static int r_initial_morph(struct SN_env * z) {
int among_var;
z->bra = z->c;
among_var = find_among(z, a_0, 24);
if (!(among_var)) return 0;
z->ket = z->c;
switch (among_var) {
case 1:
{ int ret = slice_del(z);
if (ret < 0) return ret;
}
break;
case 2:
{ int ret = slice_from_s(z, 1, s_0);
if (ret < 0) return ret;
}
break;
case 3:
{ int ret = slice_from_s(z, 1, s_1);
if (ret < 0) return ret;
}
break;
case 4:
{ int ret = slice_from_s(z, 1, s_2);
if (ret < 0) return ret;
}
break;
case 5:
{ int ret = slice_from_s(z, 1, s_3);
if (ret < 0) return ret;
}
break;
case 6:
{ int ret = slice_from_s(z, 1, s_4);
if (ret < 0) return ret;
}
break;
case 7:
{ int ret = slice_from_s(z, 1, s_5);
if (ret < 0) return ret;
}
break;
case 8:
{ int ret = slice_from_s(z, 1, s_6);
if (ret < 0) return ret;
}
break;
case 9:
{ int ret = slice_from_s(z, 1, s_7);
if (ret < 0) return ret;
}
break;
case 10:
{ int ret = slice_from_s(z, 1, s_8);
if (ret < 0) return ret;
}
break;
}
return 1;
}
static int r_RV(struct SN_env * z) {
if (!(z->I[2] <= z->c)) return 0;
return 1;
}
static int r_R1(struct SN_env * z) {
if (!(z->I[1] <= z->c)) return 0;
return 1;
}
static int r_R2(struct SN_env * z) {
if (!(z->I[0] <= z->c)) return 0;
return 1;
}
static int r_noun_sfx(struct SN_env * z) {
int among_var;
z->ket = z->c;
among_var = find_among_b(z, a_1, 16);
if (!(among_var)) return 0;
z->bra = z->c;
switch (among_var) {
case 1:
{ int ret = r_R1(z);
if (ret <= 0) return ret;
}
{ int ret = slice_del(z);
if (ret < 0) return ret;
}
break;
case 2:
{ int ret = r_R2(z);
if (ret <= 0) return ret;
}
{ int ret = slice_del(z);
if (ret < 0) return ret;
}
break;
}
return 1;
}
static int r_deriv(struct SN_env * z) {
int among_var;
z->ket = z->c;
among_var = find_among_b(z, a_2, 25);
if (!(among_var)) return 0;
z->bra = z->c;
switch (among_var) {
case 1:
{ int ret = r_R2(z);
if (ret <= 0) return ret;
}
{ int ret = slice_del(z);
if (ret < 0) return ret;
}
break;
case 2:
{ int ret = slice_from_s(z, 3, s_9);
if (ret < 0) return ret;
}
break;
case 3:
{ int ret = slice_from_s(z, 3, s_10);
if (ret < 0) return ret;
}
break;
case 4:
{ int ret = slice_from_s(z, 4, s_11);
if (ret < 0) return ret;
}
break;
case 5:
{ int ret = slice_from_s(z, 5, s_12);
if (ret < 0) return ret;
}
break;
case 6:
{ int ret = slice_from_s(z, 4, s_13);
if (ret < 0) return ret;
}
break;
}
return 1;
}
static int r_verb_sfx(struct SN_env * z) {
int among_var;
z->ket = z->c;
if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((282896 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0;
among_var = find_among_b(z, a_3, 12);
if (!(among_var)) return 0;
z->bra = z->c;
switch (among_var) {
case 1:
{ int ret = r_RV(z);
if (ret <= 0) return ret;
}
{ int ret = slice_del(z);
if (ret < 0) return ret;
}
break;
case 2:
{ int ret = r_R1(z);
if (ret <= 0) return ret;
}
{ int ret = slice_del(z);
if (ret < 0) return ret;
}
break;
}
return 1;
}
extern int irish_UTF_8_stem(struct SN_env * z) {
{ int c1 = z->c;
{ int ret = r_initial_morph(z);
if (ret < 0) return ret;
}
z->c = c1;
}
{ int ret = r_mark_regions(z);
if (ret < 0) return ret;
}
z->lb = z->c; z->c = z->l;
{ int m2 = z->l - z->c; (void)m2;
{ int ret = r_noun_sfx(z);
if (ret < 0) return ret;
}
z->c = z->l - m2;
}
{ int m3 = z->l - z->c; (void)m3;
{ int ret = r_deriv(z);
if (ret < 0) return ret;
}
z->c = z->l - m3;
}
{ int m4 = z->l - z->c; (void)m4;
{ int ret = r_verb_sfx(z);
if (ret < 0) return ret;
}
z->c = z->l - m4;
}
z->c = z->lb;
return 1;
}
extern struct SN_env * irish_UTF_8_create_env(void) { return SN_create_env(0, 3); }
extern void irish_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); }