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 PortugueseStemmer 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("", -1, 3), new Among("\u00E3", 0, 1), new Among("\u00F5", 0, 2) 21 }; 22 23 private static final Among a_1[] = { 24 new Among("", -1, 3), new Among("a~", 0, 1), new Among("o~", 0, 2) 25 }; 26 27 private static final Among a_2[] = { 28 new Among("ic", -1, -1), 29 new Among("ad", -1, -1), 30 new Among("os", -1, -1), 31 new Among("iv", -1, 1) 32 }; 33 34 private static final Among a_3[] = { 35 new Among("ante", -1, 1), new Among("avel", -1, 1), new Among("\u00EDvel", -1, 1) 36 }; 37 38 private static final Among a_4[] = { 39 new Among("ic", -1, 1), new Among("abil", -1, 1), new Among("iv", -1, 1) 40 }; 41 42 private static final Among a_5[] = { 43 new Among("ica", -1, 1), 44 new Among("\u00E2ncia", -1, 1), 45 new Among("\u00EAncia", -1, 4), 46 new Among("logia", -1, 2), 47 new Among("ira", -1, 9), 48 new Among("adora", -1, 1), 49 new Among("osa", -1, 1), 50 new Among("ista", -1, 1), 51 new Among("iva", -1, 8), 52 new Among("eza", -1, 1), 53 new Among("idade", -1, 7), 54 new Among("ante", -1, 1), 55 new Among("mente", -1, 6), 56 new Among("amente", 12, 5), 57 new Among("\u00E1vel", -1, 1), 58 new Among("\u00EDvel", -1, 1), 59 new Among("ico", -1, 1), 60 new Among("ismo", -1, 1), 61 new Among("oso", -1, 1), 62 new Among("amento", -1, 1), 63 new Among("imento", -1, 1), 64 new Among("ivo", -1, 8), 65 new Among("a\u00E7a~o", -1, 1), 66 new Among("u\u00E7a~o", -1, 3), 67 new Among("ador", -1, 1), 68 new Among("icas", -1, 1), 69 new Among("\u00EAncias", -1, 4), 70 new Among("logias", -1, 2), 71 new Among("iras", -1, 9), 72 new Among("adoras", -1, 1), 73 new Among("osas", -1, 1), 74 new Among("istas", -1, 1), 75 new Among("ivas", -1, 8), 76 new Among("ezas", -1, 1), 77 new Among("idades", -1, 7), 78 new Among("adores", -1, 1), 79 new Among("antes", -1, 1), 80 new Among("a\u00E7o~es", -1, 1), 81 new Among("u\u00E7o~es", -1, 3), 82 new Among("icos", -1, 1), 83 new Among("ismos", -1, 1), 84 new Among("osos", -1, 1), 85 new Among("amentos", -1, 1), 86 new Among("imentos", -1, 1), 87 new Among("ivos", -1, 8) 88 }; 89 90 private static final Among a_6[] = { 91 new Among("ada", -1, 1), 92 new Among("ida", -1, 1), 93 new Among("ia", -1, 1), 94 new Among("aria", 2, 1), 95 new Among("eria", 2, 1), 96 new Among("iria", 2, 1), 97 new Among("ara", -1, 1), 98 new Among("era", -1, 1), 99 new Among("ira", -1, 1), 100 new Among("ava", -1, 1), 101 new Among("asse", -1, 1), 102 new Among("esse", -1, 1), 103 new Among("isse", -1, 1), 104 new Among("aste", -1, 1), 105 new Among("este", -1, 1), 106 new Among("iste", -1, 1), 107 new Among("ei", -1, 1), 108 new Among("arei", 16, 1), 109 new Among("erei", 16, 1), 110 new Among("irei", 16, 1), 111 new Among("am", -1, 1), 112 new Among("iam", 20, 1), 113 new Among("ariam", 21, 1), 114 new Among("eriam", 21, 1), 115 new Among("iriam", 21, 1), 116 new Among("aram", 20, 1), 117 new Among("eram", 20, 1), 118 new Among("iram", 20, 1), 119 new Among("avam", 20, 1), 120 new Among("em", -1, 1), 121 new Among("arem", 29, 1), 122 new Among("erem", 29, 1), 123 new Among("irem", 29, 1), 124 new Among("assem", 29, 1), 125 new Among("essem", 29, 1), 126 new Among("issem", 29, 1), 127 new Among("ado", -1, 1), 128 new Among("ido", -1, 1), 129 new Among("ando", -1, 1), 130 new Among("endo", -1, 1), 131 new Among("indo", -1, 1), 132 new Among("ara~o", -1, 1), 133 new Among("era~o", -1, 1), 134 new Among("ira~o", -1, 1), 135 new Among("ar", -1, 1), 136 new Among("er", -1, 1), 137 new Among("ir", -1, 1), 138 new Among("as", -1, 1), 139 new Among("adas", 47, 1), 140 new Among("idas", 47, 1), 141 new Among("ias", 47, 1), 142 new Among("arias", 50, 1), 143 new Among("erias", 50, 1), 144 new Among("irias", 50, 1), 145 new Among("aras", 47, 1), 146 new Among("eras", 47, 1), 147 new Among("iras", 47, 1), 148 new Among("avas", 47, 1), 149 new Among("es", -1, 1), 150 new Among("ardes", 58, 1), 151 new Among("erdes", 58, 1), 152 new Among("irdes", 58, 1), 153 new Among("ares", 58, 1), 154 new Among("eres", 58, 1), 155 new Among("ires", 58, 1), 156 new Among("asses", 58, 1), 157 new Among("esses", 58, 1), 158 new Among("isses", 58, 1), 159 new Among("astes", 58, 1), 160 new Among("estes", 58, 1), 161 new Among("istes", 58, 1), 162 new Among("is", -1, 1), 163 new Among("ais", 71, 1), 164 new Among("eis", 71, 1), 165 new Among("areis", 73, 1), 166 new Among("ereis", 73, 1), 167 new Among("ireis", 73, 1), 168 new Among("\u00E1reis", 73, 1), 169 new Among("\u00E9reis", 73, 1), 170 new Among("\u00EDreis", 73, 1), 171 new Among("\u00E1sseis", 73, 1), 172 new Among("\u00E9sseis", 73, 1), 173 new Among("\u00EDsseis", 73, 1), 174 new Among("\u00E1veis", 73, 1), 175 new Among("\u00EDeis", 73, 1), 176 new Among("ar\u00EDeis", 84, 1), 177 new Among("er\u00EDeis", 84, 1), 178 new Among("ir\u00EDeis", 84, 1), 179 new Among("ados", -1, 1), 180 new Among("idos", -1, 1), 181 new Among("amos", -1, 1), 182 new Among("\u00E1ramos", 90, 1), 183 new Among("\u00E9ramos", 90, 1), 184 new Among("\u00EDramos", 90, 1), 185 new Among("\u00E1vamos", 90, 1), 186 new Among("\u00EDamos", 90, 1), 187 new Among("ar\u00EDamos", 95, 1), 188 new Among("er\u00EDamos", 95, 1), 189 new Among("ir\u00EDamos", 95, 1), 190 new Among("emos", -1, 1), 191 new Among("aremos", 99, 1), 192 new Among("eremos", 99, 1), 193 new Among("iremos", 99, 1), 194 new Among("\u00E1ssemos", 99, 1), 195 new Among("\u00EAssemos", 99, 1), 196 new Among("\u00EDssemos", 99, 1), 197 new Among("imos", -1, 1), 198 new Among("armos", -1, 1), 199 new Among("ermos", -1, 1), 200 new Among("irmos", -1, 1), 201 new Among("\u00E1mos", -1, 1), 202 new Among("ar\u00E1s", -1, 1), 203 new Among("er\u00E1s", -1, 1), 204 new Among("ir\u00E1s", -1, 1), 205 new Among("eu", -1, 1), 206 new Among("iu", -1, 1), 207 new Among("ou", -1, 1), 208 new Among("ar\u00E1", -1, 1), 209 new Among("er\u00E1", -1, 1), 210 new Among("ir\u00E1", -1, 1) 211 }; 212 213 private static final Among a_7[] = { 214 new Among("a", -1, 1), 215 new Among("i", -1, 1), 216 new Among("o", -1, 1), 217 new Among("os", -1, 1), 218 new Among("\u00E1", -1, 1), 219 new Among("\u00ED", -1, 1), 220 new Among("\u00F3", -1, 1) 221 }; 222 223 private static final Among a_8[] = { 224 new Among("e", -1, 1), 225 new Among("\u00E7", -1, 2), 226 new Among("\u00E9", -1, 1), 227 new Among("\u00EA", -1, 1) 228 }; 229 230 private static final char g_v[] = { 231 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 19, 12, 2 232 }; 233 234 private int I_p2; 235 private int I_p1; 236 private int I_pV; 237 r_prelude()238 private boolean r_prelude() { 239 int among_var; 240 while (true) { 241 int v_1 = cursor; 242 lab0: 243 { 244 bra = cursor; 245 among_var = find_among(a_0); 246 if (among_var == 0) { 247 break lab0; 248 } 249 ket = cursor; 250 switch (among_var) { 251 case 1: 252 slice_from("a~"); 253 break; 254 case 2: 255 slice_from("o~"); 256 break; 257 case 3: 258 if (cursor >= limit) { 259 break lab0; 260 } 261 cursor++; 262 break; 263 } 264 continue; 265 } 266 cursor = v_1; 267 break; 268 } 269 return true; 270 } 271 r_mark_regions()272 private boolean r_mark_regions() { 273 I_pV = limit; 274 I_p1 = limit; 275 I_p2 = limit; 276 int v_1 = cursor; 277 lab0: 278 { 279 lab1: 280 { 281 int v_2 = cursor; 282 lab2: 283 { 284 if (!(in_grouping(g_v, 97, 250))) { 285 break lab2; 286 } 287 lab3: 288 { 289 int v_3 = cursor; 290 lab4: 291 { 292 if (!(out_grouping(g_v, 97, 250))) { 293 break lab4; 294 } 295 golab5: 296 while (true) { 297 lab6: 298 { 299 if (!(in_grouping(g_v, 97, 250))) { 300 break lab6; 301 } 302 break golab5; 303 } 304 if (cursor >= limit) { 305 break lab4; 306 } 307 cursor++; 308 } 309 break lab3; 310 } 311 cursor = v_3; 312 if (!(in_grouping(g_v, 97, 250))) { 313 break lab2; 314 } 315 golab7: 316 while (true) { 317 lab8: 318 { 319 if (!(out_grouping(g_v, 97, 250))) { 320 break lab8; 321 } 322 break golab7; 323 } 324 if (cursor >= limit) { 325 break lab2; 326 } 327 cursor++; 328 } 329 } 330 break lab1; 331 } 332 cursor = v_2; 333 if (!(out_grouping(g_v, 97, 250))) { 334 break lab0; 335 } 336 lab9: 337 { 338 int v_6 = cursor; 339 lab10: 340 { 341 if (!(out_grouping(g_v, 97, 250))) { 342 break lab10; 343 } 344 golab11: 345 while (true) { 346 lab12: 347 { 348 if (!(in_grouping(g_v, 97, 250))) { 349 break lab12; 350 } 351 break golab11; 352 } 353 if (cursor >= limit) { 354 break lab10; 355 } 356 cursor++; 357 } 358 break lab9; 359 } 360 cursor = v_6; 361 if (!(in_grouping(g_v, 97, 250))) { 362 break lab0; 363 } 364 if (cursor >= limit) { 365 break lab0; 366 } 367 cursor++; 368 } 369 } 370 I_pV = cursor; 371 } 372 cursor = v_1; 373 int v_8 = cursor; 374 lab13: 375 { 376 golab14: 377 while (true) { 378 lab15: 379 { 380 if (!(in_grouping(g_v, 97, 250))) { 381 break lab15; 382 } 383 break golab14; 384 } 385 if (cursor >= limit) { 386 break lab13; 387 } 388 cursor++; 389 } 390 golab16: 391 while (true) { 392 lab17: 393 { 394 if (!(out_grouping(g_v, 97, 250))) { 395 break lab17; 396 } 397 break golab16; 398 } 399 if (cursor >= limit) { 400 break lab13; 401 } 402 cursor++; 403 } 404 I_p1 = cursor; 405 golab18: 406 while (true) { 407 lab19: 408 { 409 if (!(in_grouping(g_v, 97, 250))) { 410 break lab19; 411 } 412 break golab18; 413 } 414 if (cursor >= limit) { 415 break lab13; 416 } 417 cursor++; 418 } 419 golab20: 420 while (true) { 421 lab21: 422 { 423 if (!(out_grouping(g_v, 97, 250))) { 424 break lab21; 425 } 426 break golab20; 427 } 428 if (cursor >= limit) { 429 break lab13; 430 } 431 cursor++; 432 } 433 I_p2 = cursor; 434 } 435 cursor = v_8; 436 return true; 437 } 438 r_postlude()439 private boolean r_postlude() { 440 int among_var; 441 while (true) { 442 int v_1 = cursor; 443 lab0: 444 { 445 bra = cursor; 446 among_var = find_among(a_1); 447 if (among_var == 0) { 448 break lab0; 449 } 450 ket = cursor; 451 switch (among_var) { 452 case 1: 453 slice_from("\u00E3"); 454 break; 455 case 2: 456 slice_from("\u00F5"); 457 break; 458 case 3: 459 if (cursor >= limit) { 460 break lab0; 461 } 462 cursor++; 463 break; 464 } 465 continue; 466 } 467 cursor = v_1; 468 break; 469 } 470 return true; 471 } 472 r_RV()473 private boolean r_RV() { 474 if (!(I_pV <= cursor)) { 475 return false; 476 } 477 return true; 478 } 479 r_R1()480 private boolean r_R1() { 481 if (!(I_p1 <= cursor)) { 482 return false; 483 } 484 return true; 485 } 486 r_R2()487 private boolean r_R2() { 488 if (!(I_p2 <= cursor)) { 489 return false; 490 } 491 return true; 492 } 493 r_standard_suffix()494 private boolean r_standard_suffix() { 495 int among_var; 496 ket = cursor; 497 among_var = find_among_b(a_5); 498 if (among_var == 0) { 499 return false; 500 } 501 bra = cursor; 502 switch (among_var) { 503 case 1: 504 if (!r_R2()) { 505 return false; 506 } 507 slice_del(); 508 break; 509 case 2: 510 if (!r_R2()) { 511 return false; 512 } 513 slice_from("log"); 514 break; 515 case 3: 516 if (!r_R2()) { 517 return false; 518 } 519 slice_from("u"); 520 break; 521 case 4: 522 if (!r_R2()) { 523 return false; 524 } 525 slice_from("ente"); 526 break; 527 case 5: 528 if (!r_R1()) { 529 return false; 530 } 531 slice_del(); 532 int v_1 = limit - cursor; 533 lab0: 534 { 535 ket = cursor; 536 among_var = find_among_b(a_2); 537 if (among_var == 0) { 538 cursor = limit - v_1; 539 break lab0; 540 } 541 bra = cursor; 542 if (!r_R2()) { 543 cursor = limit - v_1; 544 break lab0; 545 } 546 slice_del(); 547 switch (among_var) { 548 case 1: 549 ket = cursor; 550 if (!(eq_s_b("at"))) { 551 cursor = limit - v_1; 552 break lab0; 553 } 554 bra = cursor; 555 if (!r_R2()) { 556 cursor = limit - v_1; 557 break lab0; 558 } 559 slice_del(); 560 break; 561 } 562 } 563 break; 564 case 6: 565 if (!r_R2()) { 566 return false; 567 } 568 slice_del(); 569 int v_2 = limit - cursor; 570 lab1: 571 { 572 ket = cursor; 573 if (find_among_b(a_3) == 0) { 574 cursor = limit - v_2; 575 break lab1; 576 } 577 bra = cursor; 578 if (!r_R2()) { 579 cursor = limit - v_2; 580 break lab1; 581 } 582 slice_del(); 583 } 584 break; 585 case 7: 586 if (!r_R2()) { 587 return false; 588 } 589 slice_del(); 590 int v_3 = limit - cursor; 591 lab2: 592 { 593 ket = cursor; 594 if (find_among_b(a_4) == 0) { 595 cursor = limit - v_3; 596 break lab2; 597 } 598 bra = cursor; 599 if (!r_R2()) { 600 cursor = limit - v_3; 601 break lab2; 602 } 603 slice_del(); 604 } 605 break; 606 case 8: 607 if (!r_R2()) { 608 return false; 609 } 610 slice_del(); 611 int v_4 = limit - cursor; 612 lab3: 613 { 614 ket = cursor; 615 if (!(eq_s_b("at"))) { 616 cursor = limit - v_4; 617 break lab3; 618 } 619 bra = cursor; 620 if (!r_R2()) { 621 cursor = limit - v_4; 622 break lab3; 623 } 624 slice_del(); 625 } 626 break; 627 case 9: 628 if (!r_RV()) { 629 return false; 630 } 631 if (!(eq_s_b("e"))) { 632 return false; 633 } 634 slice_from("ir"); 635 break; 636 } 637 return true; 638 } 639 r_verb_suffix()640 private boolean r_verb_suffix() { 641 if (cursor < I_pV) { 642 return false; 643 } 644 int v_2 = limit_backward; 645 limit_backward = I_pV; 646 ket = cursor; 647 if (find_among_b(a_6) == 0) { 648 limit_backward = v_2; 649 return false; 650 } 651 bra = cursor; 652 slice_del(); 653 limit_backward = v_2; 654 return true; 655 } 656 r_residual_suffix()657 private boolean r_residual_suffix() { 658 ket = cursor; 659 if (find_among_b(a_7) == 0) { 660 return false; 661 } 662 bra = cursor; 663 if (!r_RV()) { 664 return false; 665 } 666 slice_del(); 667 return true; 668 } 669 r_residual_form()670 private boolean r_residual_form() { 671 int among_var; 672 ket = cursor; 673 among_var = find_among_b(a_8); 674 if (among_var == 0) { 675 return false; 676 } 677 bra = cursor; 678 switch (among_var) { 679 case 1: 680 if (!r_RV()) { 681 return false; 682 } 683 slice_del(); 684 ket = cursor; 685 lab0: 686 { 687 int v_1 = limit - cursor; 688 lab1: 689 { 690 if (!(eq_s_b("u"))) { 691 break lab1; 692 } 693 bra = cursor; 694 int v_2 = limit - cursor; 695 if (!(eq_s_b("g"))) { 696 break lab1; 697 } 698 cursor = limit - v_2; 699 break lab0; 700 } 701 cursor = limit - v_1; 702 if (!(eq_s_b("i"))) { 703 return false; 704 } 705 bra = cursor; 706 int v_3 = limit - cursor; 707 if (!(eq_s_b("c"))) { 708 return false; 709 } 710 cursor = limit - v_3; 711 } 712 if (!r_RV()) { 713 return false; 714 } 715 slice_del(); 716 break; 717 case 2: 718 slice_from("c"); 719 break; 720 } 721 return true; 722 } 723 724 @Override stem()725 public boolean stem() { 726 int v_1 = cursor; 727 r_prelude(); 728 cursor = v_1; 729 r_mark_regions(); 730 limit_backward = cursor; 731 cursor = limit; 732 int v_3 = limit - cursor; 733 lab0: 734 { 735 lab1: 736 { 737 int v_4 = limit - cursor; 738 lab2: 739 { 740 int v_5 = limit - cursor; 741 lab3: 742 { 743 int v_6 = limit - cursor; 744 lab4: 745 { 746 if (!r_standard_suffix()) { 747 break lab4; 748 } 749 break lab3; 750 } 751 cursor = limit - v_6; 752 if (!r_verb_suffix()) { 753 break lab2; 754 } 755 } 756 cursor = limit - v_5; 757 int v_7 = limit - cursor; 758 lab5: 759 { 760 ket = cursor; 761 if (!(eq_s_b("i"))) { 762 break lab5; 763 } 764 bra = cursor; 765 int v_8 = limit - cursor; 766 if (!(eq_s_b("c"))) { 767 break lab5; 768 } 769 cursor = limit - v_8; 770 if (!r_RV()) { 771 break lab5; 772 } 773 slice_del(); 774 } 775 cursor = limit - v_7; 776 break lab1; 777 } 778 cursor = limit - v_4; 779 if (!r_residual_suffix()) { 780 break lab0; 781 } 782 } 783 } 784 cursor = limit - v_3; 785 int v_9 = limit - cursor; 786 r_residual_form(); 787 cursor = limit - v_9; 788 cursor = limit_backward; 789 int v_10 = cursor; 790 r_postlude(); 791 cursor = v_10; 792 return true; 793 } 794 795 @Override equals(Object o)796 public boolean equals(Object o) { 797 return o instanceof PortugueseStemmer; 798 } 799 800 @Override hashCode()801 public int hashCode() { 802 return PortugueseStemmer.class.getName().hashCode(); 803 } 804 } 805