标签:
import java.io.IOException; import java.io.StringReader; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Token; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.standard.StandardAnalyzer; public class TestLucene { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { Analyzer analyzer = new StandardAnalyzer();//创建一个标准的分词器 TokenStream tokenStream = analyzer.tokenStream("",new StringReader("this is a student good boy")); Token token = new Token(); while(tokenStream.next(token)!= null){ System.out.println(token); } } }
标签:
原文地址:http://www.cnblogs.com/aicpcode/p/4299230.html