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 danishStemmer extends org.tartarus.snowball.SnowballStemmer {
13
14 private static final long serialVersionUID = 1L;
15
16 private final static danishStemmer methodObject = new danishStemmer ();
17
18 private final static Among a_0[] = {
19 new Among ( "hed", -1, 1, "", methodObject ),
20 new Among ( "ethed", 0, 1, "", methodObject ),
21 new Among ( "ered", -1, 1, "", methodObject ),
22 new Among ( "e", -1, 1, "", methodObject ),
23 new Among ( "erede", 3, 1, "", methodObject ),
24 new Among ( "ende", 3, 1, "", methodObject ),
25 new Among ( "erende", 5, 1, "", methodObject ),
26 new Among ( "ene", 3, 1, "", methodObject ),
27 new Among ( "erne", 3, 1, "", methodObject ),
28 new Among ( "ere", 3, 1, "", methodObject ),
29 new Among ( "en", -1, 1, "", methodObject ),
30 new Among ( "heden", 10, 1, "", methodObject ),
31 new Among ( "eren", 10, 1, "", methodObject ),
32 new Among ( "er", -1, 1, "", methodObject ),
33 new Among ( "heder", 13, 1, "", methodObject ),
34 new Among ( "erer", 13, 1, "", methodObject ),
35 new Among ( "s", -1, 2, "", methodObject ),
36 new Among ( "heds", 16, 1, "", methodObject ),
37 new Among ( "es", 16, 1, "", methodObject ),
38 new Among ( "endes", 18, 1, "", methodObject ),
39 new Among ( "erendes", 19, 1, "", methodObject ),
40 new Among ( "enes", 18, 1, "", methodObject ),
41 new Among ( "ernes", 18, 1, "", methodObject ),
42 new Among ( "eres", 18, 1, "", methodObject ),
43 new Among ( "ens", 16, 1, "", methodObject ),
44 new Among ( "hedens", 24, 1, "", methodObject ),
45 new Among ( "erens", 24, 1, "", methodObject ),
46 new Among ( "ers", 16, 1, "", methodObject ),
47 new Among ( "ets", 16, 1, "", methodObject ),
48 new Among ( "erets", 28, 1, "", methodObject ),
49 new Among ( "et", -1, 1, "", methodObject ),
50 new Among ( "eret", 30, 1, "", methodObject )
51 };
52
53 private final static Among a_1[] = {
54 new Among ( "gd", -1, -1, "", methodObject ),
55 new Among ( "dt", -1, -1, "", methodObject ),
56 new Among ( "gt", -1, -1, "", methodObject ),
57 new Among ( "kt", -1, -1, "", methodObject )
58 };
59
60 private final static Among a_2[] = {
61 new Among ( "ig", -1, 1, "", methodObject ),
62 new Among ( "lig", 0, 1, "", methodObject ),
63 new Among ( "elig", 1, 1, "", methodObject ),
64 new Among ( "els", -1, 1, "", methodObject ),
65 new Among ( "l\u00F8st", -1, 2, "", methodObject )
66 };
67
68 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 };
69
70 private static final char g_s_ending[] = {239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 };
71
72 private int I_x;
73 private int I_p1;
74 private java.lang.StringBuilder S_ch = new java.lang.StringBuilder();
75
76 private void copy_from(danishStemmer other) {
77 I_x = other.I_x;
78 I_p1 = other.I_p1;
79 S_ch = other.S_ch;
80 super.copy_from(other);
81 }
82
83 private boolean r_mark_regions() {
84 int v_1;
85 int v_2;
86 // (, line 29
87 I_p1 = limit;
88 // test, line 33
89 v_1 = cursor;
90 // (, line 33
91 // hop, line 33
92 {
93 int c = cursor + 3;
94 if (0 > c || c > limit)
95 {
96 return false;
97 }
98 cursor = c;
99 }
100 // setmark x, line 33
101 I_x = cursor;
102 cursor = v_1;
103 // goto, line 34
104 golab0: while(true)
105 {
106 v_2 = cursor;
107 lab1: do {
108 if (!(in_grouping(g_v, 97, 248)))
109 {
110 break lab1;
111 }
112 cursor = v_2;
113 break golab0;
114 } while (false);
115 cursor = v_2;
116 if (cursor >= limit)
117 {
118 return false;
119 }
120 cursor++;
121 }
122 // gopast, line 34
123 golab2: while(true)
124 {
125 lab3: do {
126 if (!(out_grouping(g_v, 97, 248)))
127 {
128 break lab3;
129 }
130 break golab2;
131 } while (false);
132 if (cursor >= limit)
133 {
134 return false;
135 }
136 cursor++;
137 }
138 // setmark p1, line 34
139 I_p1 = cursor;
140 // try, line 35
141 lab4: do {
142 // (, line 35
143 if (!(I_p1 < I_x))
144 {
145 break lab4;
146 }
147 I_p1 = I_x;
148 } while (false);
149 return true;
150 }
151
152 private boolean r_main_suffix() {
153 int among_var;
154 int v_1;
155 int v_2;
156 // (, line 40
157 // setlimit, line 41
158 v_1 = limit - cursor;
159 // tomark, line 41
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 41
169 // [, line 41
170 ket = cursor;
171 // substring, line 41
172 among_var = find_among_b(a_0, 32);
173 if (among_var == 0)
174 {
175 limit_backward = v_2;
176 return false;
177 }
178 // ], line 41
179 bra = cursor;
180 limit_backward = v_2;
181 switch(among_var) {
182 case 0:
183 return false;
184 case 1:
185 // (, line 48
186 // delete, line 48
187 slice_del();
188 break;
189 case 2:
190 // (, line 50
191 if (!(in_grouping_b(g_s_ending, 97, 229)))
192 {
193 return false;
194 }
195 // delete, line 50
196 slice_del();
197 break;
198 }
199 return true;
200 }
201
202 private boolean r_consonant_pair() {
203 int v_1;
204 int v_2;
205 int v_3;
206 // (, line 54
207 // test, line 55
208 v_1 = limit - cursor;
209 // (, line 55
210 // setlimit, line 56
211 v_2 = limit - cursor;
212 // tomark, line 56
213 if (cursor < I_p1)
214 {
215 return false;
216 }
217 cursor = I_p1;
218 v_3 = limit_backward;
219 limit_backward = cursor;
220 cursor = limit - v_2;
221 // (, line 56
222 // [, line 56
223 ket = cursor;
224 // substring, line 56
225 if (find_among_b(a_1, 4) == 0)
226 {
227 limit_backward = v_3;
228 return false;
229 }
230 // ], line 56
231 bra = cursor;
232 limit_backward = v_3;
233 cursor = limit - v_1;
234 // next, line 62
235 if (cursor <= limit_backward)
236 {
237 return false;
238 }
239 cursor--;
240 // ], line 62
241 bra = cursor;
242 // delete, line 62
243 slice_del();
244 return true;
245 }
246
247 private boolean r_other_suffix() {
248 int among_var;
249 int v_1;
250 int v_2;
251 int v_3;
252 int v_4;
253 // (, line 65
254 // do, line 66
255 v_1 = limit - cursor;
256 lab0: do {
257 // (, line 66
258 // [, line 66
259 ket = cursor;
260 // literal, line 66
261 if (!(eq_s_b(2, "st")))
262 {
263 break lab0;
264 }
265 // ], line 66
266 bra = cursor;
267 // literal, line 66
268 if (!(eq_s_b(2, "ig")))
269 {
270 break lab0;
271 }
272 // delete, line 66
273 slice_del();
274 } while (false);
275 cursor = limit - v_1;
276 // setlimit, line 67
277 v_2 = limit - cursor;
278 // tomark, line 67
279 if (cursor < I_p1)
280 {
281 return false;
282 }
283 cursor = I_p1;
284 v_3 = limit_backward;
285 limit_backward = cursor;
286 cursor = limit - v_2;
287 // (, line 67
288 // [, line 67
289 ket = cursor;
290 // substring, line 67
291 among_var = find_among_b(a_2, 5);
292 if (among_var == 0)
293 {
294 limit_backward = v_3;
295 return false;
296 }
297 // ], line 67
298 bra = cursor;
299 limit_backward = v_3;
300 switch(among_var) {
301 case 0:
302 return false;
303 case 1:
304 // (, line 70
305 // delete, line 70
306 slice_del();
307 // do, line 70
308 v_4 = limit - cursor;
309 lab1: do {
310 // call consonant_pair, line 70
311 if (!r_consonant_pair())
312 {
313 break lab1;
314 }
315 } while (false);
316 cursor = limit - v_4;
317 break;
318 case 2:
319 // (, line 72
320 // <-, line 72
321 slice_from("l\u00F8s");
322 break;
323 }
324 return true;
325 }
326
327 private boolean r_undouble() {
328 int v_1;
329 int v_2;
330 // (, line 75
331 // setlimit, line 76
332 v_1 = limit - cursor;
333 // tomark, line 76
334 if (cursor < I_p1)
335 {
336 return false;
337 }
338 cursor = I_p1;
339 v_2 = limit_backward;
340 limit_backward = cursor;
341 cursor = limit - v_1;
342 // (, line 76
343 // [, line 76
344 ket = cursor;
345 if (!(out_grouping_b(g_v, 97, 248)))
346 {
347 limit_backward = v_2;
348 return false;
349 }
350 // ], line 76
351 bra = cursor;
352 // -> ch, line 76
353 S_ch = slice_to(S_ch);
354 limit_backward = v_2;
355 // name ch, line 77
356 if (!(eq_v_b(S_ch)))
357 {
358 return false;
359 }
360 // delete, line 78
361 slice_del();
362 return true;
363 }
364
365 public boolean stem() {
366 int v_1;
367 int v_2;
368 int v_3;
369 int v_4;
370 int v_5;
371 // (, line 82
372 // do, line 84
373 v_1 = cursor;
374 lab0: do {
375 // call mark_regions, line 84
376 if (!r_mark_regions())
377 {
378 break lab0;
379 }
380 } while (false);
381 cursor = v_1;
382 // backwards, line 85
383 limit_backward = cursor; cursor = limit;
384 // (, line 85
385 // do, line 86
386 v_2 = limit - cursor;
387 lab1: do {
388 // call main_suffix, line 86
389 if (!r_main_suffix())
390 {
391 break lab1;
392 }
393 } while (false);
394 cursor = limit - v_2;
395 // do, line 87
396 v_3 = limit - cursor;
397 lab2: do {
398 // call consonant_pair, line 87
399 if (!r_consonant_pair())
400 {
401 break lab2;
402 }
403 } while (false);
404 cursor = limit - v_3;
405 // do, line 88
406 v_4 = limit - cursor;
407 lab3: do {
408 // call other_suffix, line 88
409 if (!r_other_suffix())
410 {
411 break lab3;
412 }
413 } while (false);
414 cursor = limit - v_4;
415 // do, line 89
416 v_5 = limit - cursor;
417 lab4: do {
418 // call undouble, line 89
419 if (!r_undouble())
420 {
421 break lab4;
422 }
423 } while (false);
424 cursor = limit - v_5;
425 cursor = limit_backward; return true;
426 }
427
428 public boolean equals( Object o ) {
429 return o instanceof danishStemmer;
430 }
431
432 public int hashCode() {
433 return danishStemmer.class.getName().hashCode();
434 }
435
436
437
438 }
439