コード例 #1
0
 /// <summary>
 /// ThesaurusTokenizer���캯��
 /// </summary>
 /// <param name="input"></param>
 public ThesaurusTokenizer(TextReader input)
 {
     spliter = new ThesaurusSpliter(input);
 }
コード例 #2
0
ファイル: Util.cs プロジェクト: sqzhuyi/cnopenblog
        /// <summary>
        /// �ؼ��ֲ�ֲ�����
        /// </summary>
        /// <param name="keyword">�ؼ���</param>
        /// <returns></returns>
        public static string KeywordSplit(string keyword)
        {
            //�������Ĵ��ﰴ�տո����
            string[] keyGroups = keyword.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            StringBuilder keywords = new StringBuilder(/*keyword*/);

            for (int i = 0; i < keyGroups.Length; i++)
            {
                ThesaurusSpliter ts = new ThesaurusSpliter(new StringReader(keyGroups[i]));
                for (string word = ts.Next(); word != null; word = ts.Next())
                {
                    if (word.Length > 0 && !StopWord.Test(word))
                    {
                        keywords.Append(" ");
                        keywords.Append(word);
                    }
                }

                keywords.Append("+");
            }

            string trem = keywords.ToString().Trim(new char[] { ' ', '+' });

            if (trem.Length > 0)
            {
                return trem;
            }

            return keyword.Trim();
        }