⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 porterstemmer.java

📁 一个很不错的词频统计程序,目前只支持英文,中文的本人正在修改中.改好后上传给大家分享
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// This file was generated automatically by the Snowball to Java compiler

package org.tartarus.snowball.ext;
import org.tartarus.snowball.SnowballProgram;
import org.tartarus.snowball.Among;

/**
 * Generated class implementing code defined by a snowball script.
 */
public class porterStemmer extends SnowballProgram {

        private Among a_0[] = {
            new Among ( "s", -1, 3, "", this),
            new Among ( "ies", 0, 2, "", this),
            new Among ( "sses", 0, 1, "", this),
            new Among ( "ss", 0, -1, "", this)
        };

        private Among a_1[] = {
            new Among ( "", -1, 3, "", this),
            new Among ( "bb", 0, 2, "", this),
            new Among ( "dd", 0, 2, "", this),
            new Among ( "ff", 0, 2, "", this),
            new Among ( "gg", 0, 2, "", this),
            new Among ( "bl", 0, 1, "", this),
            new Among ( "mm", 0, 2, "", this),
            new Among ( "nn", 0, 2, "", this),
            new Among ( "pp", 0, 2, "", this),
            new Among ( "rr", 0, 2, "", this),
            new Among ( "at", 0, 1, "", this),
            new Among ( "tt", 0, 2, "", this),
            new Among ( "iz", 0, 1, "", this)
        };

        private Among a_2[] = {
            new Among ( "ed", -1, 2, "", this),
            new Among ( "eed", 0, 1, "", this),
            new Among ( "ing", -1, 2, "", this)
        };

        private Among a_3[] = {
            new Among ( "anci", -1, 3, "", this),
            new Among ( "enci", -1, 2, "", this),
            new Among ( "abli", -1, 4, "", this),
            new Among ( "eli", -1, 6, "", this),
            new Among ( "alli", -1, 9, "", this),
            new Among ( "ousli", -1, 12, "", this),
            new Among ( "entli", -1, 5, "", this),
            new Among ( "aliti", -1, 10, "", this),
            new Among ( "biliti", -1, 14, "", this),
            new Among ( "iviti", -1, 13, "", this),
            new Among ( "tional", -1, 1, "", this),
            new Among ( "ational", 10, 8, "", this),
            new Among ( "alism", -1, 10, "", this),
            new Among ( "ation", -1, 8, "", this),
            new Among ( "ization", 13, 7, "", this),
            new Among ( "izer", -1, 7, "", this),
            new Among ( "ator", -1, 8, "", this),
            new Among ( "iveness", -1, 13, "", this),
            new Among ( "fulness", -1, 11, "", this),
            new Among ( "ousness", -1, 12, "", this)
        };

        private Among a_4[] = {
            new Among ( "icate", -1, 2, "", this),
            new Among ( "ative", -1, 3, "", this),
            new Among ( "alize", -1, 1, "", this),
            new Among ( "iciti", -1, 2, "", this),
            new Among ( "ical", -1, 2, "", this),
            new Among ( "ful", -1, 3, "", this),
            new Among ( "ness", -1, 3, "", this)
        };

        private Among a_5[] = {
            new Among ( "ic", -1, 1, "", this),
            new Among ( "ance", -1, 1, "", this),
            new Among ( "ence", -1, 1, "", this),
            new Among ( "able", -1, 1, "", this),
            new Among ( "ible", -1, 1, "", this),
            new Among ( "ate", -1, 1, "", this),
            new Among ( "ive", -1, 1, "", this),
            new Among ( "ize", -1, 1, "", this),
            new Among ( "iti", -1, 1, "", this),
            new Among ( "al", -1, 1, "", this),
            new Among ( "ism", -1, 1, "", this),
            new Among ( "ion", -1, 2, "", this),
            new Among ( "er", -1, 1, "", this),
            new Among ( "ous", -1, 1, "", this),
            new Among ( "ant", -1, 1, "", this),
            new Among ( "ent", -1, 1, "", this),
            new Among ( "ment", 15, 1, "", this),
            new Among ( "ement", 16, 1, "", this),
            new Among ( "ou", -1, 1, "", this)
        };

        private static final char g_v[] = {17, 65, 16, 1 };

        private static final char g_v_WXY[] = {1, 17, 65, 208, 1 };

        private boolean B_Y_found;
        private int I_p2;
        private int I_p1;

        private void copy_from(porterStemmer other) {
            B_Y_found = other.B_Y_found;
            I_p2 = other.I_p2;
            I_p1 = other.I_p1;
            super.copy_from(other);
        }

        private boolean r_shortv() {
            // (, line 19
            if (!(out_grouping_b(g_v_WXY, 89, 121)))
            {
                return false;
            }
            if (!(in_grouping_b(g_v, 97, 121)))
            {
                return false;
            }
            if (!(out_grouping_b(g_v, 97, 121)))
            {
                return false;
            }
            return true;
        }

        private boolean r_R1() {
            if (!(I_p1 <= cursor))
            {
                return false;
            }
            return true;
        }

        private boolean r_R2() {
            if (!(I_p2 <= cursor))
            {
                return false;
            }
            return true;
        }

        private boolean r_Step_1a() {
            int among_var;
            // (, line 24
            // [, line 25
            ket = cursor;
            // substring, line 25
            among_var = find_among_b(a_0, 4);
            if (among_var == 0)
            {
                return false;
            }
            // ], line 25
            bra = cursor;
            switch(among_var) {
                case 0:
                    return false;
                case 1:
                    // (, line 26
                    // <-, line 26
                    slice_from("ss");
                    break;
                case 2:
                    // (, line 27
                    // <-, line 27
                    slice_from("i");
                    break;
                case 3:
                    // (, line 29
                    // delete, line 29
                    slice_del();
                    break;
            }
            return true;
        }

        private boolean r_Step_1b() {
            int among_var;
            int v_1;
            int v_3;
            int v_4;
            // (, line 33
            // [, line 34
            ket = cursor;
            // substring, line 34
            among_var = find_among_b(a_2, 3);
            if (among_var == 0)
            {
                return false;
            }
            // ], line 34
            bra = cursor;
            switch(among_var) {
                case 0:
                    return false;
                case 1:
                    // (, line 35
                    // call R1, line 35
                    if (!r_R1())
                    {
                        return false;
                    }
                    // <-, line 35
                    slice_from("ee");
                    break;
                case 2:
                    // (, line 37
                    // test, line 38
                    v_1 = limit - cursor;
                    // gopast, line 38
                    golab0: while(true)
                    {
                        lab1: do {
                            if (!(in_grouping_b(g_v, 97, 121)))
                            {
                                break lab1;
                            }
                            break golab0;
                        } while (false);
                        if (cursor <= limit_backward)
                        {
                            return false;
                        }
                        cursor--;
                    }
                    cursor = limit - v_1;
                    // delete, line 38
                    slice_del();
                    // test, line 39
                    v_3 = limit - cursor;
                    // substring, line 39
                    among_var = find_among_b(a_1, 13);
                    if (among_var == 0)
                    {
                        return false;
                    }
                    cursor = limit - v_3;
                    switch(among_var) {
                        case 0:
                            return false;
                        case 1:
                            // (, line 41
                            // <+, line 41
                            {
                                int c = cursor;
                                insert(cursor, cursor, "e");
                                cursor = c;
                            }
                            break;
                        case 2:
                            // (, line 44
                            // [, line 44
                            ket = cursor;
                            // next, line 44
                            if (cursor <= limit_backward)
                            {
                                return false;
                            }
                            cursor--;
                            // ], line 44
                            bra = cursor;
                            // delete, line 44
                            slice_del();
                            break;
                        case 3:
                            // (, line 45
                            // atmark, line 45
                            if (cursor != I_p1)
                            {
                                return false;
                            }
                            // test, line 45
                            v_4 = limit - cursor;
                            // call shortv, line 45
                            if (!r_shortv())
                            {
                                return false;
                            }
                            cursor = limit - v_4;
                            // <+, line 45
                            {
                                int c = cursor;
                                insert(cursor, cursor, "e");
                                cursor = c;
                            }
                            break;
                    }
                    break;
            }
            return true;
        }

        private boolean r_Step_1c() {
            int v_1;
            // (, line 51
            // [, line 52
            ket = cursor;
            // or, line 52
            lab0: do {
                v_1 = limit - cursor;
                lab1: do {
                    // literal, line 52
                    if (!(eq_s_b(1, "y")))
                    {
                        break lab1;
                    }
                    break lab0;
                } while (false);
                cursor = limit - v_1;
                // literal, line 52
                if (!(eq_s_b(1, "Y")))
                {
                    return false;
                }
            } while (false);
            // ], line 52
            bra = cursor;
            // gopast, line 53
            golab2: while(true)
            {
                lab3: do {
                    if (!(in_grouping_b(g_v, 97, 121)))
                    {
                        break lab3;
                    }
                    break golab2;
                } while (false);
                if (cursor <= limit_backward)
                {
                    return false;
                }
                cursor--;
            }
            // <-, line 54
            slice_from("i");
            return true;
        }

        private boolean r_Step_2() {
            int among_var;
            // (, line 57
            // [, line 58
            ket = cursor;
            // substring, line 58
            among_var = find_among_b(a_3, 20);
            if (among_var == 0)
            {
                return false;
            }
            // ], line 58
            bra = cursor;
            // call R1, line 58
            if (!r_R1())
            {
                return false;
            }
            switch(among_var) {
                case 0:
                    return false;
                case 1:
                    // (, line 59
                    // <-, line 59
                    slice_from("tion");
                    break;
                case 2:
                    // (, line 60
                    // <-, line 60
                    slice_from("ence");
                    break;
                case 3:
                    // (, line 61
                    // <-, line 61
                    slice_from("ance");
                    break;
                case 4:
                    // (, line 62
                    // <-, line 62
                    slice_from("able");
                    break;
                case 5:
                    // (, line 63
                    // <-, line 63
                    slice_from("ent");
                    break;
                case 6:
                    // (, line 64
                    // <-, line 64
                    slice_from("e");
                    break;
                case 7:
                    // (, line 66
                    // <-, line 66
                    slice_from("ize");
                    break;
                case 8:
                    // (, line 68
                    // <-, line 68
                    slice_from("ate");
                    break;
                case 9:
                    // (, line 69
                    // <-, line 69
                    slice_from("al");
                    break;
                case 10:
                    // (, line 71
                    // <-, line 71
                    slice_from("al");
                    break;
                case 11:
                    // (, line 72
                    // <-, line 72
                    slice_from("ful");
                    break;
                case 12:
                    // (, line 74
                    // <-, line 74
                    slice_from("ous");
                    break;
                case 13:
                    // (, line 76
                    // <-, line 76
                    slice_from("ive");
                    break;
                case 14:
                    // (, line 77
                    // <-, line 77
                    slice_from("ble");
                    break;
            }
            return true;
        }

        private boolean r_Step_3() {
            int among_var;
            // (, line 81
            // [, line 82
            ket = cursor;
            // substring, line 82
            among_var = find_among_b(a_4, 7);
            if (among_var == 0)
            {
                return false;
            }
            // ], line 82
            bra = cursor;
            // call R1, line 82
            if (!r_R1())
            {
                return false;
            }
            switch(among_var) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -