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 DanishStemmer extends SnowballProgram {
012:
013: private Among a_0[] = { new Among("hed", -1, 1, "", this ),
014: new Among("ethed", 0, 1, "", this ),
015: new Among("ered", -1, 1, "", this ),
016: new Among("e", -1, 1, "", this ),
017: new Among("erede", 3, 1, "", this ),
018: new Among("ende", 3, 1, "", this ),
019: new Among("erende", 5, 1, "", this ),
020: new Among("ene", 3, 1, "", this ),
021: new Among("erne", 3, 1, "", this ),
022: new Among("ere", 3, 1, "", this ),
023: new Among("en", -1, 1, "", this ),
024: new Among("heden", 10, 1, "", this ),
025: new Among("eren", 10, 1, "", this ),
026: new Among("er", -1, 1, "", this ),
027: new Among("heder", 13, 1, "", this ),
028: new Among("erer", 13, 1, "", this ),
029: new Among("s", -1, 2, "", this ),
030: new Among("heds", 16, 1, "", this ),
031: new Among("es", 16, 1, "", this ),
032: new Among("endes", 18, 1, "", this ),
033: new Among("erendes", 19, 1, "", this ),
034: new Among("enes", 18, 1, "", this ),
035: new Among("ernes", 18, 1, "", this ),
036: new Among("eres", 18, 1, "", this ),
037: new Among("ens", 16, 1, "", this ),
038: new Among("hedens", 24, 1, "", this ),
039: new Among("erens", 24, 1, "", this ),
040: new Among("ers", 16, 1, "", this ),
041: new Among("ets", 16, 1, "", this ),
042: new Among("erets", 28, 1, "", this ),
043: new Among("et", -1, 1, "", this ),
044: new Among("eret", 30, 1, "", this ) };
045:
046: private Among a_1[] = { new Among("gd", -1, -1, "", this ),
047: new Among("dt", -1, -1, "", this ),
048: new Among("gt", -1, -1, "", this ),
049: new Among("kt", -1, -1, "", this ) };
050:
051: private Among a_2[] = { new Among("ig", -1, 1, "", this ),
052: new Among("lig", 0, 1, "", this ),
053: new Among("elig", 1, 1, "", this ),
054: new Among("els", -1, 1, "", this ),
055: new Among("l\u00F8st", -1, 2, "", this ) };
056:
057: private static final char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0,
058: 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 };
059:
060: private static final char g_s_ending[] = { 239, 254, 42, 3, 0, 0,
061: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 };
062:
063: private int I_p1;
064: private StringBuffer S_ch = new StringBuffer();
065:
066: private void copy_from(DanishStemmer other) {
067: I_p1 = other.I_p1;
068: S_ch = other.S_ch;
069: super .copy_from(other);
070: }
071:
072: private boolean r_mark_regions() {
073: int v_1;
074: // (, line 29
075: I_p1 = limit;
076: // goto, line 33
077: golab0: while (true) {
078: v_1 = cursor;
079: lab1: do {
080: if (!(in_grouping(g_v, 97, 248))) {
081: break lab1;
082: }
083: cursor = v_1;
084: break golab0;
085: } while (false);
086: cursor = v_1;
087: if (cursor >= limit) {
088: return false;
089: }
090: cursor++;
091: }
092: // gopast, line 33
093: golab2: while (true) {
094: lab3: do {
095: if (!(out_grouping(g_v, 97, 248))) {
096: break lab3;
097: }
098: break golab2;
099: } while (false);
100: if (cursor >= limit) {
101: return false;
102: }
103: cursor++;
104: }
105: // setmark p1, line 33
106: I_p1 = cursor;
107: // try, line 34
108: lab4: do {
109: // (, line 34
110: if (!(I_p1 < 3)) {
111: break lab4;
112: }
113: I_p1 = 3;
114: } while (false);
115: return true;
116: }
117:
118: private boolean r_main_suffix() {
119: int among_var;
120: int v_1;
121: int v_2;
122: // (, line 39
123: // setlimit, line 40
124: v_1 = limit - cursor;
125: // tomark, line 40
126: if (cursor < I_p1) {
127: return false;
128: }
129: cursor = I_p1;
130: v_2 = limit_backward;
131: limit_backward = cursor;
132: cursor = limit - v_1;
133: // (, line 40
134: // [, line 40
135: ket = cursor;
136: // substring, line 40
137: among_var = find_among_b(a_0, 32);
138: if (among_var == 0) {
139: limit_backward = v_2;
140: return false;
141: }
142: // ], line 40
143: bra = cursor;
144: limit_backward = v_2;
145: switch (among_var) {
146: case 0:
147: return false;
148: case 1:
149: // (, line 47
150: // delete, line 47
151: slice_del();
152: break;
153: case 2:
154: // (, line 49
155: if (!(in_grouping_b(g_s_ending, 97, 229))) {
156: return false;
157: }
158: // delete, line 49
159: slice_del();
160: break;
161: }
162: return true;
163: }
164:
165: private boolean r_consonant_pair() {
166: int v_1;
167: int v_2;
168: int v_3;
169: // (, line 53
170: // test, line 54
171: v_1 = limit - cursor;
172: // (, line 54
173: // setlimit, line 55
174: v_2 = limit - cursor;
175: // tomark, line 55
176: if (cursor < I_p1) {
177: return false;
178: }
179: cursor = I_p1;
180: v_3 = limit_backward;
181: limit_backward = cursor;
182: cursor = limit - v_2;
183: // (, line 55
184: // [, line 55
185: ket = cursor;
186: // substring, line 55
187: if (find_among_b(a_1, 4) == 0) {
188: limit_backward = v_3;
189: return false;
190: }
191: // ], line 55
192: bra = cursor;
193: limit_backward = v_3;
194: cursor = limit - v_1;
195: // next, line 61
196: if (cursor <= limit_backward) {
197: return false;
198: }
199: cursor--;
200: // ], line 61
201: bra = cursor;
202: // delete, line 61
203: slice_del();
204: return true;
205: }
206:
207: private boolean r_other_suffix() {
208: int among_var;
209: int v_1;
210: int v_2;
211: int v_3;
212: int v_4;
213: // (, line 64
214: // do, line 65
215: v_1 = limit - cursor;
216: lab0: do {
217: // (, line 65
218: // [, line 65
219: ket = cursor;
220: // literal, line 65
221: if (!(eq_s_b(2, "st"))) {
222: break lab0;
223: }
224: // ], line 65
225: bra = cursor;
226: // literal, line 65
227: if (!(eq_s_b(2, "ig"))) {
228: break lab0;
229: }
230: // delete, line 65
231: slice_del();
232: } while (false);
233: cursor = limit - v_1;
234: // setlimit, line 66
235: v_2 = limit - cursor;
236: // tomark, line 66
237: if (cursor < I_p1) {
238: return false;
239: }
240: cursor = I_p1;
241: v_3 = limit_backward;
242: limit_backward = cursor;
243: cursor = limit - v_2;
244: // (, line 66
245: // [, line 66
246: ket = cursor;
247: // substring, line 66
248: among_var = find_among_b(a_2, 5);
249: if (among_var == 0) {
250: limit_backward = v_3;
251: return false;
252: }
253: // ], line 66
254: bra = cursor;
255: limit_backward = v_3;
256: switch (among_var) {
257: case 0:
258: return false;
259: case 1:
260: // (, line 69
261: // delete, line 69
262: slice_del();
263: // do, line 69
264: v_4 = limit - cursor;
265: lab1: do {
266: // call consonant_pair, line 69
267: if (!r_consonant_pair()) {
268: break lab1;
269: }
270: } while (false);
271: cursor = limit - v_4;
272: break;
273: case 2:
274: // (, line 71
275: // <-, line 71
276: slice_from("l\u00F8s");
277: break;
278: }
279: return true;
280: }
281:
282: private boolean r_undouble() {
283: int v_1;
284: int v_2;
285: // (, line 74
286: // setlimit, line 75
287: v_1 = limit - cursor;
288: // tomark, line 75
289: if (cursor < I_p1) {
290: return false;
291: }
292: cursor = I_p1;
293: v_2 = limit_backward;
294: limit_backward = cursor;
295: cursor = limit - v_1;
296: // (, line 75
297: // [, line 75
298: ket = cursor;
299: if (!(out_grouping_b(g_v, 97, 248))) {
300: limit_backward = v_2;
301: return false;
302: }
303: // ], line 75
304: bra = cursor;
305: // -> ch, line 75
306: S_ch = slice_to(S_ch);
307: limit_backward = v_2;
308: // name ch, line 76
309: if (!(eq_v_b(S_ch))) {
310: return false;
311: }
312: // delete, line 77
313: slice_del();
314: return true;
315: }
316:
317: public boolean stem() {
318: int v_1;
319: int v_2;
320: int v_3;
321: int v_4;
322: int v_5;
323: // (, line 81
324: // do, line 83
325: v_1 = cursor;
326: lab0: do {
327: // call mark_regions, line 83
328: if (!r_mark_regions()) {
329: break lab0;
330: }
331: } while (false);
332: cursor = v_1;
333: // backwards, line 84
334: limit_backward = cursor;
335: cursor = limit;
336: // (, line 84
337: // do, line 85
338: v_2 = limit - cursor;
339: lab1: do {
340: // call main_suffix, line 85
341: if (!r_main_suffix()) {
342: break lab1;
343: }
344: } while (false);
345: cursor = limit - v_2;
346: // do, line 86
347: v_3 = limit - cursor;
348: lab2: do {
349: // call consonant_pair, line 86
350: if (!r_consonant_pair()) {
351: break lab2;
352: }
353: } while (false);
354: cursor = limit - v_3;
355: // do, line 87
356: v_4 = limit - cursor;
357: lab3: do {
358: // call other_suffix, line 87
359: if (!r_other_suffix()) {
360: break lab3;
361: }
362: } while (false);
363: cursor = limit - v_4;
364: // do, line 88
365: v_5 = limit - cursor;
366: lab4: do {
367: // call undouble, line 88
368: if (!r_undouble()) {
369: break lab4;
370: }
371: } while (false);
372: cursor = limit - v_5;
373: cursor = limit_backward;
374: return true;
375: }
376:
377: }
|