001: // This file was generated automatically by the Snowball to Java compiler
002:
003: package net.sf.snowball.ext;
004:
005: import net.sf.snowball.SnowballProgram;
006: import net.sf.snowball.Among;
007:
008: /**
009: * Generated class implementing code defined by a snowball script.
010: */
011: public class SwedishStemmer extends SnowballProgram {
012:
013: private Among a_0[] = { new Among("a", -1, 1, "", this ),
014: new Among("arna", 0, 1, "", this ),
015: new Among("erna", 0, 1, "", this ),
016: new Among("heterna", 2, 1, "", this ),
017: new Among("orna", 0, 1, "", this ),
018: new Among("ad", -1, 1, "", this ),
019: new Among("e", -1, 1, "", this ),
020: new Among("ade", 6, 1, "", this ),
021: new Among("ande", 6, 1, "", this ),
022: new Among("arne", 6, 1, "", this ),
023: new Among("are", 6, 1, "", this ),
024: new Among("aste", 6, 1, "", this ),
025: new Among("en", -1, 1, "", this ),
026: new Among("anden", 12, 1, "", this ),
027: new Among("aren", 12, 1, "", this ),
028: new Among("heten", 12, 1, "", this ),
029: new Among("ern", -1, 1, "", this ),
030: new Among("ar", -1, 1, "", this ),
031: new Among("er", -1, 1, "", this ),
032: new Among("heter", 18, 1, "", this ),
033: new Among("or", -1, 1, "", this ),
034: new Among("s", -1, 2, "", this ),
035: new Among("as", 21, 1, "", this ),
036: new Among("arnas", 22, 1, "", this ),
037: new Among("ernas", 22, 1, "", this ),
038: new Among("ornas", 22, 1, "", this ),
039: new Among("es", 21, 1, "", this ),
040: new Among("ades", 26, 1, "", this ),
041: new Among("andes", 26, 1, "", this ),
042: new Among("ens", 21, 1, "", this ),
043: new Among("arens", 29, 1, "", this ),
044: new Among("hetens", 29, 1, "", this ),
045: new Among("erns", 21, 1, "", this ),
046: new Among("at", -1, 1, "", this ),
047: new Among("andet", -1, 1, "", this ),
048: new Among("het", -1, 1, "", this ),
049: new Among("ast", -1, 1, "", this ) };
050:
051: private Among a_1[] = { new Among("dd", -1, -1, "", this ),
052: new Among("gd", -1, -1, "", this ),
053: new Among("nn", -1, -1, "", this ),
054: new Among("dt", -1, -1, "", this ),
055: new Among("gt", -1, -1, "", this ),
056: new Among("kt", -1, -1, "", this ),
057: new Among("tt", -1, -1, "", this ) };
058:
059: private Among a_2[] = { new Among("ig", -1, 1, "", this ),
060: new Among("lig", 0, 1, "", this ),
061: new Among("els", -1, 1, "", this ),
062: new Among("fullt", -1, 3, "", this ),
063: new Among("l\u00F6st", -1, 2, "", this ) };
064:
065: private static final char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0,
066: 0, 0, 0, 0, 0, 0, 0, 24, 0, 32 };
067:
068: private static final char g_s_ending[] = { 119, 127, 149 };
069:
070: private int I_p1;
071:
072: private void copy_from(SwedishStemmer other) {
073: I_p1 = other.I_p1;
074: super .copy_from(other);
075: }
076:
077: private boolean r_mark_regions() {
078: int v_1;
079: // (, line 26
080: I_p1 = limit;
081: // goto, line 30
082: golab0: while (true) {
083: v_1 = cursor;
084: lab1: do {
085: if (!(in_grouping(g_v, 97, 246))) {
086: break lab1;
087: }
088: cursor = v_1;
089: break golab0;
090: } while (false);
091: cursor = v_1;
092: if (cursor >= limit) {
093: return false;
094: }
095: cursor++;
096: }
097: // gopast, line 30
098: golab2: while (true) {
099: lab3: do {
100: if (!(out_grouping(g_v, 97, 246))) {
101: break lab3;
102: }
103: break golab2;
104: } while (false);
105: if (cursor >= limit) {
106: return false;
107: }
108: cursor++;
109: }
110: // setmark p1, line 30
111: I_p1 = cursor;
112: // try, line 31
113: lab4: do {
114: // (, line 31
115: if (!(I_p1 < 3)) {
116: break lab4;
117: }
118: I_p1 = 3;
119: } while (false);
120: return true;
121: }
122:
123: private boolean r_main_suffix() {
124: int among_var;
125: int v_1;
126: int v_2;
127: // (, line 36
128: // setlimit, line 37
129: v_1 = limit - cursor;
130: // tomark, line 37
131: if (cursor < I_p1) {
132: return false;
133: }
134: cursor = I_p1;
135: v_2 = limit_backward;
136: limit_backward = cursor;
137: cursor = limit - v_1;
138: // (, line 37
139: // [, line 37
140: ket = cursor;
141: // substring, line 37
142: among_var = find_among_b(a_0, 37);
143: if (among_var == 0) {
144: limit_backward = v_2;
145: return false;
146: }
147: // ], line 37
148: bra = cursor;
149: limit_backward = v_2;
150: switch (among_var) {
151: case 0:
152: return false;
153: case 1:
154: // (, line 44
155: // delete, line 44
156: slice_del();
157: break;
158: case 2:
159: // (, line 46
160: if (!(in_grouping_b(g_s_ending, 98, 121))) {
161: return false;
162: }
163: // delete, line 46
164: slice_del();
165: break;
166: }
167: return true;
168: }
169:
170: private boolean r_consonant_pair() {
171: int v_1;
172: int v_2;
173: int v_3;
174: // setlimit, line 50
175: v_1 = limit - cursor;
176: // tomark, line 50
177: if (cursor < I_p1) {
178: return false;
179: }
180: cursor = I_p1;
181: v_2 = limit_backward;
182: limit_backward = cursor;
183: cursor = limit - v_1;
184: // (, line 50
185: // and, line 52
186: v_3 = limit - cursor;
187: // among, line 51
188: if (find_among_b(a_1, 7) == 0) {
189: limit_backward = v_2;
190: return false;
191: }
192: cursor = limit - v_3;
193: // (, line 52
194: // [, line 52
195: ket = cursor;
196: // next, line 52
197: if (cursor <= limit_backward) {
198: limit_backward = v_2;
199: return false;
200: }
201: cursor--;
202: // ], line 52
203: bra = cursor;
204: // delete, line 52
205: slice_del();
206: limit_backward = v_2;
207: return true;
208: }
209:
210: private boolean r_other_suffix() {
211: int among_var;
212: int v_1;
213: int v_2;
214: // setlimit, line 55
215: v_1 = limit - cursor;
216: // tomark, line 55
217: if (cursor < I_p1) {
218: return false;
219: }
220: cursor = I_p1;
221: v_2 = limit_backward;
222: limit_backward = cursor;
223: cursor = limit - v_1;
224: // (, line 55
225: // [, line 56
226: ket = cursor;
227: // substring, line 56
228: among_var = find_among_b(a_2, 5);
229: if (among_var == 0) {
230: limit_backward = v_2;
231: return false;
232: }
233: // ], line 56
234: bra = cursor;
235: switch (among_var) {
236: case 0:
237: limit_backward = v_2;
238: return false;
239: case 1:
240: // (, line 57
241: // delete, line 57
242: slice_del();
243: break;
244: case 2:
245: // (, line 58
246: // <-, line 58
247: slice_from("l\u00F6s");
248: break;
249: case 3:
250: // (, line 59
251: // <-, line 59
252: slice_from("full");
253: break;
254: }
255: limit_backward = v_2;
256: return true;
257: }
258:
259: public boolean stem() {
260: int v_1;
261: int v_2;
262: int v_3;
263: int v_4;
264: // (, line 64
265: // do, line 66
266: v_1 = cursor;
267: lab0: do {
268: // call mark_regions, line 66
269: if (!r_mark_regions()) {
270: break lab0;
271: }
272: } while (false);
273: cursor = v_1;
274: // backwards, line 67
275: limit_backward = cursor;
276: cursor = limit;
277: // (, line 67
278: // do, line 68
279: v_2 = limit - cursor;
280: lab1: do {
281: // call main_suffix, line 68
282: if (!r_main_suffix()) {
283: break lab1;
284: }
285: } while (false);
286: cursor = limit - v_2;
287: // do, line 69
288: v_3 = limit - cursor;
289: lab2: do {
290: // call consonant_pair, line 69
291: if (!r_consonant_pair()) {
292: break lab2;
293: }
294: } while (false);
295: cursor = limit - v_3;
296: // do, line 70
297: v_4 = limit - cursor;
298: lab3: do {
299: // call other_suffix, line 70
300: if (!r_other_suffix()) {
301: break lab3;
302: }
303: } while (false);
304: cursor = limit - v_4;
305: cursor = limit_backward;
306: return true;
307: }
308:
309: }
|