xapian-core  1.4.26
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  if (out_grouping_U(g_v, 97, 248, 1) < 0) return 0;
147  {
148  int ret = in_grouping_U(g_v, 97, 248, 1);
149  if (ret < 0) return 0;
150  c += ret;
151  }
152  I_p1 = c;
153 
154  if (!(I_p1 < I_x)) goto lab0;
155  I_p1 = I_x;
156 lab0:
157  return 1;
158 }
159 
161  int among_var;
162 
163  { int mlimit1;
164  if (c < I_p1) return 0;
165  mlimit1 = lb; lb = I_p1;
166  ket = c;
167  if (c <= lb || p[c - 1] >> 5 != 3 || !((1851440 >> (p[c - 1] & 0x1f)) & 1)) { lb = mlimit1; return 0; }
168  among_var = find_among_b(s_pool, a_0, 32, 0, 0);
169  if (!(among_var)) { lb = mlimit1; return 0; }
170  bra = c;
171  lb = mlimit1;
172  }
173  switch (among_var) {
174  case 1:
175  { int ret = slice_del();
176  if (ret < 0) return ret;
177  }
178  break;
179  case 2:
180  if (in_grouping_b_U(g_s_ending, 97, 229, 0)) return 0;
181  { int ret = slice_del();
182  if (ret < 0) return ret;
183  }
184  break;
185  }
186  return 1;
187 }
188 
190  { int m_test1 = l - c;
191 
192  { int mlimit2;
193  if (c < I_p1) return 0;
194  mlimit2 = lb; lb = I_p1;
195  ket = c;
196  if (c - 1 <= lb || (p[c - 1] != 100 && p[c - 1] != 116)) { lb = mlimit2; return 0; }
197  if (!(find_among_b(s_pool, a_1, 4, 0, 0))) { lb = mlimit2; return 0; }
198  bra = c;
199  lb = mlimit2;
200  }
201  c = l - m_test1;
202  }
203  { int ret = skip_utf8(p, c, lb, 0, -1);
204  if (ret < 0) return 0;
205  c = ret;
206  }
207  bra = c;
208  { int ret = slice_del();
209  if (ret < 0) return ret;
210  }
211  return 1;
212 }
213 
215  int among_var;
216  { int m1 = l - c; (void)m1;
217  ket = c;
218  if (!(eq_s_b(2, s_0))) goto lab0;
219  bra = c;
220  if (!(eq_s_b(2, s_1))) goto lab0;
221  { int ret = slice_del();
222  if (ret < 0) return ret;
223  }
224  lab0:
225  c = l - m1;
226  }
227 
228  { int mlimit2;
229  if (c < I_p1) return 0;
230  mlimit2 = lb; lb = I_p1;
231  ket = c;
232  if (c - 1 <= lb || p[c - 1] >> 5 != 3 || !((1572992 >> (p[c - 1] & 0x1f)) & 1)) { lb = mlimit2; return 0; }
233  among_var = find_among_b(s_pool, a_2, 5, 0, 0);
234  if (!(among_var)) { lb = mlimit2; return 0; }
235  bra = c;
236  lb = mlimit2;
237  }
238  switch (among_var) {
239  case 1:
240  { int ret = slice_del();
241  if (ret < 0) return ret;
242  }
243  { int m3 = l - c; (void)m3;
244  { int ret = r_consonant_pair();
245  if (ret < 0) return ret;
246  }
247  c = l - m3;
248  }
249  break;
250  case 2:
251  { int ret = slice_from_s(4, s_2);
252  if (ret < 0) return ret;
253  }
254  break;
255  }
256  return 1;
257 }
258 
260 
261  { int mlimit1;
262  if (c < I_p1) return 0;
263  mlimit1 = lb; lb = I_p1;
264  ket = c;
265  if (out_grouping_b_U(g_v, 97, 248, 0)) { lb = mlimit1; return 0; }
266  bra = c;
267  { symbol * ret = slice_to(S_ch);
268  if (ret == 0) return -1;
269  S_ch = ret;
270  }
271  lb = mlimit1;
272  }
273  if (!(eq_v_b(S_ch))) return 0;
274  { int ret = slice_del();
275  if (ret < 0) return ret;
276  }
277  return 1;
278 }
279 
281  { int c1 = c;
282  { int ret = r_mark_regions();
283  if (ret < 0) return ret;
284  }
285  c = c1;
286  }
287  lb = c; c = l;
288 
289  { int m2 = l - c; (void)m2;
290  { int ret = r_main_suffix();
291  if (ret < 0) return ret;
292  }
293  c = l - m2;
294  }
295  { int m3 = l - c; (void)m3;
296  { int ret = r_consonant_pair();
297  if (ret < 0) return ret;
298  }
299  c = l - m3;
300  }
301  { int m4 = l - c; (void)m4;
302  { int ret = r_other_suffix();
303  if (ret < 0) return ret;
304  }
305  c = l - m4;
306  }
307  { int m5 = l - c; (void)m5;
308  { int ret = r_undouble();
309  if (ret < 0) return ret;
310  }
311  c = l - m5;
312  }
313  c = lb;
314  return 1;
315 }
316 
318  : I_x(0), I_p1(0), S_ch(0)
319 {
320  S_ch = create_s();
321 }
322 
324 {
325  lose_s(S_ch);
326 }
327 
328 std::string
330 {
331  return "danish";
332 }
#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:280
#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:329
#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)