示例#1
0
文件: Article.cs 项目: Bonniu/KSR
        public Article(string originalText, string place)
        {
            this.originalText = originalText;
            this.place        = place;
            char[] delimiters = { ' ', '\t', '\n' };
            refactoredText = StopwordTool.RemoveStopwords(originalText);
            Stemmer s = new Stemmer();

            refactoredText = s.StemText(refactoredText);
            wordCount      = refactoredText.Split(delimiters, StringSplitOptions.RemoveEmptyEntries).Length;
            featuresVector = new List <Feature>();
        }
示例#2
0
        /** Test program for demonstrating the Stemmer.  It reads text from a
         * a list of files, stems each word, and writes the result to standard
         * output. Note that the word stemmed is expected to be in lower case:
         * forcing lower case must be done outside the Stemmer class.
         * Usage: Stemmer file-name file-name ...
         */
        public string StemText(string text)
        {
            char[]   delimiters = { ' ', '\t', '\n' };
            string[] tabWords   = text.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
            string   tab        = "";
            Stemmer  s          = new Stemmer();

            foreach (var word in tabWords)
            {
                foreach (var charr in word.ToLower())
                {
                    s.Add(charr);
                }

                s.Stem();
                tab += CheckFirstLastChar(s.ToString()) + " ";
            }

            return(tab);
        }