“你的意思是?"Lucene.net 中的功能 [英] "Did you mean?" feature in Lucene.net

查看:20
本文介绍了“你的意思是?"Lucene.net 中的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我如何在 Lucene.net 中实现您的意思是"功能吗?

谢谢!

解决方案

您应该查看 SpellChecker 模块在 contrib 目录中.它是 Java lucene 的一个端口 SpellChecker 模块,所以它的文档应该会有所帮助.>

(来自 javadoc:)

示例用法:

 import org.apache.lucene.search.spell.SpellChecker;SpellChecker 拼写检查器 = new SpellChecker(spellIndexDirectory);//要索引用户索引的字段:拼写检查器.indexDictionary(新LuceneDictionary(my_lucene_reader,a_field));//索引包含单词的文件:spellchecker.indexDictionary(new PlainTextDictionary(new File("myfile.txt")));String[] 建议 = spellchecker.suggestSimilar(拼写错误", 5);

Can someone please let me know how do I implement "Did you mean" feature in Lucene.net?

Thanks!

解决方案

You should look into the SpellChecker module in the contrib dir. It's a port of Java lucene's SpellChecker module, so its documentation should be helpful.

(From the javadocs:)

Example Usage:

  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);

这篇关于“你的意思是?"Lucene.net 中的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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