Initial import into git.
[galago.git] / java / galago / src / org / tartarus / snowball / ext / swedishStemmer.java
blob53af41aa97c629bc4d560b8ae5496315c2eef84f
1 // This file was generated automatically by the Snowball to Java compiler
3 package org.tartarus.snowball.ext;
4 import org.tartarus.snowball.SnowballProgram;
5 import org.tartarus.snowball.Among;
7 /**
8 * Generated class implementing code defined by a snowball script.
9 */
10 public class swedishStemmer extends SnowballProgram {
12 private Among a_0[] = {
13 new Among ( "a", -1, 1, "", this),
14 new Among ( "arna", 0, 1, "", this),
15 new Among ( "erna", 0, 1, "", this),
16 new Among ( "heterna", 2, 1, "", this),
17 new Among ( "orna", 0, 1, "", this),
18 new Among ( "ad", -1, 1, "", this),
19 new Among ( "e", -1, 1, "", this),
20 new Among ( "ade", 6, 1, "", this),
21 new Among ( "ande", 6, 1, "", this),
22 new Among ( "arne", 6, 1, "", this),
23 new Among ( "are", 6, 1, "", this),
24 new Among ( "aste", 6, 1, "", this),
25 new Among ( "en", -1, 1, "", this),
26 new Among ( "anden", 12, 1, "", this),
27 new Among ( "aren", 12, 1, "", this),
28 new Among ( "heten", 12, 1, "", this),
29 new Among ( "ern", -1, 1, "", this),
30 new Among ( "ar", -1, 1, "", this),
31 new Among ( "er", -1, 1, "", this),
32 new Among ( "heter", 18, 1, "", this),
33 new Among ( "or", -1, 1, "", this),
34 new Among ( "s", -1, 2, "", this),
35 new Among ( "as", 21, 1, "", this),
36 new Among ( "arnas", 22, 1, "", this),
37 new Among ( "ernas", 22, 1, "", this),
38 new Among ( "ornas", 22, 1, "", this),
39 new Among ( "es", 21, 1, "", this),
40 new Among ( "ades", 26, 1, "", this),
41 new Among ( "andes", 26, 1, "", this),
42 new Among ( "ens", 21, 1, "", this),
43 new Among ( "arens", 29, 1, "", this),
44 new Among ( "hetens", 29, 1, "", this),
45 new Among ( "erns", 21, 1, "", this),
46 new Among ( "at", -1, 1, "", this),
47 new Among ( "andet", -1, 1, "", this),
48 new Among ( "het", -1, 1, "", this),
49 new Among ( "ast", -1, 1, "", this)
52 private Among a_1[] = {
53 new Among ( "dd", -1, -1, "", this),
54 new Among ( "gd", -1, -1, "", this),
55 new Among ( "nn", -1, -1, "", this),
56 new Among ( "dt", -1, -1, "", this),
57 new Among ( "gt", -1, -1, "", this),
58 new Among ( "kt", -1, -1, "", this),
59 new Among ( "tt", -1, -1, "", this)
62 private Among a_2[] = {
63 new Among ( "ig", -1, 1, "", this),
64 new Among ( "lig", 0, 1, "", this),
65 new Among ( "els", -1, 1, "", this),
66 new Among ( "fullt", -1, 3, "", this),
67 new Among ( "l\u00F6st", -1, 2, "", this)
70 private static final char g_v[] = {17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 32 };
72 private static final char g_s_ending[] = {119, 127, 149 };
74 private int I_x;
75 private int I_p1;
77 private void copy_from(swedishStemmer other) {
78 I_x = other.I_x;
79 I_p1 = other.I_p1;
80 super.copy_from(other);
83 private boolean r_mark_regions() {
84 int v_1;
85 int v_2;
86 // (, line 26
87 I_p1 = limit;
88 // test, line 29
89 v_1 = cursor;
90 // (, line 29
91 // hop, line 29
93 int c = cursor + 3;
94 if (0 > c || c > limit)
96 return false;
98 cursor = c;
100 // setmark x, line 29
101 I_x = cursor;
102 cursor = v_1;
103 // goto, line 30
104 golab0: while(true)
106 v_2 = cursor;
107 lab1: do {
108 if (!(in_grouping(g_v, 97, 246)))
110 break lab1;
112 cursor = v_2;
113 break golab0;
114 } while (false);
115 cursor = v_2;
116 if (cursor >= limit)
118 return false;
120 cursor++;
122 // gopast, line 30
123 golab2: while(true)
125 lab3: do {
126 if (!(out_grouping(g_v, 97, 246)))
128 break lab3;
130 break golab2;
131 } while (false);
132 if (cursor >= limit)
134 return false;
136 cursor++;
138 // setmark p1, line 30
139 I_p1 = cursor;
140 // try, line 31
141 lab4: do {
142 // (, line 31
143 if (!(I_p1 < I_x))
145 break lab4;
147 I_p1 = I_x;
148 } while (false);
149 return true;
152 private boolean r_main_suffix() {
153 int among_var;
154 int v_1;
155 int v_2;
156 // (, line 36
157 // setlimit, line 37
158 v_1 = limit - cursor;
159 // tomark, line 37
160 if (cursor < I_p1)
162 return false;
164 cursor = I_p1;
165 v_2 = limit_backward;
166 limit_backward = cursor;
167 cursor = limit - v_1;
168 // (, line 37
169 // [, line 37
170 ket = cursor;
171 // substring, line 37
172 among_var = find_among_b(a_0, 37);
173 if (among_var == 0)
175 limit_backward = v_2;
176 return false;
178 // ], line 37
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 if (!(in_grouping_b(g_s_ending, 98, 121)))
193 return false;
195 // delete, line 46
196 slice_del();
197 break;
199 return true;
202 private boolean r_consonant_pair() {
203 int v_1;
204 int v_2;
205 int v_3;
206 // setlimit, line 50
207 v_1 = limit - cursor;
208 // tomark, line 50
209 if (cursor < I_p1)
211 return false;
213 cursor = I_p1;
214 v_2 = limit_backward;
215 limit_backward = cursor;
216 cursor = limit - v_1;
217 // (, line 50
218 // and, line 52
219 v_3 = limit - cursor;
220 // among, line 51
221 if (find_among_b(a_1, 7) == 0)
223 limit_backward = v_2;
224 return false;
226 cursor = limit - v_3;
227 // (, line 52
228 // [, line 52
229 ket = cursor;
230 // next, line 52
231 if (cursor <= limit_backward)
233 limit_backward = v_2;
234 return false;
236 cursor--;
237 // ], line 52
238 bra = cursor;
239 // delete, line 52
240 slice_del();
241 limit_backward = v_2;
242 return true;
245 private boolean r_other_suffix() {
246 int among_var;
247 int v_1;
248 int v_2;
249 // setlimit, line 55
250 v_1 = limit - cursor;
251 // tomark, line 55
252 if (cursor < I_p1)
254 return false;
256 cursor = I_p1;
257 v_2 = limit_backward;
258 limit_backward = cursor;
259 cursor = limit - v_1;
260 // (, line 55
261 // [, line 56
262 ket = cursor;
263 // substring, line 56
264 among_var = find_among_b(a_2, 5);
265 if (among_var == 0)
267 limit_backward = v_2;
268 return false;
270 // ], line 56
271 bra = cursor;
272 switch(among_var) {
273 case 0:
274 limit_backward = v_2;
275 return false;
276 case 1:
277 // (, line 57
278 // delete, line 57
279 slice_del();
280 break;
281 case 2:
282 // (, line 58
283 // <-, line 58
284 slice_from("l\u00F6s");
285 break;
286 case 3:
287 // (, line 59
288 // <-, line 59
289 slice_from("full");
290 break;
292 limit_backward = v_2;
293 return true;
296 public boolean stem() {
297 int v_1;
298 int v_2;
299 int v_3;
300 int v_4;
301 // (, line 64
302 // do, line 66
303 v_1 = cursor;
304 lab0: do {
305 // call mark_regions, line 66
306 if (!r_mark_regions())
308 break lab0;
310 } while (false);
311 cursor = v_1;
312 // backwards, line 67
313 limit_backward = cursor; cursor = limit;
314 // (, line 67
315 // do, line 68
316 v_2 = limit - cursor;
317 lab1: do {
318 // call main_suffix, line 68
319 if (!r_main_suffix())
321 break lab1;
323 } while (false);
324 cursor = limit - v_2;
325 // do, line 69
326 v_3 = limit - cursor;
327 lab2: do {
328 // call consonant_pair, line 69
329 if (!r_consonant_pair())
331 break lab2;
333 } while (false);
334 cursor = limit - v_3;
335 // do, line 70
336 v_4 = limit - cursor;
337 lab3: do {
338 // call other_suffix, line 70
339 if (!r_other_suffix())
341 break lab3;
343 } while (false);
344 cursor = limit - v_4;
345 cursor = limit_backward; return true;