Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            BulgarianStemmer stemmer = new BulgarianStemmer();

            stemmer.LoadRules("../../stem_rules_context_1.txt");

            Console.WriteLine(stemmer.Stem("обикновен"));
            Console.WriteLine(stemmer.Stem("английски"));
        }
        public override bool IncrementToken()
        {
            if (m_input.IncrementToken())
            {
                if (!keywordAttr.IsKeyword)
                {
                    string stemmed = stemmer.Stem(termAtt.Buffer.ToString());
                    if (stemmed.Length > termAtt.Length)
                    {
                        throw new Exception("wtf");
                    }

                    for (int i = 0; i < stemmed.Length; ++i)
                    {
                        termAtt[i] = stemmed[i];
                    }

                    termAtt.Length = stemmed.Length;
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        private static void QuickTest()
        {
            var words = new[] { "Управляващите", "ПРОТЕСТИРАЩИТЕ" };

            var stemmer = new BulgarianStemmer();

            foreach (string word in words)
            {
                string stem = stemmer.Stem(word);
                System.Console.WriteLine("{0} => {1}", word, stem);
            }
        }