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 PorterStemmer extends SnowballProgram {
012:
013: private Among a_0[] = { new Among("s", -1, 3, "", this ),
014: new Among("ies", 0, 2, "", this ),
015: new Among("sses", 0, 1, "", this ),
016: new Among("ss", 0, -1, "", this ) };
017:
018: private Among a_1[] = { new Among("", -1, 3, "", this ),
019: new Among("bb", 0, 2, "", this ),
020: new Among("dd", 0, 2, "", this ),
021: new Among("ff", 0, 2, "", this ),
022: new Among("gg", 0, 2, "", this ),
023: new Among("bl", 0, 1, "", this ),
024: new Among("mm", 0, 2, "", this ),
025: new Among("nn", 0, 2, "", this ),
026: new Among("pp", 0, 2, "", this ),
027: new Among("rr", 0, 2, "", this ),
028: new Among("at", 0, 1, "", this ),
029: new Among("tt", 0, 2, "", this ),
030: new Among("iz", 0, 1, "", this ) };
031:
032: private Among a_2[] = { new Among("ed", -1, 2, "", this ),
033: new Among("eed", 0, 1, "", this ),
034: new Among("ing", -1, 2, "", this ) };
035:
036: private Among a_3[] = { new Among("anci", -1, 3, "", this ),
037: new Among("enci", -1, 2, "", this ),
038: new Among("abli", -1, 4, "", this ),
039: new Among("eli", -1, 6, "", this ),
040: new Among("alli", -1, 9, "", this ),
041: new Among("ousli", -1, 12, "", this ),
042: new Among("entli", -1, 5, "", this ),
043: new Among("aliti", -1, 10, "", this ),
044: new Among("biliti", -1, 14, "", this ),
045: new Among("iviti", -1, 13, "", this ),
046: new Among("tional", -1, 1, "", this ),
047: new Among("ational", 10, 8, "", this ),
048: new Among("alism", -1, 10, "", this ),
049: new Among("ation", -1, 8, "", this ),
050: new Among("ization", 13, 7, "", this ),
051: new Among("izer", -1, 7, "", this ),
052: new Among("ator", -1, 8, "", this ),
053: new Among("iveness", -1, 13, "", this ),
054: new Among("fulness", -1, 11, "", this ),
055: new Among("ousness", -1, 12, "", this ) };
056:
057: private Among a_4[] = { new Among("icate", -1, 2, "", this ),
058: new Among("ative", -1, 3, "", this ),
059: new Among("alize", -1, 1, "", this ),
060: new Among("iciti", -1, 2, "", this ),
061: new Among("ical", -1, 2, "", this ),
062: new Among("ful", -1, 3, "", this ),
063: new Among("ness", -1, 3, "", this ) };
064:
065: private Among a_5[] = { new Among("ic", -1, 1, "", this ),
066: new Among("ance", -1, 1, "", this ),
067: new Among("ence", -1, 1, "", this ),
068: new Among("able", -1, 1, "", this ),
069: new Among("ible", -1, 1, "", this ),
070: new Among("ate", -1, 1, "", this ),
071: new Among("ive", -1, 1, "", this ),
072: new Among("ize", -1, 1, "", this ),
073: new Among("iti", -1, 1, "", this ),
074: new Among("al", -1, 1, "", this ),
075: new Among("ism", -1, 1, "", this ),
076: new Among("ion", -1, 2, "", this ),
077: new Among("er", -1, 1, "", this ),
078: new Among("ous", -1, 1, "", this ),
079: new Among("ant", -1, 1, "", this ),
080: new Among("ent", -1, 1, "", this ),
081: new Among("ment", 15, 1, "", this ),
082: new Among("ement", 16, 1, "", this ),
083: new Among("ou", -1, 1, "", this ) };
084:
085: private static final char g_v[] = { 17, 65, 16, 1 };
086:
087: private static final char g_v_WXY[] = { 1, 17, 65, 208, 1 };
088:
089: private boolean B_Y_found;
090: private int I_p2;
091: private int I_p1;
092:
093: private void copy_from(PorterStemmer other) {
094: B_Y_found = other.B_Y_found;
095: I_p2 = other.I_p2;
096: I_p1 = other.I_p1;
097: super .copy_from(other);
098: }
099:
100: private boolean r_shortv() {
101: // (, line 19
102: if (!(out_grouping_b(g_v_WXY, 89, 121))) {
103: return false;
104: }
105: if (!(in_grouping_b(g_v, 97, 121))) {
106: return false;
107: }
108: if (!(out_grouping_b(g_v, 97, 121))) {
109: return false;
110: }
111: return true;
112: }
113:
114: private boolean r_R1() {
115: if (!(I_p1 <= cursor)) {
116: return false;
117: }
118: return true;
119: }
120:
121: private boolean r_R2() {
122: if (!(I_p2 <= cursor)) {
123: return false;
124: }
125: return true;
126: }
127:
128: private boolean r_Step_1a() {
129: int among_var;
130: // (, line 24
131: // [, line 25
132: ket = cursor;
133: // substring, line 25
134: among_var = find_among_b(a_0, 4);
135: if (among_var == 0) {
136: return false;
137: }
138: // ], line 25
139: bra = cursor;
140: switch (among_var) {
141: case 0:
142: return false;
143: case 1:
144: // (, line 26
145: // <-, line 26
146: slice_from("ss");
147: break;
148: case 2:
149: // (, line 27
150: // <-, line 27
151: slice_from("i");
152: break;
153: case 3:
154: // (, line 29
155: // delete, line 29
156: slice_del();
157: break;
158: }
159: return true;
160: }
161:
162: private boolean r_Step_1b() {
163: int among_var;
164: int v_1;
165: int v_3;
166: int v_4;
167: // (, line 33
168: // [, line 34
169: ket = cursor;
170: // substring, line 34
171: among_var = find_among_b(a_2, 3);
172: if (among_var == 0) {
173: return false;
174: }
175: // ], line 34
176: bra = cursor;
177: switch (among_var) {
178: case 0:
179: return false;
180: case 1:
181: // (, line 35
182: // call R1, line 35
183: if (!r_R1()) {
184: return false;
185: }
186: // <-, line 35
187: slice_from("ee");
188: break;
189: case 2:
190: // (, line 37
191: // test, line 38
192: v_1 = limit - cursor;
193: // gopast, line 38
194: golab0: while (true) {
195: lab1: do {
196: if (!(in_grouping_b(g_v, 97, 121))) {
197: break lab1;
198: }
199: break golab0;
200: } while (false);
201: if (cursor <= limit_backward) {
202: return false;
203: }
204: cursor--;
205: }
206: cursor = limit - v_1;
207: // delete, line 38
208: slice_del();
209: // test, line 39
210: v_3 = limit - cursor;
211: // substring, line 39
212: among_var = find_among_b(a_1, 13);
213: if (among_var == 0) {
214: return false;
215: }
216: cursor = limit - v_3;
217: switch (among_var) {
218: case 0:
219: return false;
220: case 1:
221: // (, line 41
222: // <+, line 41
223: {
224: int c = cursor;
225: insert(cursor, cursor, "e");
226: cursor = c;
227: }
228: break;
229: case 2:
230: // (, line 44
231: // [, line 44
232: ket = cursor;
233: // next, line 44
234: if (cursor <= limit_backward) {
235: return false;
236: }
237: cursor--;
238: // ], line 44
239: bra = cursor;
240: // delete, line 44
241: slice_del();
242: break;
243: case 3:
244: // (, line 45
245: // atmark, line 45
246: if (cursor != I_p1) {
247: return false;
248: }
249: // test, line 45
250: v_4 = limit - cursor;
251: // call shortv, line 45
252: if (!r_shortv()) {
253: return false;
254: }
255: cursor = limit - v_4;
256: // <+, line 45
257: {
258: int c = cursor;
259: insert(cursor, cursor, "e");
260: cursor = c;
261: }
262: break;
263: }
264: break;
265: }
266: return true;
267: }
268:
269: private boolean r_Step_1c() {
270: int v_1;
271: // (, line 51
272: // [, line 52
273: ket = cursor;
274: // or, line 52
275: lab0: do {
276: v_1 = limit - cursor;
277: lab1: do {
278: // literal, line 52
279: if (!(eq_s_b(1, "y"))) {
280: break lab1;
281: }
282: break lab0;
283: } while (false);
284: cursor = limit - v_1;
285: // literal, line 52
286: if (!(eq_s_b(1, "Y"))) {
287: return false;
288: }
289: } while (false);
290: // ], line 52
291: bra = cursor;
292: // gopast, line 53
293: golab2: while (true) {
294: lab3: do {
295: if (!(in_grouping_b(g_v, 97, 121))) {
296: break lab3;
297: }
298: break golab2;
299: } while (false);
300: if (cursor <= limit_backward) {
301: return false;
302: }
303: cursor--;
304: }
305: // <-, line 54
306: slice_from("i");
307: return true;
308: }
309:
310: private boolean r_Step_2() {
311: int among_var;
312: // (, line 57
313: // [, line 58
314: ket = cursor;
315: // substring, line 58
316: among_var = find_among_b(a_3, 20);
317: if (among_var == 0) {
318: return false;
319: }
320: // ], line 58
321: bra = cursor;
322: // call R1, line 58
323: if (!r_R1()) {
324: return false;
325: }
326: switch (among_var) {
327: case 0:
328: return false;
329: case 1:
330: // (, line 59
331: // <-, line 59
332: slice_from("tion");
333: break;
334: case 2:
335: // (, line 60
336: // <-, line 60
337: slice_from("ence");
338: break;
339: case 3:
340: // (, line 61
341: // <-, line 61
342: slice_from("ance");
343: break;
344: case 4:
345: // (, line 62
346: // <-, line 62
347: slice_from("able");
348: break;
349: case 5:
350: // (, line 63
351: // <-, line 63
352: slice_from("ent");
353: break;
354: case 6:
355: // (, line 64
356: // <-, line 64
357: slice_from("e");
358: break;
359: case 7:
360: // (, line 66
361: // <-, line 66
362: slice_from("ize");
363: break;
364: case 8:
365: // (, line 68
366: // <-, line 68
367: slice_from("ate");
368: break;
369: case 9:
370: // (, line 69
371: // <-, line 69
372: slice_from("al");
373: break;
374: case 10:
375: // (, line 71
376: // <-, line 71
377: slice_from("al");
378: break;
379: case 11:
380: // (, line 72
381: // <-, line 72
382: slice_from("ful");
383: break;
384: case 12:
385: // (, line 74
386: // <-, line 74
387: slice_from("ous");
388: break;
389: case 13:
390: // (, line 76
391: // <-, line 76
392: slice_from("ive");
393: break;
394: case 14:
395: // (, line 77
396: // <-, line 77
397: slice_from("ble");
398: break;
399: }
400: return true;
401: }
402:
403: private boolean r_Step_3() {
404: int among_var;
405: // (, line 81
406: // [, line 82
407: ket = cursor;
408: // substring, line 82
409: among_var = find_among_b(a_4, 7);
410: if (among_var == 0) {
411: return false;
412: }
413: // ], line 82
414: bra = cursor;
415: // call R1, line 82
416: if (!r_R1()) {
417: return false;
418: }
419: switch (among_var) {
420: case 0:
421: return false;
422: case 1:
423: // (, line 83
424: // <-, line 83
425: slice_from("al");
426: break;
427: case 2:
428: // (, line 85
429: // <-, line 85
430: slice_from("ic");
431: break;
432: case 3:
433: // (, line 87
434: // delete, line 87
435: slice_del();
436: break;
437: }
438: return true;
439: }
440:
441: private boolean r_Step_4() {
442: int among_var;
443: int v_1;
444: // (, line 91
445: // [, line 92
446: ket = cursor;
447: // substring, line 92
448: among_var = find_among_b(a_5, 19);
449: if (among_var == 0) {
450: return false;
451: }
452: // ], line 92
453: bra = cursor;
454: // call R2, line 92
455: if (!r_R2()) {
456: return false;
457: }
458: switch (among_var) {
459: case 0:
460: return false;
461: case 1:
462: // (, line 95
463: // delete, line 95
464: slice_del();
465: break;
466: case 2:
467: // (, line 96
468: // or, line 96
469: lab0: do {
470: v_1 = limit - cursor;
471: lab1: do {
472: // literal, line 96
473: if (!(eq_s_b(1, "s"))) {
474: break lab1;
475: }
476: break lab0;
477: } while (false);
478: cursor = limit - v_1;
479: // literal, line 96
480: if (!(eq_s_b(1, "t"))) {
481: return false;
482: }
483: } while (false);
484: // delete, line 96
485: slice_del();
486: break;
487: }
488: return true;
489: }
490:
491: private boolean r_Step_5a() {
492: int v_1;
493: int v_2;
494: // (, line 100
495: // [, line 101
496: ket = cursor;
497: // literal, line 101
498: if (!(eq_s_b(1, "e"))) {
499: return false;
500: }
501: // ], line 101
502: bra = cursor;
503: // or, line 102
504: lab0: do {
505: v_1 = limit - cursor;
506: lab1: do {
507: // call R2, line 102
508: if (!r_R2()) {
509: break lab1;
510: }
511: break lab0;
512: } while (false);
513: cursor = limit - v_1;
514: // (, line 102
515: // call R1, line 102
516: if (!r_R1()) {
517: return false;
518: }
519: // not, line 102
520: {
521: v_2 = limit - cursor;
522: lab2: do {
523: // call shortv, line 102
524: if (!r_shortv()) {
525: break lab2;
526: }
527: return false;
528: } while (false);
529: cursor = limit - v_2;
530: }
531: } while (false);
532: // delete, line 103
533: slice_del();
534: return true;
535: }
536:
537: private boolean r_Step_5b() {
538: // (, line 106
539: // [, line 107
540: ket = cursor;
541: // literal, line 107
542: if (!(eq_s_b(1, "l"))) {
543: return false;
544: }
545: // ], line 107
546: bra = cursor;
547: // call R2, line 108
548: if (!r_R2()) {
549: return false;
550: }
551: // literal, line 108
552: if (!(eq_s_b(1, "l"))) {
553: return false;
554: }
555: // delete, line 109
556: slice_del();
557: return true;
558: }
559:
560: public boolean stem() {
561: int v_1;
562: int v_2;
563: int v_3;
564: int v_4;
565: int v_5;
566: int v_10;
567: int v_11;
568: int v_12;
569: int v_13;
570: int v_14;
571: int v_15;
572: int v_16;
573: int v_17;
574: int v_18;
575: int v_19;
576: int v_20;
577: // (, line 113
578: // unset Y_found, line 115
579: B_Y_found = false;
580: // do, line 116
581: v_1 = cursor;
582: lab0: do {
583: // (, line 116
584: // [, line 116
585: bra = cursor;
586: // literal, line 116
587: if (!(eq_s(1, "y"))) {
588: break lab0;
589: }
590: // ], line 116
591: ket = cursor;
592: // <-, line 116
593: slice_from("Y");
594: // set Y_found, line 116
595: B_Y_found = true;
596: } while (false);
597: cursor = v_1;
598: // do, line 117
599: v_2 = cursor;
600: lab1: do {
601: // repeat, line 117
602: replab2: while (true) {
603: v_3 = cursor;
604: lab3: do {
605: // (, line 117
606: // goto, line 117
607: golab4: while (true) {
608: v_4 = cursor;
609: lab5: do {
610: // (, line 117
611: if (!(in_grouping(g_v, 97, 121))) {
612: break lab5;
613: }
614: // [, line 117
615: bra = cursor;
616: // literal, line 117
617: if (!(eq_s(1, "y"))) {
618: break lab5;
619: }
620: // ], line 117
621: ket = cursor;
622: cursor = v_4;
623: break golab4;
624: } while (false);
625: cursor = v_4;
626: if (cursor >= limit) {
627: break lab3;
628: }
629: cursor++;
630: }
631: // <-, line 117
632: slice_from("Y");
633: // set Y_found, line 117
634: B_Y_found = true;
635: continue replab2;
636: } while (false);
637: cursor = v_3;
638: break replab2;
639: }
640: } while (false);
641: cursor = v_2;
642: I_p1 = limit;
643: I_p2 = limit;
644: // do, line 121
645: v_5 = cursor;
646: lab6: do {
647: // (, line 121
648: // gopast, line 122
649: golab7: while (true) {
650: lab8: do {
651: if (!(in_grouping(g_v, 97, 121))) {
652: break lab8;
653: }
654: break golab7;
655: } while (false);
656: if (cursor >= limit) {
657: break lab6;
658: }
659: cursor++;
660: }
661: // gopast, line 122
662: golab9: while (true) {
663: lab10: do {
664: if (!(out_grouping(g_v, 97, 121))) {
665: break lab10;
666: }
667: break golab9;
668: } while (false);
669: if (cursor >= limit) {
670: break lab6;
671: }
672: cursor++;
673: }
674: // setmark p1, line 122
675: I_p1 = cursor;
676: // gopast, line 123
677: golab11: while (true) {
678: lab12: do {
679: if (!(in_grouping(g_v, 97, 121))) {
680: break lab12;
681: }
682: break golab11;
683: } while (false);
684: if (cursor >= limit) {
685: break lab6;
686: }
687: cursor++;
688: }
689: // gopast, line 123
690: golab13: while (true) {
691: lab14: do {
692: if (!(out_grouping(g_v, 97, 121))) {
693: break lab14;
694: }
695: break golab13;
696: } while (false);
697: if (cursor >= limit) {
698: break lab6;
699: }
700: cursor++;
701: }
702: // setmark p2, line 123
703: I_p2 = cursor;
704: } while (false);
705: cursor = v_5;
706: // backwards, line 126
707: limit_backward = cursor;
708: cursor = limit;
709: // (, line 126
710: // do, line 127
711: v_10 = limit - cursor;
712: lab15: do {
713: // call Step_1a, line 127
714: if (!r_Step_1a()) {
715: break lab15;
716: }
717: } while (false);
718: cursor = limit - v_10;
719: // do, line 128
720: v_11 = limit - cursor;
721: lab16: do {
722: // call Step_1b, line 128
723: if (!r_Step_1b()) {
724: break lab16;
725: }
726: } while (false);
727: cursor = limit - v_11;
728: // do, line 129
729: v_12 = limit - cursor;
730: lab17: do {
731: // call Step_1c, line 129
732: if (!r_Step_1c()) {
733: break lab17;
734: }
735: } while (false);
736: cursor = limit - v_12;
737: // do, line 130
738: v_13 = limit - cursor;
739: lab18: do {
740: // call Step_2, line 130
741: if (!r_Step_2()) {
742: break lab18;
743: }
744: } while (false);
745: cursor = limit - v_13;
746: // do, line 131
747: v_14 = limit - cursor;
748: lab19: do {
749: // call Step_3, line 131
750: if (!r_Step_3()) {
751: break lab19;
752: }
753: } while (false);
754: cursor = limit - v_14;
755: // do, line 132
756: v_15 = limit - cursor;
757: lab20: do {
758: // call Step_4, line 132
759: if (!r_Step_4()) {
760: break lab20;
761: }
762: } while (false);
763: cursor = limit - v_15;
764: // do, line 133
765: v_16 = limit - cursor;
766: lab21: do {
767: // call Step_5a, line 133
768: if (!r_Step_5a()) {
769: break lab21;
770: }
771: } while (false);
772: cursor = limit - v_16;
773: // do, line 134
774: v_17 = limit - cursor;
775: lab22: do {
776: // call Step_5b, line 134
777: if (!r_Step_5b()) {
778: break lab22;
779: }
780: } while (false);
781: cursor = limit - v_17;
782: cursor = limit_backward; // do, line 137
783: v_18 = cursor;
784: lab23: do {
785: // (, line 137
786: // Boolean test Y_found, line 137
787: if (!(B_Y_found)) {
788: break lab23;
789: }
790: // repeat, line 137
791: replab24: while (true) {
792: v_19 = cursor;
793: lab25: do {
794: // (, line 137
795: // goto, line 137
796: golab26: while (true) {
797: v_20 = cursor;
798: lab27: do {
799: // (, line 137
800: // [, line 137
801: bra = cursor;
802: // literal, line 137
803: if (!(eq_s(1, "Y"))) {
804: break lab27;
805: }
806: // ], line 137
807: ket = cursor;
808: cursor = v_20;
809: break golab26;
810: } while (false);
811: cursor = v_20;
812: if (cursor >= limit) {
813: break lab25;
814: }
815: cursor++;
816: }
817: // <-, line 137
818: slice_from("y");
819: continue replab24;
820: } while (false);
821: cursor = v_19;
822: break replab24;
823: }
824: } while (false);
825: cursor = v_18;
826: return true;
827: }
828:
829: }
|