1 // This file was generated automatically by the Snowball to Java compiler
2
3 package org.tartarus.snowball.ext;
4
5 import org.tartarus.snowball.Among;
6
7 /***
8 * This class was automatically generated by a Snowball to Java compiler
9 * It implements the stemming algorithm defined by a snowball script.
10 */
11
12 public class porterStemmer extends org.tartarus.snowball.SnowballStemmer {
13
14 private static final long serialVersionUID = 1L;
15
16 private final static porterStemmer methodObject = new porterStemmer ();
17
18 private final static Among a_0[] = {
19 new Among ( "s", -1, 3, "", methodObject ),
20 new Among ( "ies", 0, 2, "", methodObject ),
21 new Among ( "sses", 0, 1, "", methodObject ),
22 new Among ( "ss", 0, -1, "", methodObject )
23 };
24
25 private final static Among a_1[] = {
26 new Among ( "", -1, 3, "", methodObject ),
27 new Among ( "bb", 0, 2, "", methodObject ),
28 new Among ( "dd", 0, 2, "", methodObject ),
29 new Among ( "ff", 0, 2, "", methodObject ),
30 new Among ( "gg", 0, 2, "", methodObject ),
31 new Among ( "bl", 0, 1, "", methodObject ),
32 new Among ( "mm", 0, 2, "", methodObject ),
33 new Among ( "nn", 0, 2, "", methodObject ),
34 new Among ( "pp", 0, 2, "", methodObject ),
35 new Among ( "rr", 0, 2, "", methodObject ),
36 new Among ( "at", 0, 1, "", methodObject ),
37 new Among ( "tt", 0, 2, "", methodObject ),
38 new Among ( "iz", 0, 1, "", methodObject )
39 };
40
41 private final static Among a_2[] = {
42 new Among ( "ed", -1, 2, "", methodObject ),
43 new Among ( "eed", 0, 1, "", methodObject ),
44 new Among ( "ing", -1, 2, "", methodObject )
45 };
46
47 private final static Among a_3[] = {
48 new Among ( "anci", -1, 3, "", methodObject ),
49 new Among ( "enci", -1, 2, "", methodObject ),
50 new Among ( "abli", -1, 4, "", methodObject ),
51 new Among ( "eli", -1, 6, "", methodObject ),
52 new Among ( "alli", -1, 9, "", methodObject ),
53 new Among ( "ousli", -1, 12, "", methodObject ),
54 new Among ( "entli", -1, 5, "", methodObject ),
55 new Among ( "aliti", -1, 10, "", methodObject ),
56 new Among ( "biliti", -1, 14, "", methodObject ),
57 new Among ( "iviti", -1, 13, "", methodObject ),
58 new Among ( "tional", -1, 1, "", methodObject ),
59 new Among ( "ational", 10, 8, "", methodObject ),
60 new Among ( "alism", -1, 10, "", methodObject ),
61 new Among ( "ation", -1, 8, "", methodObject ),
62 new Among ( "ization", 13, 7, "", methodObject ),
63 new Among ( "izer", -1, 7, "", methodObject ),
64 new Among ( "ator", -1, 8, "", methodObject ),
65 new Among ( "iveness", -1, 13, "", methodObject ),
66 new Among ( "fulness", -1, 11, "", methodObject ),
67 new Among ( "ousness", -1, 12, "", methodObject )
68 };
69
70 private final static Among a_4[] = {
71 new Among ( "icate", -1, 2, "", methodObject ),
72 new Among ( "ative", -1, 3, "", methodObject ),
73 new Among ( "alize", -1, 1, "", methodObject ),
74 new Among ( "iciti", -1, 2, "", methodObject ),
75 new Among ( "ical", -1, 2, "", methodObject ),
76 new Among ( "ful", -1, 3, "", methodObject ),
77 new Among ( "ness", -1, 3, "", methodObject )
78 };
79
80 private final static Among a_5[] = {
81 new Among ( "ic", -1, 1, "", methodObject ),
82 new Among ( "ance", -1, 1, "", methodObject ),
83 new Among ( "ence", -1, 1, "", methodObject ),
84 new Among ( "able", -1, 1, "", methodObject ),
85 new Among ( "ible", -1, 1, "", methodObject ),
86 new Among ( "ate", -1, 1, "", methodObject ),
87 new Among ( "ive", -1, 1, "", methodObject ),
88 new Among ( "ize", -1, 1, "", methodObject ),
89 new Among ( "iti", -1, 1, "", methodObject ),
90 new Among ( "al", -1, 1, "", methodObject ),
91 new Among ( "ism", -1, 1, "", methodObject ),
92 new Among ( "ion", -1, 2, "", methodObject ),
93 new Among ( "er", -1, 1, "", methodObject ),
94 new Among ( "ous", -1, 1, "", methodObject ),
95 new Among ( "ant", -1, 1, "", methodObject ),
96 new Among ( "ent", -1, 1, "", methodObject ),
97 new Among ( "ment", 15, 1, "", methodObject ),
98 new Among ( "ement", 16, 1, "", methodObject ),
99 new Among ( "ou", -1, 1, "", methodObject )
100 };
101
102 private static final char g_v[] = {17, 65, 16, 1 };
103
104 private static final char g_v_WXY[] = {1, 17, 65, 208, 1 };
105
106 private boolean B_Y_found;
107 private int I_p2;
108 private int I_p1;
109
110 private void copy_from(porterStemmer other) {
111 B_Y_found = other.B_Y_found;
112 I_p2 = other.I_p2;
113 I_p1 = other.I_p1;
114 super.copy_from(other);
115 }
116
117 private boolean r_shortv() {
118 // (, line 19
119 if (!(out_grouping_b(g_v_WXY, 89, 121)))
120 {
121 return false;
122 }
123 if (!(in_grouping_b(g_v, 97, 121)))
124 {
125 return false;
126 }
127 if (!(out_grouping_b(g_v, 97, 121)))
128 {
129 return false;
130 }
131 return true;
132 }
133
134 private boolean r_R1() {
135 if (!(I_p1 <= cursor))
136 {
137 return false;
138 }
139 return true;
140 }
141
142 private boolean r_R2() {
143 if (!(I_p2 <= cursor))
144 {
145 return false;
146 }
147 return true;
148 }
149
150 private boolean r_Step_1a() {
151 int among_var;
152 // (, line 24
153 // [, line 25
154 ket = cursor;
155 // substring, line 25
156 among_var = find_among_b(a_0, 4);
157 if (among_var == 0)
158 {
159 return false;
160 }
161 // ], line 25
162 bra = cursor;
163 switch(among_var) {
164 case 0:
165 return false;
166 case 1:
167 // (, line 26
168 // <-, line 26
169 slice_from("ss");
170 break;
171 case 2:
172 // (, line 27
173 // <-, line 27
174 slice_from("i");
175 break;
176 case 3:
177 // (, line 29
178 // delete, line 29
179 slice_del();
180 break;
181 }
182 return true;
183 }
184
185 private boolean r_Step_1b() {
186 int among_var;
187 int v_1;
188 int v_3;
189 int v_4;
190 // (, line 33
191 // [, line 34
192 ket = cursor;
193 // substring, line 34
194 among_var = find_among_b(a_2, 3);
195 if (among_var == 0)
196 {
197 return false;
198 }
199 // ], line 34
200 bra = cursor;
201 switch(among_var) {
202 case 0:
203 return false;
204 case 1:
205 // (, line 35
206 // call R1, line 35
207 if (!r_R1())
208 {
209 return false;
210 }
211 // <-, line 35
212 slice_from("ee");
213 break;
214 case 2:
215 // (, line 37
216 // test, line 38
217 v_1 = limit - cursor;
218 // gopast, line 38
219 golab0: while(true)
220 {
221 lab1: do {
222 if (!(in_grouping_b(g_v, 97, 121)))
223 {
224 break lab1;
225 }
226 break golab0;
227 } while (false);
228 if (cursor <= limit_backward)
229 {
230 return false;
231 }
232 cursor--;
233 }
234 cursor = limit - v_1;
235 // delete, line 38
236 slice_del();
237 // test, line 39
238 v_3 = limit - cursor;
239 // substring, line 39
240 among_var = find_among_b(a_1, 13);
241 if (among_var == 0)
242 {
243 return false;
244 }
245 cursor = limit - v_3;
246 switch(among_var) {
247 case 0:
248 return false;
249 case 1:
250 // (, line 41
251 // <+, line 41
252 {
253 int c = cursor;
254 insert(cursor, cursor, "e");
255 cursor = c;
256 }
257 break;
258 case 2:
259 // (, line 44
260 // [, line 44
261 ket = cursor;
262 // next, line 44
263 if (cursor <= limit_backward)
264 {
265 return false;
266 }
267 cursor--;
268 // ], line 44
269 bra = cursor;
270 // delete, line 44
271 slice_del();
272 break;
273 case 3:
274 // (, line 45
275 // atmark, line 45
276 if (cursor != I_p1)
277 {
278 return false;
279 }
280 // test, line 45
281 v_4 = limit - cursor;
282 // call shortv, line 45
283 if (!r_shortv())
284 {
285 return false;
286 }
287 cursor = limit - v_4;
288 // <+, line 45
289 {
290 int c = cursor;
291 insert(cursor, cursor, "e");
292 cursor = c;
293 }
294 break;
295 }
296 break;
297 }
298 return true;
299 }
300
301 private boolean r_Step_1c() {
302 int v_1;
303 // (, line 51
304 // [, line 52
305 ket = cursor;
306 // or, line 52
307 lab0: do {
308 v_1 = limit - cursor;
309 lab1: do {
310 // literal, line 52
311 if (!(eq_s_b(1, "y")))
312 {
313 break lab1;
314 }
315 break lab0;
316 } while (false);
317 cursor = limit - v_1;
318 // literal, line 52
319 if (!(eq_s_b(1, "Y")))
320 {
321 return false;
322 }
323 } while (false);
324 // ], line 52
325 bra = cursor;
326 // gopast, line 53
327 golab2: while(true)
328 {
329 lab3: do {
330 if (!(in_grouping_b(g_v, 97, 121)))
331 {
332 break lab3;
333 }
334 break golab2;
335 } while (false);
336 if (cursor <= limit_backward)
337 {
338 return false;
339 }
340 cursor--;
341 }
342 // <-, line 54
343 slice_from("i");
344 return true;
345 }
346
347 private boolean r_Step_2() {
348 int among_var;
349 // (, line 57
350 // [, line 58
351 ket = cursor;
352 // substring, line 58
353 among_var = find_among_b(a_3, 20);
354 if (among_var == 0)
355 {
356 return false;
357 }
358 // ], line 58
359 bra = cursor;
360 // call R1, line 58
361 if (!r_R1())
362 {
363 return false;
364 }
365 switch(among_var) {
366 case 0:
367 return false;
368 case 1:
369 // (, line 59
370 // <-, line 59
371 slice_from("tion");
372 break;
373 case 2:
374 // (, line 60
375 // <-, line 60
376 slice_from("ence");
377 break;
378 case 3:
379 // (, line 61
380 // <-, line 61
381 slice_from("ance");
382 break;
383 case 4:
384 // (, line 62
385 // <-, line 62
386 slice_from("able");
387 break;
388 case 5:
389 // (, line 63
390 // <-, line 63
391 slice_from("ent");
392 break;
393 case 6:
394 // (, line 64
395 // <-, line 64
396 slice_from("e");
397 break;
398 case 7:
399 // (, line 66
400 // <-, line 66
401 slice_from("ize");
402 break;
403 case 8:
404 // (, line 68
405 // <-, line 68
406 slice_from("ate");
407 break;
408 case 9:
409 // (, line 69
410 // <-, line 69
411 slice_from("al");
412 break;
413 case 10:
414 // (, line 71
415 // <-, line 71
416 slice_from("al");
417 break;
418 case 11:
419 // (, line 72
420 // <-, line 72
421 slice_from("ful");
422 break;
423 case 12:
424 // (, line 74
425 // <-, line 74
426 slice_from("ous");
427 break;
428 case 13:
429 // (, line 76
430 // <-, line 76
431 slice_from("ive");
432 break;
433 case 14:
434 // (, line 77
435 // <-, line 77
436 slice_from("ble");
437 break;
438 }
439 return true;
440 }
441
442 private boolean r_Step_3() {
443 int among_var;
444 // (, line 81
445 // [, line 82
446 ket = cursor;
447 // substring, line 82
448 among_var = find_among_b(a_4, 7);
449 if (among_var == 0)
450 {
451 return false;
452 }
453 // ], line 82
454 bra = cursor;
455 // call R1, line 82
456 if (!r_R1())
457 {
458 return false;
459 }
460 switch(among_var) {
461 case 0:
462 return false;
463 case 1:
464 // (, line 83
465 // <-, line 83
466 slice_from("al");
467 break;
468 case 2:
469 // (, line 85
470 // <-, line 85
471 slice_from("ic");
472 break;
473 case 3:
474 // (, line 87
475 // delete, line 87
476 slice_del();
477 break;
478 }
479 return true;
480 }
481
482 private boolean r_Step_4() {
483 int among_var;
484 int v_1;
485 // (, line 91
486 // [, line 92
487 ket = cursor;
488 // substring, line 92
489 among_var = find_among_b(a_5, 19);
490 if (among_var == 0)
491 {
492 return false;
493 }
494 // ], line 92
495 bra = cursor;
496 // call R2, line 92
497 if (!r_R2())
498 {
499 return false;
500 }
501 switch(among_var) {
502 case 0:
503 return false;
504 case 1:
505 // (, line 95
506 // delete, line 95
507 slice_del();
508 break;
509 case 2:
510 // (, line 96
511 // or, line 96
512 lab0: do {
513 v_1 = limit - cursor;
514 lab1: do {
515 // literal, line 96
516 if (!(eq_s_b(1, "s")))
517 {
518 break lab1;
519 }
520 break lab0;
521 } while (false);
522 cursor = limit - v_1;
523 // literal, line 96
524 if (!(eq_s_b(1, "t")))
525 {
526 return false;
527 }
528 } while (false);
529 // delete, line 96
530 slice_del();
531 break;
532 }
533 return true;
534 }
535
536 private boolean r_Step_5a() {
537 int v_1;
538 int v_2;
539 // (, line 100
540 // [, line 101
541 ket = cursor;
542 // literal, line 101
543 if (!(eq_s_b(1, "e")))
544 {
545 return false;
546 }
547 // ], line 101
548 bra = cursor;
549 // or, line 102
550 lab0: do {
551 v_1 = limit - cursor;
552 lab1: do {
553 // call R2, line 102
554 if (!r_R2())
555 {
556 break lab1;
557 }
558 break lab0;
559 } while (false);
560 cursor = limit - v_1;
561 // (, line 102
562 // call R1, line 102
563 if (!r_R1())
564 {
565 return false;
566 }
567 // not, line 102
568 {
569 v_2 = limit - cursor;
570 lab2: do {
571 // call shortv, line 102
572 if (!r_shortv())
573 {
574 break lab2;
575 }
576 return false;
577 } while (false);
578 cursor = limit - v_2;
579 }
580 } while (false);
581 // delete, line 103
582 slice_del();
583 return true;
584 }
585
586 private boolean r_Step_5b() {
587 // (, line 106
588 // [, line 107
589 ket = cursor;
590 // literal, line 107
591 if (!(eq_s_b(1, "l")))
592 {
593 return false;
594 }
595 // ], line 107
596 bra = cursor;
597 // call R2, line 108
598 if (!r_R2())
599 {
600 return false;
601 }
602 // literal, line 108
603 if (!(eq_s_b(1, "l")))
604 {
605 return false;
606 }
607 // delete, line 109
608 slice_del();
609 return true;
610 }
611
612 public boolean stem() {
613 int v_1;
614 int v_2;
615 int v_3;
616 int v_4;
617 int v_5;
618 int v_10;
619 int v_11;
620 int v_12;
621 int v_13;
622 int v_14;
623 int v_15;
624 int v_16;
625 int v_17;
626 int v_18;
627 int v_19;
628 int v_20;
629 // (, line 113
630 // unset Y_found, line 115
631 B_Y_found = false;
632 // do, line 116
633 v_1 = cursor;
634 lab0: do {
635 // (, line 116
636 // [, line 116
637 bra = cursor;
638 // literal, line 116
639 if (!(eq_s(1, "y")))
640 {
641 break lab0;
642 }
643 // ], line 116
644 ket = cursor;
645 // <-, line 116
646 slice_from("Y");
647 // set Y_found, line 116
648 B_Y_found = true;
649 } while (false);
650 cursor = v_1;
651 // do, line 117
652 v_2 = cursor;
653 lab1: do {
654 // repeat, line 117
655 replab2: while(true)
656 {
657 v_3 = cursor;
658 lab3: do {
659 // (, line 117
660 // goto, line 117
661 golab4: while(true)
662 {
663 v_4 = cursor;
664 lab5: do {
665 // (, line 117
666 if (!(in_grouping(g_v, 97, 121)))
667 {
668 break lab5;
669 }
670 // [, line 117
671 bra = cursor;
672 // literal, line 117
673 if (!(eq_s(1, "y")))
674 {
675 break lab5;
676 }
677 // ], line 117
678 ket = cursor;
679 cursor = v_4;
680 break golab4;
681 } while (false);
682 cursor = v_4;
683 if (cursor >= limit)
684 {
685 break lab3;
686 }
687 cursor++;
688 }
689 // <-, line 117
690 slice_from("Y");
691 // set Y_found, line 117
692 B_Y_found = true;
693 continue replab2;
694 } while (false);
695 cursor = v_3;
696 break replab2;
697 }
698 } while (false);
699 cursor = v_2;
700 I_p1 = limit;
701 I_p2 = limit;
702 // do, line 121
703 v_5 = cursor;
704 lab6: do {
705 // (, line 121
706 // gopast, line 122
707 golab7: while(true)
708 {
709 lab8: do {
710 if (!(in_grouping(g_v, 97, 121)))
711 {
712 break lab8;
713 }
714 break golab7;
715 } while (false);
716 if (cursor >= limit)
717 {
718 break lab6;
719 }
720 cursor++;
721 }
722 // gopast, line 122
723 golab9: while(true)
724 {
725 lab10: do {
726 if (!(out_grouping(g_v, 97, 121)))
727 {
728 break lab10;
729 }
730 break golab9;
731 } while (false);
732 if (cursor >= limit)
733 {
734 break lab6;
735 }
736 cursor++;
737 }
738 // setmark p1, line 122
739 I_p1 = cursor;
740 // gopast, line 123
741 golab11: while(true)
742 {
743 lab12: do {
744 if (!(in_grouping(g_v, 97, 121)))
745 {
746 break lab12;
747 }
748 break golab11;
749 } while (false);
750 if (cursor >= limit)
751 {
752 break lab6;
753 }
754 cursor++;
755 }
756 // gopast, line 123
757 golab13: while(true)
758 {
759 lab14: do {
760 if (!(out_grouping(g_v, 97, 121)))
761 {
762 break lab14;
763 }
764 break golab13;
765 } while (false);
766 if (cursor >= limit)
767 {
768 break lab6;
769 }
770 cursor++;
771 }
772 // setmark p2, line 123
773 I_p2 = cursor;
774 } while (false);
775 cursor = v_5;
776 // backwards, line 126
777 limit_backward = cursor; cursor = limit;
778 // (, line 126
779 // do, line 127
780 v_10 = limit - cursor;
781 lab15: do {
782 // call Step_1a, line 127
783 if (!r_Step_1a())
784 {
785 break lab15;
786 }
787 } while (false);
788 cursor = limit - v_10;
789 // do, line 128
790 v_11 = limit - cursor;
791 lab16: do {
792 // call Step_1b, line 128
793 if (!r_Step_1b())
794 {
795 break lab16;
796 }
797 } while (false);
798 cursor = limit - v_11;
799 // do, line 129
800 v_12 = limit - cursor;
801 lab17: do {
802 // call Step_1c, line 129
803 if (!r_Step_1c())
804 {
805 break lab17;
806 }
807 } while (false);
808 cursor = limit - v_12;
809 // do, line 130
810 v_13 = limit - cursor;
811 lab18: do {
812 // call Step_2, line 130
813 if (!r_Step_2())
814 {
815 break lab18;
816 }
817 } while (false);
818 cursor = limit - v_13;
819 // do, line 131
820 v_14 = limit - cursor;
821 lab19: do {
822 // call Step_3, line 131
823 if (!r_Step_3())
824 {
825 break lab19;
826 }
827 } while (false);
828 cursor = limit - v_14;
829 // do, line 132
830 v_15 = limit - cursor;
831 lab20: do {
832 // call Step_4, line 132
833 if (!r_Step_4())
834 {
835 break lab20;
836 }
837 } while (false);
838 cursor = limit - v_15;
839 // do, line 133
840 v_16 = limit - cursor;
841 lab21: do {
842 // call Step_5a, line 133
843 if (!r_Step_5a())
844 {
845 break lab21;
846 }
847 } while (false);
848 cursor = limit - v_16;
849 // do, line 134
850 v_17 = limit - cursor;
851 lab22: do {
852 // call Step_5b, line 134
853 if (!r_Step_5b())
854 {
855 break lab22;
856 }
857 } while (false);
858 cursor = limit - v_17;
859 cursor = limit_backward; // do, line 137
860 v_18 = cursor;
861 lab23: do {
862 // (, line 137
863 // Boolean test Y_found, line 137
864 if (!(B_Y_found))
865 {
866 break lab23;
867 }
868 // repeat, line 137
869 replab24: while(true)
870 {
871 v_19 = cursor;
872 lab25: do {
873 // (, line 137
874 // goto, line 137
875 golab26: while(true)
876 {
877 v_20 = cursor;
878 lab27: do {
879 // (, line 137
880 // [, line 137
881 bra = cursor;
882 // literal, line 137
883 if (!(eq_s(1, "Y")))
884 {
885 break lab27;
886 }
887 // ], line 137
888 ket = cursor;
889 cursor = v_20;
890 break golab26;
891 } while (false);
892 cursor = v_20;
893 if (cursor >= limit)
894 {
895 break lab25;
896 }
897 cursor++;
898 }
899 // <-, line 137
900 slice_from("y");
901 continue replab24;
902 } while (false);
903 cursor = v_19;
904 break replab24;
905 }
906 } while (false);
907 cursor = v_18;
908 return true;
909 }
910
911 public boolean equals( Object o ) {
912 return o instanceof porterStemmer;
913 }
914
915 public int hashCode() {
916 return porterStemmer.class.getName().hashCode();
917 }
918
919
920
921 }
922