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