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