PostgreSQL Source Code  git master
stem_UTF_8_german.c
Go to the documentation of this file.
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 german_UTF_8_stem(struct SN_env * z);
9 #ifdef __cplusplus
10 }
11 #endif
12 static int r_standard_suffix(struct SN_env * z);
13 static int r_R2(struct SN_env * z);
14 static int r_R1(struct SN_env * z);
15 static int r_mark_regions(struct SN_env * z);
16 static int r_postlude(struct SN_env * z);
17 static int r_prelude(struct SN_env * z);
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 
23 extern struct SN_env * german_UTF_8_create_env(void);
24 extern void german_UTF_8_close_env(struct SN_env * z);
25 
26 
27 #ifdef __cplusplus
28 }
29 #endif
30 static const symbol s_0_1[1] = { 'U' };
31 static const symbol s_0_2[1] = { 'Y' };
32 static const symbol s_0_3[2] = { 0xC3, 0xA4 };
33 static const symbol s_0_4[2] = { 0xC3, 0xB6 };
34 static const symbol s_0_5[2] = { 0xC3, 0xBC };
35 
36 static const struct among a_0[6] =
37 {
38 { 0, 0, -1, 5, 0},
39 { 1, s_0_1, 0, 2, 0},
40 { 1, s_0_2, 0, 1, 0},
41 { 2, s_0_3, 0, 3, 0},
42 { 2, s_0_4, 0, 4, 0},
43 { 2, s_0_5, 0, 2, 0}
44 };
45 
46 static const symbol s_1_0[1] = { 'e' };
47 static const symbol s_1_1[2] = { 'e', 'm' };
48 static const symbol s_1_2[2] = { 'e', 'n' };
49 static const symbol s_1_3[3] = { 'e', 'r', 'n' };
50 static const symbol s_1_4[2] = { 'e', 'r' };
51 static const symbol s_1_5[1] = { 's' };
52 static const symbol s_1_6[2] = { 'e', 's' };
53 
54 static const struct among a_1[7] =
55 {
56 { 1, s_1_0, -1, 2, 0},
57 { 2, s_1_1, -1, 1, 0},
58 { 2, s_1_2, -1, 2, 0},
59 { 3, s_1_3, -1, 1, 0},
60 { 2, s_1_4, -1, 1, 0},
61 { 1, s_1_5, -1, 3, 0},
62 { 2, s_1_6, 5, 2, 0}
63 };
64 
65 static const symbol s_2_0[2] = { 'e', 'n' };
66 static const symbol s_2_1[2] = { 'e', 'r' };
67 static const symbol s_2_2[2] = { 's', 't' };
68 static const symbol s_2_3[3] = { 'e', 's', 't' };
69 
70 static const struct among a_2[4] =
71 {
72 { 2, s_2_0, -1, 1, 0},
73 { 2, s_2_1, -1, 1, 0},
74 { 2, s_2_2, -1, 2, 0},
75 { 3, s_2_3, 2, 1, 0}
76 };
77 
78 static const symbol s_3_0[2] = { 'i', 'g' };
79 static const symbol s_3_1[4] = { 'l', 'i', 'c', 'h' };
80 
81 static const struct among a_3[2] =
82 {
83 { 2, s_3_0, -1, 1, 0},
84 { 4, s_3_1, -1, 1, 0}
85 };
86 
87 static const symbol s_4_0[3] = { 'e', 'n', 'd' };
88 static const symbol s_4_1[2] = { 'i', 'g' };
89 static const symbol s_4_2[3] = { 'u', 'n', 'g' };
90 static const symbol s_4_3[4] = { 'l', 'i', 'c', 'h' };
91 static const symbol s_4_4[4] = { 'i', 's', 'c', 'h' };
92 static const symbol s_4_5[2] = { 'i', 'k' };
93 static const symbol s_4_6[4] = { 'h', 'e', 'i', 't' };
94 static const symbol s_4_7[4] = { 'k', 'e', 'i', 't' };
95 
96 static const struct among a_4[8] =
97 {
98 { 3, s_4_0, -1, 1, 0},
99 { 2, s_4_1, -1, 2, 0},
100 { 3, s_4_2, -1, 1, 0},
101 { 4, s_4_3, -1, 3, 0},
102 { 4, s_4_4, -1, 2, 0},
103 { 2, s_4_5, -1, 2, 0},
104 { 4, s_4_6, -1, 3, 0},
105 { 4, s_4_7, -1, 4, 0}
106 };
107 
108 static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32, 8 };
109 
110 static const unsigned char g_s_ending[] = { 117, 30, 5 };
111 
112 static const unsigned char g_st_ending[] = { 117, 30, 4 };
113 
114 static const symbol s_0[] = { 0xC3, 0x9F };
115 static const symbol s_1[] = { 's', 's' };
116 static const symbol s_2[] = { 'U' };
117 static const symbol s_3[] = { 'Y' };
118 static const symbol s_4[] = { 'y' };
119 static const symbol s_5[] = { 'u' };
120 static const symbol s_6[] = { 'a' };
121 static const symbol s_7[] = { 'o' };
122 static const symbol s_8[] = { 'n', 'i', 's' };
123 static const symbol s_9[] = { 'i', 'g' };
124 static const symbol s_10[] = { 'e', 'r' };
125 static const symbol s_11[] = { 'e', 'n' };
126 
127 static int r_prelude(struct SN_env * z) {
128  { int c_test1 = z->c;
129  while(1) {
130  int c2 = z->c;
131  { int c3 = z->c;
132  z->bra = z->c;
133  if (!(eq_s(z, 2, s_0))) goto lab2;
134  z->ket = z->c;
135  { int ret = slice_from_s(z, 2, s_1);
136  if (ret < 0) return ret;
137  }
138  goto lab1;
139  lab2:
140  z->c = c3;
141  { int ret = skip_utf8(z->p, z->c, z->l, 1);
142  if (ret < 0) goto lab0;
143  z->c = ret;
144  }
145  }
146  lab1:
147  continue;
148  lab0:
149  z->c = c2;
150  break;
151  }
152  z->c = c_test1;
153  }
154  while(1) {
155  int c4 = z->c;
156  while(1) {
157  int c5 = z->c;
158  if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab4;
159  z->bra = z->c;
160  { int c6 = z->c;
161  if (z->c == z->l || z->p[z->c] != 'u') goto lab6;
162  z->c++;
163  z->ket = z->c;
164  if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab6;
165  { int ret = slice_from_s(z, 1, s_2);
166  if (ret < 0) return ret;
167  }
168  goto lab5;
169  lab6:
170  z->c = c6;
171  if (z->c == z->l || z->p[z->c] != 'y') goto lab4;
172  z->c++;
173  z->ket = z->c;
174  if (in_grouping_U(z, g_v, 97, 252, 0)) goto lab4;
175  { int ret = slice_from_s(z, 1, s_3);
176  if (ret < 0) return ret;
177  }
178  }
179  lab5:
180  z->c = c5;
181  break;
182  lab4:
183  z->c = c5;
184  { int ret = skip_utf8(z->p, z->c, z->l, 1);
185  if (ret < 0) goto lab3;
186  z->c = ret;
187  }
188  }
189  continue;
190  lab3:
191  z->c = c4;
192  break;
193  }
194  return 1;
195 }
196 
197 static int r_mark_regions(struct SN_env * z) {
198  z->I[2] = z->l;
199  z->I[1] = z->l;
200  { int c_test1 = z->c;
201  { int ret = skip_utf8(z->p, z->c, z->l, 3);
202  if (ret < 0) return 0;
203  z->c = ret;
204  }
205  z->I[0] = z->c;
206  z->c = c_test1;
207  }
208  {
209  int ret = out_grouping_U(z, g_v, 97, 252, 1);
210  if (ret < 0) return 0;
211  z->c += ret;
212  }
213  {
214  int ret = in_grouping_U(z, g_v, 97, 252, 1);
215  if (ret < 0) return 0;
216  z->c += ret;
217  }
218  z->I[2] = z->c;
219 
220  if (!(z->I[2] < z->I[0])) goto lab0;
221  z->I[2] = z->I[0];
222 lab0:
223  {
224  int ret = out_grouping_U(z, g_v, 97, 252, 1);
225  if (ret < 0) return 0;
226  z->c += ret;
227  }
228  {
229  int ret = in_grouping_U(z, g_v, 97, 252, 1);
230  if (ret < 0) return 0;
231  z->c += ret;
232  }
233  z->I[1] = z->c;
234  return 1;
235 }
236 
237 static int r_postlude(struct SN_env * z) {
238  int among_var;
239  while(1) {
240  int c1 = z->c;
241  z->bra = z->c;
242  among_var = find_among(z, a_0, 6);
243  if (!(among_var)) goto lab0;
244  z->ket = z->c;
245  switch (among_var) {
246  case 1:
247  { int ret = slice_from_s(z, 1, s_4);
248  if (ret < 0) return ret;
249  }
250  break;
251  case 2:
252  { int ret = slice_from_s(z, 1, s_5);
253  if (ret < 0) return ret;
254  }
255  break;
256  case 3:
257  { int ret = slice_from_s(z, 1, s_6);
258  if (ret < 0) return ret;
259  }
260  break;
261  case 4:
262  { int ret = slice_from_s(z, 1, s_7);
263  if (ret < 0) return ret;
264  }
265  break;
266  case 5:
267  { int ret = skip_utf8(z->p, z->c, z->l, 1);
268  if (ret < 0) goto lab0;
269  z->c = ret;
270  }
271  break;
272  }
273  continue;
274  lab0:
275  z->c = c1;
276  break;
277  }
278  return 1;
279 }
280 
281 static int r_R1(struct SN_env * z) {
282  if (!(z->I[2] <= z->c)) return 0;
283  return 1;
284 }
285 
286 static int r_R2(struct SN_env * z) {
287  if (!(z->I[1] <= z->c)) return 0;
288  return 1;
289 }
290 
291 static int r_standard_suffix(struct SN_env * z) {
292  int among_var;
293  { int m1 = z->l - z->c; (void)m1;
294  z->ket = z->c;
295  if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((811040 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab0;
296  among_var = find_among_b(z, a_1, 7);
297  if (!(among_var)) goto lab0;
298  z->bra = z->c;
299  { int ret = r_R1(z);
300  if (ret == 0) goto lab0;
301  if (ret < 0) return ret;
302  }
303  switch (among_var) {
304  case 1:
305  { int ret = slice_del(z);
306  if (ret < 0) return ret;
307  }
308  break;
309  case 2:
310  { int ret = slice_del(z);
311  if (ret < 0) return ret;
312  }
313  { int m2 = z->l - z->c; (void)m2;
314  z->ket = z->c;
315  if (z->c <= z->lb || z->p[z->c - 1] != 's') { z->c = z->l - m2; goto lab1; }
316  z->c--;
317  z->bra = z->c;
318  if (!(eq_s_b(z, 3, s_8))) { z->c = z->l - m2; goto lab1; }
319  { int ret = slice_del(z);
320  if (ret < 0) return ret;
321  }
322  lab1:
323  ;
324  }
325  break;
326  case 3:
327  if (in_grouping_b_U(z, g_s_ending, 98, 116, 0)) goto lab0;
328  { int ret = slice_del(z);
329  if (ret < 0) return ret;
330  }
331  break;
332  }
333  lab0:
334  z->c = z->l - m1;
335  }
336  { int m3 = z->l - z->c; (void)m3;
337  z->ket = z->c;
338  if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1327104 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab2;
339  among_var = find_among_b(z, a_2, 4);
340  if (!(among_var)) goto lab2;
341  z->bra = z->c;
342  { int ret = r_R1(z);
343  if (ret == 0) goto lab2;
344  if (ret < 0) return ret;
345  }
346  switch (among_var) {
347  case 1:
348  { int ret = slice_del(z);
349  if (ret < 0) return ret;
350  }
351  break;
352  case 2:
353  if (in_grouping_b_U(z, g_st_ending, 98, 116, 0)) goto lab2;
354  { int ret = skip_b_utf8(z->p, z->c, z->lb, 3);
355  if (ret < 0) goto lab2;
356  z->c = ret;
357  }
358  { int ret = slice_del(z);
359  if (ret < 0) return ret;
360  }
361  break;
362  }
363  lab2:
364  z->c = z->l - m3;
365  }
366  { int m4 = z->l - z->c; (void)m4;
367  z->ket = z->c;
368  if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1051024 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab3;
369  among_var = find_among_b(z, a_4, 8);
370  if (!(among_var)) goto lab3;
371  z->bra = z->c;
372  { int ret = r_R2(z);
373  if (ret == 0) goto lab3;
374  if (ret < 0) return ret;
375  }
376  switch (among_var) {
377  case 1:
378  { int ret = slice_del(z);
379  if (ret < 0) return ret;
380  }
381  { int m5 = z->l - z->c; (void)m5;
382  z->ket = z->c;
383  if (!(eq_s_b(z, 2, s_9))) { z->c = z->l - m5; goto lab4; }
384  z->bra = z->c;
385  { int m6 = z->l - z->c; (void)m6;
386  if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab5;
387  z->c--;
388  { z->c = z->l - m5; goto lab4; }
389  lab5:
390  z->c = z->l - m6;
391  }
392  { int ret = r_R2(z);
393  if (ret == 0) { z->c = z->l - m5; goto lab4; }
394  if (ret < 0) return ret;
395  }
396  { int ret = slice_del(z);
397  if (ret < 0) return ret;
398  }
399  lab4:
400  ;
401  }
402  break;
403  case 2:
404  { int m7 = z->l - z->c; (void)m7;
405  if (z->c <= z->lb || z->p[z->c - 1] != 'e') goto lab6;
406  z->c--;
407  goto lab3;
408  lab6:
409  z->c = z->l - m7;
410  }
411  { int ret = slice_del(z);
412  if (ret < 0) return ret;
413  }
414  break;
415  case 3:
416  { int ret = slice_del(z);
417  if (ret < 0) return ret;
418  }
419  { int m8 = z->l - z->c; (void)m8;
420  z->ket = z->c;
421  { int m9 = z->l - z->c; (void)m9;
422  if (!(eq_s_b(z, 2, s_10))) goto lab9;
423  goto lab8;
424  lab9:
425  z->c = z->l - m9;
426  if (!(eq_s_b(z, 2, s_11))) { z->c = z->l - m8; goto lab7; }
427  }
428  lab8:
429  z->bra = z->c;
430  { int ret = r_R1(z);
431  if (ret == 0) { z->c = z->l - m8; goto lab7; }
432  if (ret < 0) return ret;
433  }
434  { int ret = slice_del(z);
435  if (ret < 0) return ret;
436  }
437  lab7:
438  ;
439  }
440  break;
441  case 4:
442  { int ret = slice_del(z);
443  if (ret < 0) return ret;
444  }
445  { int m10 = z->l - z->c; (void)m10;
446  z->ket = z->c;
447  if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 103 && z->p[z->c - 1] != 104)) { z->c = z->l - m10; goto lab10; }
448  if (!(find_among_b(z, a_3, 2))) { z->c = z->l - m10; goto lab10; }
449  z->bra = z->c;
450  { int ret = r_R2(z);
451  if (ret == 0) { z->c = z->l - m10; goto lab10; }
452  if (ret < 0) return ret;
453  }
454  { int ret = slice_del(z);
455  if (ret < 0) return ret;
456  }
457  lab10:
458  ;
459  }
460  break;
461  }
462  lab3:
463  z->c = z->l - m4;
464  }
465  return 1;
466 }
467 
468 extern int german_UTF_8_stem(struct SN_env * z) {
469  { int c1 = z->c;
470  { int ret = r_prelude(z);
471  if (ret < 0) return ret;
472  }
473  z->c = c1;
474  }
475  { int c2 = z->c;
476  { int ret = r_mark_regions(z);
477  if (ret < 0) return ret;
478  }
479  z->c = c2;
480  }
481  z->lb = z->c; z->c = z->l;
482 
483 
484  { int ret = r_standard_suffix(z);
485  if (ret < 0) return ret;
486  }
487  z->c = z->lb;
488  { int c3 = z->c;
489  { int ret = r_postlude(z);
490  if (ret < 0) return ret;
491  }
492  z->c = c3;
493  }
494  return 1;
495 }
496 
497 extern struct SN_env * german_UTF_8_create_env(void) { return SN_create_env(0, 3); }
498 
499 extern void german_UTF_8_close_env(struct SN_env * z) { SN_close_env(z, 0); }
500 
struct SN_env * SN_create_env(int S_size, int I_size)
Definition: api.c:3
void SN_close_env(struct SN_env *z, int S_size)
Definition: api.c:34
unsigned char symbol
Definition: api.h:2
static const symbol s_2[]
static const symbol s_0_4[2]
static const struct among a_3[2]
static const symbol s_4_7[4]
static const symbol s_2_2[2]
static const symbol s_0_5[2]
static const symbol s_4[]
static const symbol s_1_6[2]
static const symbol s_4_6[4]
static const symbol s_1_2[2]
static const symbol s_4_3[4]
static const symbol s_0_2[1]
static int r_standard_suffix(struct SN_env *z)
static const struct among a_1[7]
static const symbol s_2_3[3]
static const symbol s_4_1[2]
static const symbol s_4_4[4]
static const symbol s_2_0[2]
static const unsigned char g_st_ending[]
static const symbol s_6[]
static const symbol s_3[]
static const symbol s_3_0[2]
static int r_R2(struct SN_env *z)
static const symbol s_7[]
static const symbol s_1_1[2]
int german_UTF_8_stem(struct SN_env *z)
void german_UTF_8_close_env(struct SN_env *z)
static const symbol s_1_5[1]
static const symbol s_1_3[3]
static int r_R1(struct SN_env *z)
static int r_postlude(struct SN_env *z)
static const struct among a_4[8]
static int r_prelude(struct SN_env *z)
static const symbol s_10[]
static const struct among a_2[4]
static const symbol s_1[]
static const struct among a_0[6]
static const symbol s_3_1[4]
static const symbol s_1_4[2]
static const symbol s_1_0[1]
static int r_mark_regions(struct SN_env *z)
static const symbol s_11[]
static const symbol s_0_1[1]
struct SN_env * german_UTF_8_create_env(void)
static const symbol s_0_3[2]
static const symbol s_2_1[2]
static const unsigned char g_v[]
static const unsigned char g_s_ending[]
static const symbol s_8[]
static const symbol s_9[]
static const symbol s_5[]
static const symbol s_4_2[3]
static const symbol s_4_0[3]
static const symbol s_4_5[2]
static const symbol s_0[]
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
int find_among_b(struct SN_env *z, const struct among *v, int v_size)
Definition: utilities.c:298
int out_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:141
int slice_del(struct SN_env *z)
Definition: utilities.c:431
int in_grouping_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:117
int eq_s(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.c:215
int in_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.c:129
int skip_b_utf8(const symbol *p, int c, int limit, int n)
Definition: utilities.c:52
int eq_s_b(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.c:220
int find_among(struct SN_env *z, const struct among *v, int v_size)
Definition: utilities.c:233
int skip_utf8(const symbol *p, int c, int limit, int n)
Definition: utilities.c:27
int slice_from_s(struct SN_env *z, int s_size, const symbol *s)
Definition: utilities.c:422