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