1 // This file was generated automatically by the Snowball to Java compiler
2
3 package org.tartarus.snowball.ext;
4
5 import org.tartarus.snowball.Among;
6
7 /***
8 * This class was automatically generated by a Snowball to Java compiler
9 * It implements the stemming algorithm defined by a snowball script.
10 */
11
12 public class norwegianStemmer extends org.tartarus.snowball.SnowballStemmer {
13
14 private static final long serialVersionUID = 1L;
15
16 private final static norwegianStemmer methodObject = new norwegianStemmer ();
17
18 private final static Among a_0[] = {
19 new Among ( "a", -1, 1, "", methodObject ),
20 new Among ( "e", -1, 1, "", methodObject ),
21 new Among ( "ede", 1, 1, "", methodObject ),
22 new Among ( "ande", 1, 1, "", methodObject ),
23 new Among ( "ende", 1, 1, "", methodObject ),
24 new Among ( "ane", 1, 1, "", methodObject ),
25 new Among ( "ene", 1, 1, "", methodObject ),
26 new Among ( "hetene", 6, 1, "", methodObject ),
27 new Among ( "erte", 1, 3, "", methodObject ),
28 new Among ( "en", -1, 1, "", methodObject ),
29 new Among ( "heten", 9, 1, "", methodObject ),
30 new Among ( "ar", -1, 1, "", methodObject ),
31 new Among ( "er", -1, 1, "", methodObject ),
32 new Among ( "heter", 12, 1, "", methodObject ),
33 new Among ( "s", -1, 2, "", methodObject ),
34 new Among ( "as", 14, 1, "", methodObject ),
35 new Among ( "es", 14, 1, "", methodObject ),
36 new Among ( "edes", 16, 1, "", methodObject ),
37 new Among ( "endes", 16, 1, "", methodObject ),
38 new Among ( "enes", 16, 1, "", methodObject ),
39 new Among ( "hetenes", 19, 1, "", methodObject ),
40 new Among ( "ens", 14, 1, "", methodObject ),
41 new Among ( "hetens", 21, 1, "", methodObject ),
42 new Among ( "ers", 14, 1, "", methodObject ),
43 new Among ( "ets", 14, 1, "", methodObject ),
44 new Among ( "et", -1, 1, "", methodObject ),
45 new Among ( "het", 25, 1, "", methodObject ),
46 new Among ( "ert", -1, 3, "", methodObject ),
47 new Among ( "ast", -1, 1, "", methodObject )
48 };
49
50 private final static Among a_1[] = {
51 new Among ( "dt", -1, -1, "", methodObject ),
52 new Among ( "vt", -1, -1, "", methodObject )
53 };
54
55 private final static Among a_2[] = {
56 new Among ( "leg", -1, 1, "", methodObject ),
57 new Among ( "eleg", 0, 1, "", methodObject ),
58 new Among ( "ig", -1, 1, "", methodObject ),
59 new Among ( "eig", 2, 1, "", methodObject ),
60 new Among ( "lig", 2, 1, "", methodObject ),
61 new Among ( "elig", 4, 1, "", methodObject ),
62 new Among ( "els", -1, 1, "", methodObject ),
63 new Among ( "lov", -1, 1, "", methodObject ),
64 new Among ( "elov", 7, 1, "", methodObject ),
65 new Among ( "slov", 7, 1, "", methodObject ),
66 new Among ( "hetslov", 9, 1, "", methodObject )
67 };
68
69 private static final char g_v[] = {17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 };
70
71 private static final char g_s_ending[] = {119, 125, 149, 1 };
72
73 private int I_x;
74 private int I_p1;
75
76 private void copy_from(norwegianStemmer other) {
77 I_x = other.I_x;
78 I_p1 = other.I_p1;
79 super.copy_from(other);
80 }
81
82 private boolean r_mark_regions() {
83 int v_1;
84 int v_2;
85 // (, line 26
86 I_p1 = limit;
87 // test, line 30
88 v_1 = cursor;
89 // (, line 30
90 // hop, line 30
91 {
92 int c = cursor + 3;
93 if (0 > c || c > limit)
94 {
95 return false;
96 }
97 cursor = c;
98 }
99 // setmark x, line 30
100 I_x = cursor;
101 cursor = v_1;
102 // goto, line 31
103 golab0: while(true)
104 {
105 v_2 = cursor;
106 lab1: do {
107 if (!(in_grouping(g_v, 97, 248)))
108 {
109 break lab1;
110 }
111 cursor = v_2;
112 break golab0;
113 } while (false);
114 cursor = v_2;
115 if (cursor >= limit)
116 {
117 return false;
118 }
119 cursor++;
120 }
121 // gopast, line 31
122 golab2: while(true)
123 {
124 lab3: do {
125 if (!(out_grouping(g_v, 97, 248)))
126 {
127 break lab3;
128 }
129 break golab2;
130 } while (false);
131 if (cursor >= limit)
132 {
133 return false;
134 }
135 cursor++;
136 }
137 // setmark p1, line 31
138 I_p1 = cursor;
139 // try, line 32
140 lab4: do {
141 // (, line 32
142 if (!(I_p1 < I_x))
143 {
144 break lab4;
145 }
146 I_p1 = I_x;
147 } while (false);
148 return true;
149 }
150
151 private boolean r_main_suffix() {
152 int among_var;
153 int v_1;
154 int v_2;
155 int v_3;
156 // (, line 37
157 // setlimit, line 38
158 v_1 = limit - cursor;
159 // tomark, line 38
160 if (cursor < I_p1)
161 {
162 return false;
163 }
164 cursor = I_p1;
165 v_2 = limit_backward;
166 limit_backward = cursor;
167 cursor = limit - v_1;
168 // (, line 38
169 // [, line 38
170 ket = cursor;
171 // substring, line 38
172 among_var = find_among_b(a_0, 29);
173 if (among_var == 0)
174 {
175 limit_backward = v_2;
176 return false;
177 }
178 // ], line 38
179 bra = cursor;
180 limit_backward = v_2;
181 switch(among_var) {
182 case 0:
183 return false;
184 case 1:
185 // (, line 44
186 // delete, line 44
187 slice_del();
188 break;
189 case 2:
190 // (, line 46
191 // or, line 46
192 lab0: do {
193 v_3 = limit - cursor;
194 lab1: do {
195 if (!(in_grouping_b(g_s_ending, 98, 122)))
196 {
197 break lab1;
198 }
199 break lab0;
200 } while (false);
201 cursor = limit - v_3;
202 // (, line 46
203 // literal, line 46
204 if (!(eq_s_b(1, "k")))
205 {
206 return false;
207 }
208 if (!(out_grouping_b(g_v, 97, 248)))
209 {
210 return false;
211 }
212 } while (false);
213 // delete, line 46
214 slice_del();
215 break;
216 case 3:
217 // (, line 48
218 // <-, line 48
219 slice_from("er");
220 break;
221 }
222 return true;
223 }
224
225 private boolean r_consonant_pair() {
226 int v_1;
227 int v_2;
228 int v_3;
229 // (, line 52
230 // test, line 53
231 v_1 = limit - cursor;
232 // (, line 53
233 // setlimit, line 54
234 v_2 = limit - cursor;
235 // tomark, line 54
236 if (cursor < I_p1)
237 {
238 return false;
239 }
240 cursor = I_p1;
241 v_3 = limit_backward;
242 limit_backward = cursor;
243 cursor = limit - v_2;
244 // (, line 54
245 // [, line 54
246 ket = cursor;
247 // substring, line 54
248 if (find_among_b(a_1, 2) == 0)
249 {
250 limit_backward = v_3;
251 return false;
252 }
253 // ], line 54
254 bra = cursor;
255 limit_backward = v_3;
256 cursor = limit - v_1;
257 // next, line 59
258 if (cursor <= limit_backward)
259 {
260 return false;
261 }
262 cursor--;
263 // ], line 59
264 bra = cursor;
265 // delete, line 59
266 slice_del();
267 return true;
268 }
269
270 private boolean r_other_suffix() {
271 int among_var;
272 int v_1;
273 int v_2;
274 // (, line 62
275 // setlimit, line 63
276 v_1 = limit - cursor;
277 // tomark, line 63
278 if (cursor < I_p1)
279 {
280 return false;
281 }
282 cursor = I_p1;
283 v_2 = limit_backward;
284 limit_backward = cursor;
285 cursor = limit - v_1;
286 // (, line 63
287 // [, line 63
288 ket = cursor;
289 // substring, line 63
290 among_var = find_among_b(a_2, 11);
291 if (among_var == 0)
292 {
293 limit_backward = v_2;
294 return false;
295 }
296 // ], line 63
297 bra = cursor;
298 limit_backward = v_2;
299 switch(among_var) {
300 case 0:
301 return false;
302 case 1:
303 // (, line 67
304 // delete, line 67
305 slice_del();
306 break;
307 }
308 return true;
309 }
310
311 public boolean stem() {
312 int v_1;
313 int v_2;
314 int v_3;
315 int v_4;
316 // (, line 72
317 // do, line 74
318 v_1 = cursor;
319 lab0: do {
320 // call mark_regions, line 74
321 if (!r_mark_regions())
322 {
323 break lab0;
324 }
325 } while (false);
326 cursor = v_1;
327 // backwards, line 75
328 limit_backward = cursor; cursor = limit;
329 // (, line 75
330 // do, line 76
331 v_2 = limit - cursor;
332 lab1: do {
333 // call main_suffix, line 76
334 if (!r_main_suffix())
335 {
336 break lab1;
337 }
338 } while (false);
339 cursor = limit - v_2;
340 // do, line 77
341 v_3 = limit - cursor;
342 lab2: do {
343 // call consonant_pair, line 77
344 if (!r_consonant_pair())
345 {
346 break lab2;
347 }
348 } while (false);
349 cursor = limit - v_3;
350 // do, line 78
351 v_4 = limit - cursor;
352 lab3: do {
353 // call other_suffix, line 78
354 if (!r_other_suffix())
355 {
356 break lab3;
357 }
358 } while (false);
359 cursor = limit - v_4;
360 cursor = limit_backward; return true;
361 }
362
363 public boolean equals( Object o ) {
364 return o instanceof norwegianStemmer;
365 }
366
367 public int hashCode() {
368 return norwegianStemmer.class.getName().hashCode();
369 }
370
371
372
373 }
374