Analyzer aStandardAnalyzer = new CJKAnalyzer(Lucene.Net.Util.Version.LUCENE_CURRENT);
TokenStream ts = aStandardAnalyzer.TokenStream("", new System.IO.StringReader("密云的门票"));
ITermAttribute termAtt = ts.GetAttribute<ITermAttribute>();
while (ts.IncrementToken())
{
Console.WriteLine(termAtt.Term);
}
TokenStream ts = aStandardAnalyzer.TokenStream("", new System.IO.StringReader("密云的门票"));
ITermAttribute termAtt = ts.GetAttribute<ITermAttribute>();
while (ts.IncrementToken())
{
Console.WriteLine(termAtt.Term);
}
Console.Read();
lucence .net 3.0 如果想使用CJKAnalyzer 二元分词需要引入 Lucene.Net.Contrib.Analyzers.dll
只用代码中
using Lucene.Net.Analysis.CJK;