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