列表中的“令牌"列表包括:在Lucene 3上 [英] List of "tokens" on Lucene 3

查看:44
本文介绍了列表中的“令牌"列表包括:在Lucene 3上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Lucene的新手,我开始学习版本3分支,有一件事我不理解(显然是因为我对这个主题没有经验).

I'm new to Lucene, i started learning the version 3 branch and there's one thing i don't understand (obviously because i'm not experienced in the subject).

在Lucene 2.9中,如果我想要一个令牌列表,我会创建一个Token类的ArrayList,例如ArrayList.对我来说这很直观,令牌的概念也很清楚.

In Lucene 2.9, if i wanted a list of tokens i would create an ArrayList of Token class, ArrayList for example. That's pretty intuitive for me and the concept of token is very clear.

现在不建议使用令牌类,而推荐使用基于属性的API,我是否必须创建自己的类来封装所需的属性?如果是,那是否几乎重新创建了Lucene的Token类?

Now that the use of Token class is disencouraged in favour of the Attribute based API, do i have to create my own class to encapsulate the attributes i want? If yes, isn't that almost recreating the Lucene's Token class?

我正在上一堂课来测试分析仪,我想拥有一个生成的令牌列表可以使测试变得更加容易.

I'm doing a class to test analyzers, and having a list of resulting tokens makes it easier to test, i guess.

任何帮助将不胜感激;)谢谢!

Any help would be appreciated ;) Thank you!

推荐答案

根据

According to the Token Javadoc, "Even though it is not necessary to use Token anymore, with the new TokenStream API it can be used as convenience class that implements all Attributes, which is especially useful to easily switch from the old to the new TokenStream API."

我建议您继续使用令牌.符合上面的描述.

I suggest you keep using a Token. It matches the description above.

这篇关于列表中的“令牌"列表包括:在Lucene 3上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆