本文介绍了如何只建议单个单词但不建议索引短语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我现在遇到麻烦了.我正在使用ShingleAnalyzerWrapper来索引短语.但是我需要SpellChecker来建议我一个单词.
I am having troubles right now. I am using ShingleAnalyzerWrapper to index phrases. But I need the SpellChecker to suggest me only single words.
我如何索引短语,但可以使用SpellChecker搜索短语和单个单词?
How can i index phrases but search for both phrases and single words with SpellChecker?
请给我一些建议.
推荐答案
ShingleAnalyzerWrapper(Analyzer defaultAnalyzer,
int minShingleSize,
int maxShingleSize,
String tokenSeparator,
boolean outputUnigrams,
boolean outputUnigramsIfNoShingles)
传递true
作为第五个参数(outputUnigrams).不管您的minShingleSize是多少,这都会为所有单个标记编制索引.如果您当前的minShingleSize为2,则可以将其降低到1,以获得相同的结果.
passing true
as the fifth argument (outputUnigrams). This will index all single tokens regardless of what you minShingleSize is. If your current minShingleSize is 2, you could just lower that to 1 to achieve the same result.
这篇关于如何只建议单个单词但不建议索引短语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!