xapian-core  1.4.29
danish.cc
Go to the documentation of this file.
1 /* Generated by Snowball 2.0.0 - https://snowballstem.org/ */
2 
3 
4 #include <config.h>
5 #include <limits.h>
6 #include "danish.h"
7 
8 #define s_0_0 (s_0_1 + 2)
9 static const symbol s_pool[] = {
10 #define s_0_1 0
11 'e', 't', 'h', 'e', 'd',
12 #define s_0_2 s_0_4
13 #define s_0_3 (s_0_0 + 1)
14 #define s_0_4 5
15 'e', 'r', 'e', 'd', 'e',
16 #define s_0_5 (s_0_6 + 2)
17 #define s_0_6 s_0_20
18 #define s_0_7 s_0_21
19 #define s_0_8 s_0_22
20 #define s_0_9 s_0_2
21 #define s_0_10 s_0_5
22 #define s_0_11 s_0_25
23 #define s_0_12 s_0_6
24 #define s_0_13 s_0_2
25 #define s_0_14 10
26 'h', 'e', 'd', 'e', 'r',
27 #define s_0_15 15
28 'e', 'r', 'e', 'r',
29 #define s_0_16 (s_0_17 + 3)
30 #define s_0_17 19
31 'h', 'e', 'd', 's',
32 #define s_0_18 (s_0_19 + 3)
33 #define s_0_19 (s_0_20 + 2)
34 #define s_0_20 23
35 'e', 'r', 'e', 'n', 'd', 'e', 's',
36 #define s_0_21 30
37 'e', 'n', 'e', 's',
38 #define s_0_22 34
39 'e', 'r', 'n', 'e', 's',
40 #define s_0_23 39
41 'e', 'r', 'e', 's',
42 #define s_0_24 (s_0_25 + 3)
43 #define s_0_25 43
44 'h', 'e', 'd', 'e', 'n', 's',
45 #define s_0_26 49
46 'e', 'r', 'e', 'n', 's',
47 #define s_0_27 54
48 'e', 'r', 's',
49 #define s_0_28 (s_0_29 + 2)
50 #define s_0_29 57
51 'e', 'r', 'e', 't', 's',
52 #define s_0_30 s_0_1
53 #define s_0_31 s_0_29
54 #define s_1_0 62
55 'g', 'd',
56 #define s_1_1 64
57 'd', 't',
58 #define s_1_2 66
59 'g', 't',
60 #define s_1_3 68
61 'k', 't',
62 #define s_2_0 (s_2_1 + 1)
63 #define s_2_1 (s_2_2 + 1)
64 #define s_2_2 70
65 'e', 'l', 'i', 'g',
66 #define s_2_3 74
67 'e', 'l', 's',
68 #define s_2_4 77
69 'l', 0xC3, 0xB8, 's', 't',
70 };
71 
72 
73 static const struct among a_0[32] =
74 {
75 /* 0 */ { 3, s_0_0, -1, 1},
76 /* 1 */ { 5, s_0_1, 0, 1},
77 /* 2 */ { 4, s_0_2, -1, 1},
78 /* 3 */ { 1, s_0_3, -1, 1},
79 /* 4 */ { 5, s_0_4, 3, 1},
80 /* 5 */ { 4, s_0_5, 3, 1},
81 /* 6 */ { 6, s_0_6, 5, 1},
82 /* 7 */ { 3, s_0_7, 3, 1},
83 /* 8 */ { 4, s_0_8, 3, 1},
84 /* 9 */ { 3, s_0_9, 3, 1},
85 /* 10 */ { 2, s_0_10, -1, 1},
86 /* 11 */ { 5, s_0_11, 10, 1},
87 /* 12 */ { 4, s_0_12, 10, 1},
88 /* 13 */ { 2, s_0_13, -1, 1},
89 /* 14 */ { 5, s_0_14, 13, 1},
90 /* 15 */ { 4, s_0_15, 13, 1},
91 /* 16 */ { 1, s_0_16, -1, 2},
92 /* 17 */ { 4, s_0_17, 16, 1},
93 /* 18 */ { 2, s_0_18, 16, 1},
94 /* 19 */ { 5, s_0_19, 18, 1},
95 /* 20 */ { 7, s_0_20, 19, 1},
96 /* 21 */ { 4, s_0_21, 18, 1},
97 /* 22 */ { 5, s_0_22, 18, 1},
98 /* 23 */ { 4, s_0_23, 18, 1},
99 /* 24 */ { 3, s_0_24, 16, 1},
100 /* 25 */ { 6, s_0_25, 24, 1},
101 /* 26 */ { 5, s_0_26, 24, 1},
102 /* 27 */ { 3, s_0_27, 16, 1},
103 /* 28 */ { 3, s_0_28, 16, 1},
104 /* 29 */ { 5, s_0_29, 28, 1},
105 /* 30 */ { 2, s_0_30, -1, 1},
106 /* 31 */ { 4, s_0_31, 30, 1}
107 };
108 
109 
110 static const struct among a_1[4] =
111 {
112 /* 0 */ { 2, s_1_0, -1, -1},
113 /* 1 */ { 2, s_1_1, -1, -1},
114 /* 2 */ { 2, s_1_2, -1, -1},
115 /* 3 */ { 2, s_1_3, -1, -1}
116 };
117 
118 
119 static const struct among a_2[5] =
120 {
121 /* 0 */ { 2, s_2_0, -1, 1},
122 /* 1 */ { 3, s_2_1, 0, 1},
123 /* 2 */ { 4, s_2_2, 1, 1},
124 /* 3 */ { 3, s_2_3, -1, 1},
125 /* 4 */ { 5, s_2_4, -1, 2}
126 };
127 
128 static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 };
129 
130 static const unsigned char g_s_ending[] = { 239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 };
131 
132 static const symbol s_0[] = { 's', 't' };
133 static const symbol s_1[] = { 'i', 'g' };
134 static const symbol s_2[] = { 'l', 0xC3, 0xB8, 's' };
135 
137  I_p1 = l;
138  { int c_test1 = c;
139  { int ret = skip_utf8(p, c, 0, l, + 3);
140  if (ret < 0) return 0;
141  c = ret;
142  }
143  I_x = c;
144  c = c_test1;
145  }
146  {
147  int ret = out_grouping_U(g_v, 97, 248, 1);
148  if (ret < 0) return 0;
149  c += ret;
150  }
151  {
152  int ret = in_grouping_U(g_v, 97, 248, 1);
153  if (ret < 0) return 0;
154  c += ret;
155  }
156  I_p1 = c;
157 
158  if (!(I_p1 < I_x)) goto lab0;
159  I_p1 = I_x;
160 lab0:
161  return 1;
162 }
163 
165  int among_var;
166 
167  { int mlimit1;
168  if (c < I_p1) return 0;
169  mlimit1 = lb; lb = I_p1;
170  ket = c;
171  if (c <= lb || p[c - 1] >> 5 != 3 || !((1851440 >> (p[c - 1] & 0x1f)) & 1)) { lb = mlimit1; return 0; }
172  among_var = find_among_b(s_pool, a_0, 32, 0, 0);
173  if (!(among_var)) { lb = mlimit1; return 0; }
174  bra = c;
175  lb = mlimit1;
176  }
177  switch (among_var) {
178  case 1:
179  { int ret = slice_del();
180  if (ret < 0) return ret;
181  }
182  break;
183  case 2:
184  if (in_grouping_b_U(g_s_ending, 97, 229, 0)) return 0;
185  { int ret = slice_del();
186  if (ret < 0) return ret;
187  }
188  break;
189  }
190  return 1;
191 }
192 
194  { int m_test1 = l - c;
195 
196  { int mlimit2;
197  if (c < I_p1) return 0;
198  mlimit2 = lb; lb = I_p1;
199  ket = c;
200  if (c - 1 <= lb || (p[c - 1] != 100 && p[c - 1] != 116)) { lb = mlimit2; return 0; }
201  if (!(find_among_b(s_pool, a_1, 4, 0, 0))) { lb = mlimit2; return 0; }
202  bra = c;
203  lb = mlimit2;
204  }
205  c = l - m_test1;
206  }
207  { int ret = skip_utf8(p, c, lb, 0, -1);
208  if (ret < 0) return 0;
209  c = ret;
210  }
211  bra = c;
212  { int ret = slice_del();
213  if (ret < 0) return ret;
214  }
215  return 1;
216 }
217 
219  int among_var;
220  { int m1 = l - c; (void)m1;
221  ket = c;
222  if (!(eq_s_b(2, s_0))) goto lab0;
223  bra = c;
224  if (!(eq_s_b(2, s_1))) goto lab0;
225  { int ret = slice_del();
226  if (ret < 0) return ret;
227  }
228  lab0:
229  c = l - m1;
230  }
231 
232  { int mlimit2;
233  if (c < I_p1) return 0;
234  mlimit2 = lb; lb = I_p1;
235  ket = c;
236  if (c - 1 <= lb || p[c - 1] >> 5 != 3 || !((1572992 >> (p[c - 1] & 0x1f)) & 1)) { lb = mlimit2; return 0; }
237  among_var = find_among_b(s_pool, a_2, 5, 0, 0);
238  if (!(among_var)) { lb = mlimit2; return 0; }
239  bra = c;
240  lb = mlimit2;
241  }
242  switch (among_var) {
243  case 1:
244  { int ret = slice_del();
245  if (ret < 0) return ret;
246  }
247  { int m3 = l - c; (void)m3;
248  { int ret = r_consonant_pair();
249  if (ret < 0) return ret;
250  }
251  c = l - m3;
252  }
253  break;
254  case 2:
255  { int ret = slice_from_s(4, s_2);
256  if (ret < 0) return ret;
257  }
258  break;
259  }
260  return 1;
261 }
262 
264 
265  { int mlimit1;
266  if (c < I_p1) return 0;
267  mlimit1 = lb; lb = I_p1;
268  ket = c;
269  if (out_grouping_b_U(g_v, 97, 248, 0)) { lb = mlimit1; return 0; }
270  bra = c;
271  { symbol * ret = slice_to(S_ch);
272  if (ret == 0) return -1;
273  S_ch = ret;
274  }
275  lb = mlimit1;
276  }
277  if (!(eq_v_b(S_ch))) return 0;
278  { int ret = slice_del();
279  if (ret < 0) return ret;
280  }
281  return 1;
282 }
283 
285  { int c1 = c;
286  { int ret = r_mark_regions();
287  if (ret < 0) return ret;
288  }
289  c = c1;
290  }
291  lb = c; c = l;
292 
293  { int m2 = l - c; (void)m2;
294  { int ret = r_main_suffix();
295  if (ret < 0) return ret;
296  }
297  c = l - m2;
298  }
299  { int m3 = l - c; (void)m3;
300  { int ret = r_consonant_pair();
301  if (ret < 0) return ret;
302  }
303  c = l - m3;
304  }
305  { int m4 = l - c; (void)m4;
306  { int ret = r_other_suffix();
307  if (ret < 0) return ret;
308  }
309  c = l - m4;
310  }
311  { int m5 = l - c; (void)m5;
312  { int ret = r_undouble();
313  if (ret < 0) return ret;
314  }
315  c = l - m5;
316  }
317  c = lb;
318  return 1;
319 }
320 
322  : I_x(0), I_p1(0), S_ch(0)
323 {
324  S_ch = create_s();
325 }
326 
328 {
329  lose_s(S_ch);
330 }
331 
332 std::string
334 {
335  return "danish";
336 }
#define s_0_18
static const symbol s_1[]
Definition: danish.cc:133
#define s_0_27
#define s_0_2
#define s_0_6
int find_among_b(const symbol *pool, const struct among *v, int v_size, const unsigned char *fnum, const among_function *f)
static const unsigned char g_v[]
Definition: danish.cc:128
int eq_s_b(int s_size, const symbol *s)
#define s_0_30
int stem()
Virtual method implemented by the subclass to actually do the work.
Definition: danish.cc:284
#define s_0_21
#define s_1_1
#define s_1_3
#define s_1_0
static const symbol s_pool[]
Definition: danish.cc:9
#define s_0_19
#define s_2_0
#define s_0_3
#define s_0_1
int slice_from_s(int s_size, const symbol *s)
#define s_0_14
#define s_0_10
#define s_0_26
#define s_2_4
#define s_0_25
#define s_0_24
unsigned short symbol
Definition: header.h:6
#define s_0_28
static const symbol s_2[]
Definition: danish.cc:134
#define s_0_29
static const struct among a_2[5]
Definition: danish.cc:119
Definition: header.h:191
#define s_0_4
#define s_0_7
#define s_0_22
#define s_2_3
#define s_2_2
#define s_0_23
static int skip_utf8(const symbol *p, int c, int lb, int l, int n)
Definition: steminternal.cc:94
#define s_0_20
#define s_0_13
int in_grouping_b_U(const unsigned char *s, int min, int max, int repeat)
std::string get_description() const
Return a string describing this object.
Definition: danish.cc:333
#define s_0_9
#define s_0_8
#define s_0_5
#define s_0_31
#define s_1_2
static const struct among a_1[4]
Definition: danish.cc:110
#define s_0_12
int out_grouping_b_U(const unsigned char *s, int min, int max, int repeat)
#define s_0_17
#define s_0_0
Definition: danish.cc:8
#define s_0_11
int out_grouping_U(const unsigned char *s, int min, int max, int repeat)
static const symbol s_0[]
Definition: danish.cc:132
static const unsigned char g_s_ending[]
Definition: danish.cc:130
#define s_2_1
static const struct among a_0[32]
Definition: danish.cc:73
#define s_0_15
void lose_s(symbol *p)
Definition: steminternal.h:45
#define s_0_16
int in_grouping_U(const unsigned char *s, int min, int max, int repeat)