Пример #1
0
 private string step4(string st, string r1, string r2, string rv)
 {
     if ((suffix = suffixr.getLongestSuffix(rv)).Length > 0)             //Rule 1
     {
         return(st.Substring(0, st.Length - suffix.Length));
     }
     return(st);
 }
Пример #2
0
        private string step5(string st, string r1, string r2, string rv)
        {
            if ((suffix = suffixf.getLongestSuffix(rv)).Length > 0)             //Rule 1
            {
                st = st.Substring(0, st.Length - suffix.Length);
                if (st.EndsWith("gu") && rv.EndsWith("u" + suffix))
                {
                    st = st.Substring(0, st.Length - 1);
                }
                else if (st.EndsWith("ci") && rv.EndsWith("i" + suffix))
                {
                    st = st.Substring(0, st.Length - 1);
                }
                return(st);
            }

            if (st.EndsWith("ç"))
            {
                st = st.Substring(0, st.Length - 1) + "c";
            }
            return(st);
        }
Пример #3
0
        private string step1(string st, string r1, string r2, string rv)
        {
            if ((suffix = suffix1.getLongestSuffix(r2)).Length > 0)             //Rule 1
            {
                return(st.Substring(0, st.Length - suffix.Length));
            }

            if ((suffix = suffix2.getLongestSuffix(r2)).Length > 0)             //Rule 2
            {
                return(st.Substring(0, st.Length - suffix.Length) + "log");
            }

            if ((suffix = suffix3.getLongestSuffix(r2)).Length > 0)             //Rule 3
            {
                return(st.Substring(0, st.Length - suffix.Length) + "u");
            }

            if ((suffix = suffix4.getLongestSuffix(r2)).Length > 0)             //Rule 4
            {
                return(st.Substring(0, st.Length - suffix.Length) + "ente");
            }

            if ((suffix = suffix5.getLongestSuffix(r1)).Length > 0)             //Rule 5
            {
                st = st.Substring(0, st.Length - suffix.Length);
                if (st.EndsWith("iv") && r2.EndsWith("iv" + suffix))
                {
                    st = st.Substring(0, st.Length - 2);
                    if (st.EndsWith("at") && r2.EndsWith("ativ" + suffix))
                    {
                        st = st.Substring(0, st.Length - 2);
                    }
                }
                else if (st.EndsWith("os") && r2.EndsWith("os" + suffix))
                {
                    st = st.Substring(0, st.Length - 2);
                }
                else if (st.EndsWith("ic") && r2.EndsWith("ic" + suffix))
                {
                    st = st.Substring(0, st.Length - 2);
                }
                else if (st.EndsWith("ad") && r2.EndsWith("ad" + suffix))
                {
                    st = st.Substring(0, st.Length - 2);
                }
                return(st);
            }

            if ((suffix = suffix6.getLongestSuffix(r2)).Length > 0)             //Rule 6
            {
                st = st.Substring(0, st.Length - suffix.Length);
                if (st.EndsWith("ante") && r2.EndsWith("ante" + suffix))
                {
                    st = st.Substring(0, st.Length - 4);
                }
                else if (st.EndsWith("avel") && r2.EndsWith("avel" + suffix))
                {
                    st = st.Substring(0, st.Length - 4);
                }
                else if (st.EndsWith("ível") && r2.EndsWith("ível" + suffix))
                {
                    st = st.Substring(0, st.Length - 4);
                }
                return(st);
            }

            if ((suffix = suffix7.getLongestSuffix(r2)).Length > 0)             //Rule 7
            {
                st = st.Substring(0, st.Length - suffix.Length);
                if (st.EndsWith("abil") && r2.EndsWith("abil" + suffix))
                {
                    st = st.Substring(0, st.Length - 4);
                }
                else if (st.EndsWith("ic") && r2.EndsWith("ic" + suffix))
                {
                    st = st.Substring(0, st.Length - 2);
                }
                else if (st.EndsWith("iv") && r2.EndsWith("iv" + suffix))
                {
                    st = st.Substring(0, st.Length - 2);
                }
                return(st);
            }

            if ((suffix = suffix8.getLongestSuffix(r2)).Length > 0)             //Rule 8
            {
                st = st.Substring(0, st.Length - suffix.Length);
                if (st.EndsWith("at") && r2.EndsWith("at" + suffix))
                {
                    st = st.Substring(0, st.Length - 2);
                }
                return(st);
            }

            if ((suffix = suffix9.getLongestSuffix(rv)).Length > 0)             //Rule 9
            {
                if (st.EndsWith("e" + suffix))
                {
                    st = st.Substring(0, st.Length - suffix.Length) + "ir";
                }
                return(st);
            }
            return(st);
        }