public static void IKAnalysis(String str) throws IOException {
Analyzer anal=new IKAnalyzer(true);
StringReader reader=new StringReader(str);
//分词
TokenStream ts=anal.tokenStream("", reader);
CharTermAttribute term=ts.getAttribute(CharTermAttribute.class);
//遍历分词数据
while(ts.incrementToken()){
String s=term.toString();
System.out.println(s+" ");
}
reader.close();
// System.out.println();
}
public static void main(String[] args) throws IOException {

String d="student brian comput scienc depart univers wisconsin dayton street madison offic email wisc offic phone home phone advisor david wood tabl content interest schedul summer ”;
IKAnalysis(d);

}

 

所需jar包在csdn中:

http://download.csdn.net/detail/alt_lb/9812915

相关文章:

  • 2022-12-23
  • 2021-08-20
  • 2021-11-02
  • 2021-11-12
  • 2021-09-05
  • 2021-11-30
  • 2021-09-16
猜你喜欢
  • 2022-01-23
  • 2021-11-02
  • 2021-11-11
  • 2021-07-24
  • 2022-12-23
  • 2021-12-04
相关资源
相似解决方案