有人可以告诉我如何在 Lucene.net 中实现“您是说”功能吗?
Thanks!
你应该调查一下拼写检查器 https://svn.apache.org/repos/asf/lucene/lucene.net/trunk/C%23/contrib/SpellChecker.Net/模块在 contrib 目录中。这是Java lucene的一个端口拼写检查器 https://lucene.apache.org/core/6_3_0/suggest/index.html?org/apache/lucene/search/spell/SpellChecker.html模块,所以它的文档 http://wiki.apache.org/jakarta-lucene/SpellChecker应该有帮助。
(来自javadoc:)
用法示例:
import org.apache.lucene.search.spell.SpellChecker;
SpellChecker spellchecker = new SpellChecker(spellIndexDirectory);
// To index a field of a user index:
spellchecker.indexDictionary(new LuceneDictionary(my_lucene_reader, a_field));
// To index a file containing words:
spellchecker.indexDictionary(new PlainTextDictionary(new File("myfile.txt")));
String[] suggestions = spellchecker.suggestSimilar("misspelt", 5);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)