Lucene StandardAnalyzer 在 C# 中使用 Hunspell TokenFilter?
如何将 TokenFilter 添加到 Lucene 中的 StandardAnalyzer?或者是否有另一个分析器可以做同样的事情,只允许我也使用 TokenFilter?
我有一个 C# 中的 Hunspell TokenFilter,我不确定在哪里/如何插入索引过程?
var analyzer = new StandardAnalyzer(Version.LUCENE_29);
var indexExists = IndexReader.IndexExists(directory);
var createIndex = (indexExists == false);
var indexWriter = new IndexWriter(directory, analyzer, createIndex, IndexWriter.MaxFieldLength.UNLIMITED);
....
indexWriter.AddDocument(document);
另一方面,我有:
HunspellStemFilter : TokenFilter
来自:
http://devhost.se/blog/post/2011/04/07/C-port-of-lucene-hunspell.aspx
有人可以帮忙吗?
How can I add a TokenFilter to StandardAnalyzer in Lucene? Or is there another Analyzer that does the same thing, only allows me to also use a TokenFilter?
I have a TokenFilter for Hunspell in C# which I am not sure where/how to plug in the process of indexing?
var analyzer = new StandardAnalyzer(Version.LUCENE_29);
var indexExists = IndexReader.IndexExists(directory);
var createIndex = (indexExists == false);
var indexWriter = new IndexWriter(directory, analyzer, createIndex, IndexWriter.MaxFieldLength.UNLIMITED);
....
indexWriter.AddDocument(document);
And I have on the other hand:
HunspellStemFilter : TokenFilter
From:
http://devhost.se/blog/post/2011/04/07/C-port-of-lucene-hunspell.aspx
Can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一个更新版本,其中包含示例,位于 http://www.devhost.se/blog/post/2012/01/03/Updated-version-of-the-lucene-hunspell-port.aspx
你只是将代码中的 StandardAnalyzer 替换为基于 hunspell 的新分析器。
There's an updated version with an example available at http://www.devhost.se/blog/post/2012/01/03/Updated-version-of-the-lucene-hunspell-port.aspx
You just swap out your StandardAnalyzer in your code with your new hunspell based analyzer.