下面代码可以输出关键字, 但是方法已经过期了, 现在用什么代替?
用的是3.5@Test
public void test() throws Exception{
analyze(new StandardAnalyzer(Version.LUCENE_35), "What's your a name?");
}
private void analyze(Analyzer analyzer, String text) throws Exception {
TokenStream ts = analyzer.reusableTokenStream("content", new StringReader(text));
while (ts.incrementToken()) {
Token t = ts.get
TermAttribute ta = ts.getAttribute(TermAttribute.class);
System.out.println(ta.term());
}
}
用的是3.5@Test
public void test() throws Exception{
analyze(new StandardAnalyzer(Version.LUCENE_35), "What's your a name?");
}
private void analyze(Analyzer analyzer, String text) throws Exception {
TokenStream ts = analyzer.reusableTokenStream("content", new StringReader(text));
while (ts.incrementToken()) {
Token t = ts.get
TermAttribute ta = ts.getAttribute(TermAttribute.class);
System.out.println(ta.term());
}
}
解决方案 »
- 为什么部署在resin上的项目会无缘无故的死掉, 重启resin又好了
- HttpSession httpSession = ServletActionContext.getRequest().getSession()
- 关于附件的加解密的问题
- 怎么“图片新闻”
- 对于主机多IP,怎么设定IP去链接服务器
- 急啊,谁能给个jbuilder 2005的下载地址啊?
- 高分求资料.本人初学struts,求struts标签学习资料.
- 请高手指点!!!
- 如何更改jboss默认的8080端口(jboss307tomcat421或jboss321)
- J2EE RI 服务器是什么东西?哪里有 下载!
- mysql 数据库查询出字段界面进行判断问题
- 点击一下输入框,弹出一个窗体怎么做?
这句是多余的,无视吧
CharTermAttribute charTermAttr = tokens.getAttribute(CharTermAttribute.class);
PositionIncrementAttribute posIncrAttr = tokens.addAttribute(PositionIncrementAttribute.class);
TypeAttribute typeAttr = tokens.addAttribute(TypeAttribute.class);
while (tokens.incrementToken()) {
charBuf = charTermAttr.buffer();
termIncr = posIncrAttr.getPositionIncrement();
String term = new String(charBuf, 0, offsetAttr.endOffset() - offsetAttr.startOffset());
System.out.println(term );
}
tokens.close();