xapian-core  1.4.25
norwegian.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 "norwegian.h"
7 
8 #define s_0_0 s_0_3
9 #define s_0_1 (s_0_2 + 2)
10 #define s_0_2 s_0_17
11 static const symbol s_pool[] = {
12 #define s_0_3 0
13 'a', 'n', 'd', 'e',
14 #define s_0_4 s_0_18
15 #define s_0_5 4
16 'a', 'n', 'e',
17 #define s_0_6 (s_0_7 + 3)
18 #define s_0_7 s_0_20
19 #define s_0_8 7
20 'e', 'r', 't', 'e',
21 #define s_0_9 s_0_4
22 #define s_0_10 s_0_7
23 #define s_0_11 11
24 'a', 'r',
25 #define s_0_12 s_0_8
26 #define s_0_13 13
27 'h', 'e', 't', 'e', 'r',
28 #define s_0_14 (s_0_15 + 1)
29 #define s_0_15 s_0_28
30 #define s_0_16 (s_0_17 + 2)
31 #define s_0_17 18
32 'e', 'd', 'e', 's',
33 #define s_0_18 22
34 'e', 'n', 'd', 'e', 's',
35 #define s_0_19 (s_0_20 + 3)
36 #define s_0_20 27
37 'h', 'e', 't', 'e', 'n', 'e', 's',
38 #define s_0_21 (s_0_22 + 3)
39 #define s_0_22 34
40 'h', 'e', 't', 'e', 'n', 's',
41 #define s_0_23 40
42 'e', 'r', 's',
43 #define s_0_24 43
44 'e', 't', 's',
45 #define s_0_25 (s_0_7 + 1)
46 #define s_0_26 s_0_7
47 #define s_0_27 s_0_8
48 #define s_0_28 46
49 'a', 's', 't',
50 #define s_1_0 49
51 'd', 't',
52 #define s_1_1 51
53 'v', 't',
54 #define s_2_0 (s_2_1 + 1)
55 #define s_2_1 53
56 'e', 'l', 'e', 'g',
57 #define s_2_2 (s_2_3 + 1)
58 #define s_2_3 57
59 'e', 'i', 'g',
60 #define s_2_4 (s_2_5 + 1)
61 #define s_2_5 60
62 'e', 'l', 'i', 'g',
63 #define s_2_6 64
64 'e', 'l', 's',
65 #define s_2_7 (s_2_8 + 1)
66 #define s_2_8 67
67 'e', 'l', 'o', 'v',
68 #define s_2_9 (s_2_10 + 3)
69 #define s_2_10 71
70 'h', 'e', 't', 's', 'l', 'o', 'v',
71 };
72 
73 
74 static const struct among a_0[29] =
75 {
76 /* 0 */ { 1, s_0_0, -1, 1},
77 /* 1 */ { 1, s_0_1, -1, 1},
78 /* 2 */ { 3, s_0_2, 1, 1},
79 /* 3 */ { 4, s_0_3, 1, 1},
80 /* 4 */ { 4, s_0_4, 1, 1},
81 /* 5 */ { 3, s_0_5, 1, 1},
82 /* 6 */ { 3, s_0_6, 1, 1},
83 /* 7 */ { 6, s_0_7, 6, 1},
84 /* 8 */ { 4, s_0_8, 1, 3},
85 /* 9 */ { 2, s_0_9, -1, 1},
86 /* 10 */ { 5, s_0_10, 9, 1},
87 /* 11 */ { 2, s_0_11, -1, 1},
88 /* 12 */ { 2, s_0_12, -1, 1},
89 /* 13 */ { 5, s_0_13, 12, 1},
90 /* 14 */ { 1, s_0_14, -1, 2},
91 /* 15 */ { 2, s_0_15, 14, 1},
92 /* 16 */ { 2, s_0_16, 14, 1},
93 /* 17 */ { 4, s_0_17, 16, 1},
94 /* 18 */ { 5, s_0_18, 16, 1},
95 /* 19 */ { 4, s_0_19, 16, 1},
96 /* 20 */ { 7, s_0_20, 19, 1},
97 /* 21 */ { 3, s_0_21, 14, 1},
98 /* 22 */ { 6, s_0_22, 21, 1},
99 /* 23 */ { 3, s_0_23, 14, 1},
100 /* 24 */ { 3, s_0_24, 14, 1},
101 /* 25 */ { 2, s_0_25, -1, 1},
102 /* 26 */ { 3, s_0_26, 25, 1},
103 /* 27 */ { 3, s_0_27, -1, 3},
104 /* 28 */ { 3, s_0_28, -1, 1}
105 };
106 
107 
108 static const struct among a_1[2] =
109 {
110 /* 0 */ { 2, s_1_0, -1, -1},
111 /* 1 */ { 2, s_1_1, -1, -1}
112 };
113 
114 
115 static const struct among a_2[11] =
116 {
117 /* 0 */ { 3, s_2_0, -1, 1},
118 /* 1 */ { 4, s_2_1, 0, 1},
119 /* 2 */ { 2, s_2_2, -1, 1},
120 /* 3 */ { 3, s_2_3, 2, 1},
121 /* 4 */ { 3, s_2_4, 2, 1},
122 /* 5 */ { 4, s_2_5, 4, 1},
123 /* 6 */ { 3, s_2_6, -1, 1},
124 /* 7 */ { 3, s_2_7, -1, 1},
125 /* 8 */ { 4, s_2_8, 7, 1},
126 /* 9 */ { 4, s_2_9, 7, 1},
127 /* 10 */ { 7, s_2_10, 9, 1}
128 };
129 
130 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 };
131 
132 static const unsigned char g_s_ending[] = { 119, 125, 149, 1 };
133 
134 static const symbol s_0[] = { 'e', 'r' };
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 || !((1851426 >> (p[c - 1] & 0x1f)) & 1)) { lb = mlimit1; return 0; }
168  among_var = find_among_b(s_pool, a_0, 29, 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  { int m2 = l - c; (void)m2;
181  if (in_grouping_b_U(g_s_ending, 98, 122, 0)) goto lab1;
182  goto lab0;
183  lab1:
184  c = l - m2;
185  if (c <= lb || p[c - 1] != 'k') return 0;
186  c--;
187  if (out_grouping_b_U(g_v, 97, 248, 0)) return 0;
188  }
189  lab0:
190  { int ret = slice_del();
191  if (ret < 0) return ret;
192  }
193  break;
194  case 3:
195  { int ret = slice_from_s(2, s_0);
196  if (ret < 0) return ret;
197  }
198  break;
199  }
200  return 1;
201 }
202 
204  { int m_test1 = l - c;
205 
206  { int mlimit2;
207  if (c < I_p1) return 0;
208  mlimit2 = lb; lb = I_p1;
209  ket = c;
210  if (c - 1 <= lb || p[c - 1] != 116) { lb = mlimit2; return 0; }
211  if (!(find_among_b(s_pool, a_1, 2, 0, 0))) { lb = mlimit2; return 0; }
212  bra = c;
213  lb = mlimit2;
214  }
215  c = l - m_test1;
216  }
217  { int ret = skip_utf8(p, c, lb, 0, -1);
218  if (ret < 0) return 0;
219  c = ret;
220  }
221  bra = c;
222  { int ret = slice_del();
223  if (ret < 0) return ret;
224  }
225  return 1;
226 }
227 
229 
230  { int mlimit1;
231  if (c < I_p1) return 0;
232  mlimit1 = lb; lb = I_p1;
233  ket = c;
234  if (c - 1 <= lb || p[c - 1] >> 5 != 3 || !((4718720 >> (p[c - 1] & 0x1f)) & 1)) { lb = mlimit1; return 0; }
235  if (!(find_among_b(s_pool, a_2, 11, 0, 0))) { lb = mlimit1; return 0; }
236  bra = c;
237  lb = mlimit1;
238  }
239  { int ret = slice_del();
240  if (ret < 0) return ret;
241  }
242  return 1;
243 }
244 
246  { int c1 = c;
247  { int ret = r_mark_regions();
248  if (ret < 0) return ret;
249  }
250  c = c1;
251  }
252  lb = c; c = l;
253 
254  { int m2 = l - c; (void)m2;
255  { int ret = r_main_suffix();
256  if (ret < 0) return ret;
257  }
258  c = l - m2;
259  }
260  { int m3 = l - c; (void)m3;
261  { int ret = r_consonant_pair();
262  if (ret < 0) return ret;
263  }
264  c = l - m3;
265  }
266  { int m4 = l - c; (void)m4;
267  { int ret = r_other_suffix();
268  if (ret < 0) return ret;
269  }
270  c = l - m4;
271  }
272  c = lb;
273  return 1;
274 }
275 
277  : I_x(0), I_p1(0)
278 {
279 }
280 
282 {
283 }
284 
285 std::string
287 {
288  return "norwegian";
289 }
#define s_0_4
#define s_1_1
#define s_0_8
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_19
#define s_2_9
#define s_2_5
#define s_0_1
Definition: norwegian.cc:9
#define s_2_8
#define s_0_20
static const struct among a_2[11]
Definition: norwegian.cc:115
#define s_2_2
#define s_0_18
#define s_0_15
#define s_2_6
#define s_0_0
Definition: norwegian.cc:8
#define s_0_22
#define s_0_12
int slice_from_s(int s_size, const symbol *s)
static const unsigned char g_s_ending[]
Definition: norwegian.cc:132
#define s_0_27
#define s_1_0
#define s_0_5
int stem()
Virtual method implemented by the subclass to actually do the work.
Definition: norwegian.cc:245
#define s_0_6
#define s_0_9
unsigned short symbol
Definition: header.h:6
#define s_0_2
Definition: norwegian.cc:10
#define s_0_17
#define s_2_0
#define s_2_3
std::string get_description() const
Return a string describing this object.
Definition: norwegian.cc:286
#define s_2_10
#define s_2_7
#define s_0_7
#define s_0_26
Definition: header.h:191
#define s_0_13
#define s_0_25
#define s_0_23
static int skip_utf8(const symbol *p, int c, int lb, int l, int n)
Definition: steminternal.cc:94
int in_grouping_b_U(const unsigned char *s, int min, int max, int repeat)
#define s_0_14
#define s_0_3
static const unsigned char g_v[]
Definition: norwegian.cc:130
#define s_0_10
#define s_0_21
#define s_0_28
#define s_0_11
static const symbol s_0[]
Definition: norwegian.cc:134
int out_grouping_b_U(const unsigned char *s, int min, int max, int repeat)
#define s_2_4
#define s_2_1
int out_grouping_U(const unsigned char *s, int min, int max, int repeat)
#define s_0_24
#define s_0_16
static const struct among a_0[29]
Definition: norwegian.cc:74
static const symbol s_pool[]
Definition: norwegian.cc:11
int in_grouping_U(const unsigned char *s, int min, int max, int repeat)
static const struct among a_1[2]
Definition: norwegian.cc:108