コード例 #1
0
ファイル: JiebaAnalyzer.cs プロジェクト: applenele/SmallCode
 public override TokenStream TokenStream(string fieldName, TextReader reader)
 {
     var seg = new JiebaSegmenter();
     TokenStream result = new JiebaTokenizer(seg, reader);
     // This filter is necessary, because the parser converts the queries to lower case.
     result = new LowerCaseFilter(result);
     result = new StopFilter(true, result, StopWords);
     return result;
 }
コード例 #2
0
        public override TokenStream TokenStream(string fieldName, TextReader reader)
        {
            var         seg    = new JiebaSegmenter();
            TokenStream result = new JiebaTokenizer(seg, reader);

            // This filter is necessary, because the parser converts the queries to lower case.
            result = new LowerCaseFilter(result);
            result = new StopFilter(true, result, StopWords);
            return(result);
        }
コード例 #3
0
ファイル: NewsSearcher.cs プロジェクト: xiongeee/SmallCode
        private static string GetKeyWordsSplitBySpace(string keywords, JiebaTokenizer tokenizer)
        {
            var result = new StringBuilder();

            var words = tokenizer.Tokenize(keywords);

            foreach (var word in words)
            {
                if (string.IsNullOrWhiteSpace(word.Word))
                {
                    continue;
                }

                result.AppendFormat("{0} ", word.Word);
            }

            return(result.ToString().Trim());
        }
コード例 #4
0
ファイル: NewsSearcher.cs プロジェクト: applenele/SmallCode
        private static string GetKeyWordsSplitBySpace(string keywords, JiebaTokenizer tokenizer)
        {
            var result = new StringBuilder();

            var words = tokenizer.Tokenize(keywords);

            foreach (var word in words)
            {
                if (string.IsNullOrWhiteSpace(word.Word))
                {
                    continue;
                }

                result.AppendFormat("{0} ", word.Word);
            }

            return result.ToString().Trim();
        }