xapian-core  2.0.0
swedish.cc
Go to the documentation of this file.
1 /* Generated from swedish.sbl by Snowball 3.0.0 - https://snowballstem.org/ */
2 
3 #include <config.h>
4 
5 #define SNOWBALL_RUNTIME_THROW_EXCEPTIONS
6 #include "swedish.h"
7 
8 #include <stddef.h>
9 
11 
12 static int r_other_suffix(struct SN_env * z);
13 static int r_consonant_pair(struct SN_env * z);
14 static int r_main_suffix(struct SN_env * z);
15 static int r_mark_regions(struct SN_env * z);
16 static int r_et_condition(struct SN_env * z);
17 
18 static const symbol s_0[] = { 'e', 't' };
19 static const symbol s_1[] = { 0xC3, 0xB6, 's' };
20 static const symbol s_2[] = { 'f', 'u', 'l', 'l' };
21 
22 static const symbol s_0_0[3] = { 'f', 'a', 'b' };
23 static const symbol s_0_1[1] = { 'h' };
24 static const symbol s_0_2[3] = { 'p', 'a', 'k' };
25 static const symbol s_0_3[3] = { 'r', 'a', 'k' };
26 static const symbol s_0_4[4] = { 's', 't', 'a', 'k' };
27 static const symbol s_0_5[3] = { 'k', 'o', 'm' };
28 static const symbol s_0_6[3] = { 'i', 'e', 't' };
29 static const symbol s_0_7[3] = { 'c', 'i', 't' };
30 static const symbol s_0_8[3] = { 'd', 'i', 't' };
31 static const symbol s_0_9[4] = { 'a', 'l', 'i', 't' };
32 static const symbol s_0_10[4] = { 'i', 'l', 'i', 't' };
33 static const symbol s_0_11[3] = { 'm', 'i', 't' };
34 static const symbol s_0_12[3] = { 'n', 'i', 't' };
35 static const symbol s_0_13[3] = { 'p', 'i', 't' };
36 static const symbol s_0_14[3] = { 'r', 'i', 't' };
37 static const symbol s_0_15[3] = { 's', 'i', 't' };
38 static const symbol s_0_16[3] = { 't', 'i', 't' };
39 static const symbol s_0_17[3] = { 'u', 'i', 't' };
40 static const symbol s_0_18[4] = { 'i', 'v', 'i', 't' };
41 static const symbol s_0_19[4] = { 'k', 'v', 'i', 't' };
42 static const symbol s_0_20[3] = { 'x', 'i', 't' };
43 static const struct among a_0[21] = {
44 { 3, s_0_0, 0, -1, 0},
45 { 1, s_0_1, 0, -1, 0},
46 { 3, s_0_2, 0, -1, 0},
47 { 3, s_0_3, 0, -1, 0},
48 { 4, s_0_4, 0, -1, 0},
49 { 3, s_0_5, 0, -1, 0},
50 { 3, s_0_6, 0, -1, 0},
51 { 3, s_0_7, 0, -1, 0},
52 { 3, s_0_8, 0, -1, 0},
53 { 4, s_0_9, 0, -1, 0},
54 { 4, s_0_10, 0, -1, 0},
55 { 3, s_0_11, 0, -1, 0},
56 { 3, s_0_12, 0, -1, 0},
57 { 3, s_0_13, 0, -1, 0},
58 { 3, s_0_14, 0, -1, 0},
59 { 3, s_0_15, 0, -1, 0},
60 { 3, s_0_16, 0, -1, 0},
61 { 3, s_0_17, 0, -1, 0},
62 { 4, s_0_18, 0, -1, 0},
63 { 4, s_0_19, 0, -1, 0},
64 { 3, s_0_20, 0, -1, 0}
65 };
66 
67 static const symbol s_1_0[1] = { 'a' };
68 static const symbol s_1_1[4] = { 'a', 'r', 'n', 'a' };
69 static const symbol s_1_2[4] = { 'e', 'r', 'n', 'a' };
70 static const symbol s_1_3[7] = { 'h', 'e', 't', 'e', 'r', 'n', 'a' };
71 static const symbol s_1_4[4] = { 'o', 'r', 'n', 'a' };
72 static const symbol s_1_5[2] = { 'a', 'd' };
73 static const symbol s_1_6[1] = { 'e' };
74 static const symbol s_1_7[3] = { 'a', 'd', 'e' };
75 static const symbol s_1_8[4] = { 'a', 'n', 'd', 'e' };
76 static const symbol s_1_9[4] = { 'a', 'r', 'n', 'e' };
77 static const symbol s_1_10[3] = { 'a', 'r', 'e' };
78 static const symbol s_1_11[4] = { 'a', 's', 't', 'e' };
79 static const symbol s_1_12[2] = { 'e', 'n' };
80 static const symbol s_1_13[5] = { 'a', 'n', 'd', 'e', 'n' };
81 static const symbol s_1_14[4] = { 'a', 'r', 'e', 'n' };
82 static const symbol s_1_15[5] = { 'h', 'e', 't', 'e', 'n' };
83 static const symbol s_1_16[3] = { 'e', 'r', 'n' };
84 static const symbol s_1_17[2] = { 'a', 'r' };
85 static const symbol s_1_18[2] = { 'e', 'r' };
86 static const symbol s_1_19[5] = { 'h', 'e', 't', 'e', 'r' };
87 static const symbol s_1_20[2] = { 'o', 'r' };
88 static const symbol s_1_21[1] = { 's' };
89 static const symbol s_1_22[2] = { 'a', 's' };
90 static const symbol s_1_23[5] = { 'a', 'r', 'n', 'a', 's' };
91 static const symbol s_1_24[5] = { 'e', 'r', 'n', 'a', 's' };
92 static const symbol s_1_25[5] = { 'o', 'r', 'n', 'a', 's' };
93 static const symbol s_1_26[2] = { 'e', 's' };
94 static const symbol s_1_27[4] = { 'a', 'd', 'e', 's' };
95 static const symbol s_1_28[5] = { 'a', 'n', 'd', 'e', 's' };
96 static const symbol s_1_29[3] = { 'e', 'n', 's' };
97 static const symbol s_1_30[5] = { 'a', 'r', 'e', 'n', 's' };
98 static const symbol s_1_31[6] = { 'h', 'e', 't', 'e', 'n', 's' };
99 static const symbol s_1_32[4] = { 'e', 'r', 'n', 's' };
100 static const symbol s_1_33[2] = { 'a', 't' };
101 static const symbol s_1_34[2] = { 'e', 't' };
102 static const symbol s_1_35[5] = { 'a', 'n', 'd', 'e', 't' };
103 static const symbol s_1_36[3] = { 'h', 'e', 't' };
104 static const symbol s_1_37[3] = { 'a', 's', 't' };
105 static const struct among a_1[38] = {
106 { 1, s_1_0, 0, 1, 0},
107 { 4, s_1_1, -1, 1, 0},
108 { 4, s_1_2, -2, 1, 0},
109 { 7, s_1_3, -1, 1, 0},
110 { 4, s_1_4, -4, 1, 0},
111 { 2, s_1_5, 0, 1, 0},
112 { 1, s_1_6, 0, 1, 0},
113 { 3, s_1_7, -1, 1, 0},
114 { 4, s_1_8, -2, 1, 0},
115 { 4, s_1_9, -3, 1, 0},
116 { 3, s_1_10, -4, 1, 0},
117 { 4, s_1_11, -5, 1, 0},
118 { 2, s_1_12, 0, 1, 0},
119 { 5, s_1_13, -1, 1, 0},
120 { 4, s_1_14, -2, 1, 0},
121 { 5, s_1_15, -3, 1, 0},
122 { 3, s_1_16, 0, 1, 0},
123 { 2, s_1_17, 0, 1, 0},
124 { 2, s_1_18, 0, 1, 0},
125 { 5, s_1_19, -1, 1, 0},
126 { 2, s_1_20, 0, 1, 0},
127 { 1, s_1_21, 0, 2, 0},
128 { 2, s_1_22, -1, 1, 0},
129 { 5, s_1_23, -1, 1, 0},
130 { 5, s_1_24, -2, 1, 0},
131 { 5, s_1_25, -3, 1, 0},
132 { 2, s_1_26, -5, 1, 0},
133 { 4, s_1_27, -1, 1, 0},
134 { 5, s_1_28, -2, 1, 0},
135 { 3, s_1_29, -8, 1, 0},
136 { 5, s_1_30, -1, 1, 0},
137 { 6, s_1_31, -2, 1, 0},
138 { 4, s_1_32, -11, 1, 0},
139 { 2, s_1_33, 0, 1, 0},
140 { 2, s_1_34, 0, 3, 0},
141 { 5, s_1_35, -1, 1, 0},
142 { 3, s_1_36, -2, 1, 0},
143 { 3, s_1_37, 0, 1, 0}
144 };
145 
146 static const symbol s_2_0[2] = { 'd', 'd' };
147 static const symbol s_2_1[2] = { 'g', 'd' };
148 static const symbol s_2_2[2] = { 'n', 'n' };
149 static const symbol s_2_3[2] = { 'd', 't' };
150 static const symbol s_2_4[2] = { 'g', 't' };
151 static const symbol s_2_5[2] = { 'k', 't' };
152 static const symbol s_2_6[2] = { 't', 't' };
153 static const struct among a_2[7] = {
154 { 2, s_2_0, 0, -1, 0},
155 { 2, s_2_1, 0, -1, 0},
156 { 2, s_2_2, 0, -1, 0},
157 { 2, s_2_3, 0, -1, 0},
158 { 2, s_2_4, 0, -1, 0},
159 { 2, s_2_5, 0, -1, 0},
160 { 2, s_2_6, 0, -1, 0}
161 };
162 
163 static const symbol s_3_0[2] = { 'i', 'g' };
164 static const symbol s_3_1[3] = { 'l', 'i', 'g' };
165 static const symbol s_3_2[3] = { 'e', 'l', 's' };
166 static const symbol s_3_3[5] = { 'f', 'u', 'l', 'l', 't' };
167 static const symbol s_3_4[4] = { 0xC3, 0xB6, 's', 't' };
168 static const struct among a_3[5] = {
169 { 2, s_3_0, 0, 1, 0},
170 { 3, s_3_1, -1, 1, 0},
171 { 3, s_3_2, 0, 1, 0},
172 { 5, s_3_3, 0, 3, 0},
173 { 4, s_3_4, 0, 2, 0}
174 };
175 
176 static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 32 };
177 
178 static const unsigned char g_s_ending[] = { 119, 127, 149 };
179 
180 static const unsigned char g_ost_ending[] = { 173, 58 };
181 
182 static int r_mark_regions(struct SN_env * z) {
183  int i_x;
184  ((SN_local *)z)->i_p1 = z->l;
185  {
186  int v_1 = z->c;
187  {
188  int ret = skip_utf8(z->p, z->c, z->l, 3);
189  if (ret < 0) return 0;
190  z->c = ret;
191  }
192  i_x = z->c;
193  z->c = v_1;
194  }
195  {
196  int ret = out_grouping_U(z, g_v, 97, 246, 1);
197  if (ret < 0) return 0;
198  z->c += ret;
199  }
200  {
201  int ret = in_grouping_U(z, g_v, 97, 246, 1);
202  if (ret < 0) return 0;
203  z->c += ret;
204  }
205  ((SN_local *)z)->i_p1 = z->c;
206  if (((SN_local *)z)->i_p1 >= i_x) goto lab0;
207  ((SN_local *)z)->i_p1 = i_x;
208 lab0:
209  return 1;
210 }
211 
212 static int r_et_condition(struct SN_env * z) {
213  {
214  int v_1 = z->l - z->c;
215  if (out_grouping_b_U(z, g_v, 97, 246, 0)) return 0;
216  if (in_grouping_b_U(z, g_v, 97, 246, 0)) return 0;
217  if (z->c > z->lb) goto lab0;
218  return 0;
219  lab0:
220  z->c = z->l - v_1;
221  {
222  int v_2 = z->l - z->c;
223  if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1059076 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab1;
224  if (!find_among_b(z, a_0, 21, 0)) goto lab1;
225  return 0;
226  lab1:
227  z->c = z->l - v_2;
228  }
229  }
230  return 1;
231 }
232 
233 static int r_main_suffix(struct SN_env * z) {
234  int among_var;
235  {
236  int v_1;
237  if (z->c < ((SN_local *)z)->i_p1) return 0;
238  v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
239  z->ket = z->c;
240  if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851442 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; }
241  among_var = find_among_b(z, a_1, 38, 0);
242  if (!among_var) { z->lb = v_1; return 0; }
243  z->bra = z->c;
244  z->lb = v_1;
245  }
246  switch (among_var) {
247  case 1:
248  slice_del(z);
249  break;
250  case 2:
251  do {
252  int v_2 = z->l - z->c;
253  if (!(eq_s_b(z, 2, s_0))) goto lab0;
254  if (!r_et_condition(z)) goto lab0;
255  z->bra = z->c;
256  break;
257  lab0:
258  z->c = z->l - v_2;
259  if (in_grouping_b_U(z, g_s_ending, 98, 121, 0)) return 0;
260  } while (0);
261  slice_del(z);
262  break;
263  case 3:
264  {
265  int ret = r_et_condition(z);
266  if (ret == 0) return ret;
267  }
268  slice_del(z);
269  break;
270  }
271  return 1;
272 }
273 
274 static int r_consonant_pair(struct SN_env * z) {
275  {
276  int v_1;
277  if (z->c < ((SN_local *)z)->i_p1) return 0;
278  v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
279  {
280  int v_2 = z->l - z->c;
281  if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1064976 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; }
282  if (!find_among_b(z, a_2, 7, 0)) { z->lb = v_1; return 0; }
283  z->c = z->l - v_2;
284  z->ket = z->c;
285  {
286  int ret = skip_b_utf8(z->p, z->c, z->lb, 1);
287  if (ret < 0) { z->lb = v_1; return 0; }
288  z->c = ret;
289  }
290  z->bra = z->c;
291  slice_del(z);
292  }
293  z->lb = v_1;
294  }
295  return 1;
296 }
297 
298 static int r_other_suffix(struct SN_env * z) {
299  int among_var;
300  {
301  int v_1;
302  if (z->c < ((SN_local *)z)->i_p1) return 0;
303  v_1 = z->lb; z->lb = ((SN_local *)z)->i_p1;
304  z->ket = z->c;
305  if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = v_1; return 0; }
306  among_var = find_among_b(z, a_3, 5, 0);
307  if (!among_var) { z->lb = v_1; return 0; }
308  z->bra = z->c;
309  z->lb = v_1;
310  }
311  switch (among_var) {
312  case 1:
313  slice_del(z);
314  break;
315  case 2:
316  if (in_grouping_b_U(z, g_ost_ending, 105, 118, 0)) return 0;
317  slice_from_s(z, 3, s_1);
318  break;
319  case 3:
320  slice_from_s(z, 4, s_2);
321  break;
322  }
323  return 1;
324 }
325 
327  {
328  int v_1 = z->c;
329  r_mark_regions(z);
330  z->c = v_1;
331  }
332  z->lb = z->c; z->c = z->l;
333  {
334  int v_2 = z->l - z->c;
335  r_main_suffix(z);
336  z->c = z->l - v_2;
337  }
338  {
339  int v_3 = z->l - z->c;
340  r_consonant_pair(z);
341  z->c = z->l - v_3;
342  }
343  {
344  int v_4 = z->l - z->c;
345  r_other_suffix(z);
346  z->c = z->l - v_4;
347  }
348  z->c = z->lb;
349  return 1;
350 }
unsigned char symbol
Definition: api.h:4
static int stem(struct SN_env *z)
Definition: swedish.cc:326
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 in_grouping_b_U(struct SN_env *z, const unsigned char *s, int min, int max, int repeat)
Definition: utilities.cc:152
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
Definition: api.h:15
int lb
Definition: api.h:17
symbol * p
Definition: api.h:16
int c
Definition: api.h:17
int bra
Definition: api.h:17
int l
Definition: api.h:17
Definition: header.h:256
static const symbol s_1_5[2]
Definition: swedish.cc:72
static const symbol s_2[]
Definition: swedish.cc:20
static const symbol s_1_7[3]
Definition: swedish.cc:74
static const symbol s_0_2[3]
Definition: swedish.cc:24
static const symbol s_0_11[3]
Definition: swedish.cc:33
static int r_et_condition(struct SN_env *z)
Definition: swedish.cc:212
static const symbol s_1_3[7]
Definition: swedish.cc:70
static const symbol s_2_2[2]
Definition: swedish.cc:148
static const symbol s_2_5[2]
Definition: swedish.cc:151
static const symbol s_1_35[5]
Definition: swedish.cc:102
static const symbol s_3_2[3]
Definition: swedish.cc:165
static const symbol s_1_10[3]
Definition: swedish.cc:77
static const symbol s_1_34[2]
Definition: swedish.cc:101
static const symbol s_0_5[3]
Definition: swedish.cc:27
static const symbol s_0_3[3]
Definition: swedish.cc:25
static const symbol s_0_17[3]
Definition: swedish.cc:39
static const symbol s_1_31[6]
Definition: swedish.cc:98
static int r_other_suffix(struct SN_env *z)
Definition: swedish.cc:298
static const symbol s_1_18[2]
Definition: swedish.cc:85
static int r_consonant_pair(struct SN_env *z)
Definition: swedish.cc:274
static const struct among a_2[7]
Definition: swedish.cc:153
static const symbol s_1_14[4]
Definition: swedish.cc:81
static const symbol s_1_21[1]
Definition: swedish.cc:88
static const symbol s_2_0[2]
Definition: swedish.cc:146
static int r_main_suffix(struct SN_env *z)
Definition: swedish.cc:233
static const symbol s_1_16[3]
Definition: swedish.cc:83
static const symbol s_0_12[3]
Definition: swedish.cc:34
static const struct among a_1[38]
Definition: swedish.cc:105
static const symbol s_1_36[3]
Definition: swedish.cc:103
static const symbol s_1_4[4]
Definition: swedish.cc:71
static const symbol s_1_23[5]
Definition: swedish.cc:90
static const symbol s_3_0[2]
Definition: swedish.cc:163
static const symbol s_0_13[3]
Definition: swedish.cc:35
static const symbol s_3_4[4]
Definition: swedish.cc:167
static const symbol s_0_10[4]
Definition: swedish.cc:32
static const symbol s_0_8[3]
Definition: swedish.cc:30
static const symbol s_1_20[2]
Definition: swedish.cc:87
static const symbol s_3_1[3]
Definition: swedish.cc:164
static const unsigned char g_ost_ending[]
Definition: swedish.cc:180
static const symbol s_0_0[3]
Definition: swedish.cc:22
static const symbol s_0_16[3]
Definition: swedish.cc:38
static const symbol s_1_6[1]
Definition: swedish.cc:73
static const symbol s_1_37[3]
Definition: swedish.cc:104
static const struct among a_0[21]
Definition: swedish.cc:43
static const symbol s_0_9[4]
Definition: swedish.cc:31
static const symbol s_0_18[4]
Definition: swedish.cc:40
static const symbol s_1_26[2]
Definition: swedish.cc:93
static const symbol s_0_20[3]
Definition: swedish.cc:42
static const symbol s_0_4[4]
Definition: swedish.cc:26
static const symbol s_1_17[2]
Definition: swedish.cc:84
static const symbol s_1_11[4]
Definition: swedish.cc:78
static const symbol s_2_3[2]
Definition: swedish.cc:149
static const symbol s_1_13[5]
Definition: swedish.cc:80
Xapian::Internal::Snowball::Swedish::SN_local SN_local
Definition: swedish.cc:10
static const symbol s_1_27[4]
Definition: swedish.cc:94
static const symbol s_0_14[3]
Definition: swedish.cc:36
static const symbol s_2_4[2]
Definition: swedish.cc:150
static const symbol s_1_1[4]
Definition: swedish.cc:68
static const symbol s_1[]
Definition: swedish.cc:19
static const symbol s_1_0[1]
Definition: swedish.cc:67
static const symbol s_1_30[5]
Definition: swedish.cc:97
static const symbol s_0_15[3]
Definition: swedish.cc:37
static const symbol s_3_3[5]
Definition: swedish.cc:166
static const symbol s_1_9[4]
Definition: swedish.cc:76
static int r_mark_regions(struct SN_env *z)
Definition: swedish.cc:182
static const symbol s_1_24[5]
Definition: swedish.cc:91
static const symbol s_1_29[3]
Definition: swedish.cc:96
static const symbol s_0_1[1]
Definition: swedish.cc:23
static const symbol s_1_25[5]
Definition: swedish.cc:92
static const struct among a_3[5]
Definition: swedish.cc:168
static const symbol s_1_2[4]
Definition: swedish.cc:69
static const symbol s_0_6[3]
Definition: swedish.cc:28
static const symbol s_1_33[2]
Definition: swedish.cc:100
static const symbol s_0_7[3]
Definition: swedish.cc:29
static const symbol s_1_15[5]
Definition: swedish.cc:82
static const symbol s_2_6[2]
Definition: swedish.cc:152
static const symbol s_2_1[2]
Definition: swedish.cc:147
static const unsigned char g_v[]
Definition: swedish.cc:176
static const symbol s_1_22[2]
Definition: swedish.cc:89
static const unsigned char g_s_ending[]
Definition: swedish.cc:178
static const symbol s_1_8[4]
Definition: swedish.cc:75
static const symbol s_1_19[5]
Definition: swedish.cc:86
static const symbol s_1_12[2]
Definition: swedish.cc:79
static const symbol s_0[]
Definition: swedish.cc:18
static const symbol s_1_28[5]
Definition: swedish.cc:95
static const symbol s_0_19[4]
Definition: swedish.cc:41
static const symbol s_1_32[4]
Definition: swedish.cc:99