package lucene;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.wltea.analyzer.lucene.IKAnalyzer;
public class MyAnalyzer {
public static void main(String[] args) throws Exception {
String en="Java Hollo";
Analyzer analyzer=new IKAnalyzer();
TokenStream tokenStream= analyzer.tokenStream("word",en);
tokenStream.reset();
CharTermAttribute charTermAttribute=tokenStream.addAttribute(CharTermAttribute.class);
while(tokenStream.incrementToken()){
System.out.println(charTermAttribute.toString());
}
}
}

相关文章:

  • 2021-05-21
  • 2021-05-07
  • 2022-01-17
  • 2021-11-15
  • 2022-12-23
  • 2021-04-06
  • 2022-12-23
  • 2021-11-29
猜你喜欢
  • 2021-07-08
  • 2021-08-22
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案