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 NorwegianStemmer extends SnowballProgram {
012:
013: private Among a_0[] = { new Among("a", -1, 1, "", this ),
014: new Among("e", -1, 1, "", this ),
015: new Among("ede", 1, 1, "", this ),
016: new Among("ande", 1, 1, "", this ),
017: new Among("ende", 1, 1, "", this ),
018: new Among("ane", 1, 1, "", this ),
019: new Among("ene", 1, 1, "", this ),
020: new Among("hetene", 6, 1, "", this ),
021: new Among("erte", 1, 3, "", this ),
022: new Among("en", -1, 1, "", this ),
023: new Among("heten", 9, 1, "", this ),
024: new Among("ar", -1, 1, "", this ),
025: new Among("er", -1, 1, "", this ),
026: new Among("heter", 12, 1, "", this ),
027: new Among("s", -1, 2, "", this ),
028: new Among("as", 14, 1, "", this ),
029: new Among("es", 14, 1, "", this ),
030: new Among("edes", 16, 1, "", this ),
031: new Among("endes", 16, 1, "", this ),
032: new Among("enes", 16, 1, "", this ),
033: new Among("hetenes", 19, 1, "", this ),
034: new Among("ens", 14, 1, "", this ),
035: new Among("hetens", 21, 1, "", this ),
036: new Among("ers", 14, 1, "", this ),
037: new Among("ets", 14, 1, "", this ),
038: new Among("et", -1, 1, "", this ),
039: new Among("het", 25, 1, "", this ),
040: new Among("ert", -1, 3, "", this ),
041: new Among("ast", -1, 1, "", this ) };
042:
043: private Among a_1[] = { new Among("dt", -1, -1, "", this ),
044: new Among("vt", -1, -1, "", this ) };
045:
046: private Among a_2[] = { new Among("leg", -1, 1, "", this ),
047: new Among("eleg", 0, 1, "", this ),
048: new Among("ig", -1, 1, "", this ),
049: new Among("eig", 2, 1, "", this ),
050: new Among("lig", 2, 1, "", this ),
051: new Among("elig", 4, 1, "", this ),
052: new Among("els", -1, 1, "", this ),
053: new Among("lov", -1, 1, "", this ),
054: new Among("elov", 7, 1, "", this ),
055: new Among("slov", 7, 1, "", this ),
056: new Among("hetslov", 9, 1, "", this ) };
057:
058: private static final char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0,
059: 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 };
060:
061: private static final char g_s_ending[] = { 119, 127, 149, 1 };
062:
063: private int I_p1;
064:
065: private void copy_from(NorwegianStemmer other) {
066: I_p1 = other.I_p1;
067: super .copy_from(other);
068: }
069:
070: private boolean r_mark_regions() {
071: int v_1;
072: // (, line 26
073: I_p1 = limit;
074: // goto, line 30
075: golab0: while (true) {
076: v_1 = cursor;
077: lab1: do {
078: if (!(in_grouping(g_v, 97, 248))) {
079: break lab1;
080: }
081: cursor = v_1;
082: break golab0;
083: } while (false);
084: cursor = v_1;
085: if (cursor >= limit) {
086: return false;
087: }
088: cursor++;
089: }
090: // gopast, line 30
091: golab2: while (true) {
092: lab3: do {
093: if (!(out_grouping(g_v, 97, 248))) {
094: break lab3;
095: }
096: break golab2;
097: } while (false);
098: if (cursor >= limit) {
099: return false;
100: }
101: cursor++;
102: }
103: // setmark p1, line 30
104: I_p1 = cursor;
105: // try, line 31
106: lab4: do {
107: // (, line 31
108: if (!(I_p1 < 3)) {
109: break lab4;
110: }
111: I_p1 = 3;
112: } while (false);
113: return true;
114: }
115:
116: private boolean r_main_suffix() {
117: int among_var;
118: int v_1;
119: int v_2;
120: // (, line 36
121: // setlimit, line 37
122: v_1 = limit - cursor;
123: // tomark, line 37
124: if (cursor < I_p1) {
125: return false;
126: }
127: cursor = I_p1;
128: v_2 = limit_backward;
129: limit_backward = cursor;
130: cursor = limit - v_1;
131: // (, line 37
132: // [, line 37
133: ket = cursor;
134: // substring, line 37
135: among_var = find_among_b(a_0, 29);
136: if (among_var == 0) {
137: limit_backward = v_2;
138: return false;
139: }
140: // ], line 37
141: bra = cursor;
142: limit_backward = v_2;
143: switch (among_var) {
144: case 0:
145: return false;
146: case 1:
147: // (, line 43
148: // delete, line 43
149: slice_del();
150: break;
151: case 2:
152: // (, line 45
153: if (!(in_grouping_b(g_s_ending, 98, 122))) {
154: return false;
155: }
156: // delete, line 45
157: slice_del();
158: break;
159: case 3:
160: // (, line 47
161: // <-, line 47
162: slice_from("er");
163: break;
164: }
165: return true;
166: }
167:
168: private boolean r_consonant_pair() {
169: int v_1;
170: int v_2;
171: int v_3;
172: // (, line 51
173: // test, line 52
174: v_1 = limit - cursor;
175: // (, line 52
176: // setlimit, line 53
177: v_2 = limit - cursor;
178: // tomark, line 53
179: if (cursor < I_p1) {
180: return false;
181: }
182: cursor = I_p1;
183: v_3 = limit_backward;
184: limit_backward = cursor;
185: cursor = limit - v_2;
186: // (, line 53
187: // [, line 53
188: ket = cursor;
189: // substring, line 53
190: if (find_among_b(a_1, 2) == 0) {
191: limit_backward = v_3;
192: return false;
193: }
194: // ], line 53
195: bra = cursor;
196: limit_backward = v_3;
197: cursor = limit - v_1;
198: // next, line 58
199: if (cursor <= limit_backward) {
200: return false;
201: }
202: cursor--;
203: // ], line 58
204: bra = cursor;
205: // delete, line 58
206: slice_del();
207: return true;
208: }
209:
210: private boolean r_other_suffix() {
211: int among_var;
212: int v_1;
213: int v_2;
214: // (, line 61
215: // setlimit, line 62
216: v_1 = limit - cursor;
217: // tomark, line 62
218: if (cursor < I_p1) {
219: return false;
220: }
221: cursor = I_p1;
222: v_2 = limit_backward;
223: limit_backward = cursor;
224: cursor = limit - v_1;
225: // (, line 62
226: // [, line 62
227: ket = cursor;
228: // substring, line 62
229: among_var = find_among_b(a_2, 11);
230: if (among_var == 0) {
231: limit_backward = v_2;
232: return false;
233: }
234: // ], line 62
235: bra = cursor;
236: limit_backward = v_2;
237: switch (among_var) {
238: case 0:
239: return false;
240: case 1:
241: // (, line 66
242: // delete, line 66
243: slice_del();
244: break;
245: }
246: return true;
247: }
248:
249: public boolean stem() {
250: int v_1;
251: int v_2;
252: int v_3;
253: int v_4;
254: // (, line 71
255: // do, line 73
256: v_1 = cursor;
257: lab0: do {
258: // call mark_regions, line 73
259: if (!r_mark_regions()) {
260: break lab0;
261: }
262: } while (false);
263: cursor = v_1;
264: // backwards, line 74
265: limit_backward = cursor;
266: cursor = limit;
267: // (, line 74
268: // do, line 75
269: v_2 = limit - cursor;
270: lab1: do {
271: // call main_suffix, line 75
272: if (!r_main_suffix()) {
273: break lab1;
274: }
275: } while (false);
276: cursor = limit - v_2;
277: // do, line 76
278: v_3 = limit - cursor;
279: lab2: do {
280: // call consonant_pair, line 76
281: if (!r_consonant_pair()) {
282: break lab2;
283: }
284: } while (false);
285: cursor = limit - v_3;
286: // do, line 77
287: v_4 = limit - cursor;
288: lab3: do {
289: // call other_suffix, line 77
290: if (!r_other_suffix()) {
291: break lab3;
292: }
293: } while (false);
294: cursor = limit - v_4;
295: cursor = limit_backward;
296: return true;
297: }
298:
299: }
|