- TermAttribute termAtt = (TermAttribute) tokenStream.getAttribute(TermAttribute.class);
- TypeAttribute typeAtt = (TypeAttribute) tokenStream.getAttribute(TypeAttribute.class);
- while (tokenStream.incrementToken()) {
- System.out.print(termAtt.term());
- System.out.print(' ');
- System.out.println(typeAtt.type());
- }
Lucene2.9 TokenStream新的遍历方法
最新推荐文章于 2025-12-25 10:44:10 发布
本文介绍了一段关于使用Lucene分词器的代码实例,展示了如何通过TokenStream获取TermAttribute和TypeAttribute,并打印出每个分词及其类型,有助于理解Lucene的分词机制。
2819

被折叠的 条评论
为什么被折叠?



