lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cheng <zhoucheng2...@gmail.com>
Subject Lucene suggester can't suggest similar phrase
Date Mon, 29 Sep 2014 16:51:11 GMT
Hi,

I am using Lucene 4.10 suggester which I thought can return similar phrase.
But it turned out the different way.

My code is as follow:

public static void main(String[] args) throws IOException {

String path = "c:/data/suggest/dic.txt";

Dictionary dic;

dic = new FileDictionary(new FileInputStream(path));

InputIterator it = dic.getEntryIterator();

Analyzer analyzer = ERAnalyzer.getInstance().getAnalyzer();

FuzzySuggester suggester = new FuzzySuggester(analyzer);

suggester.build(it);

CharSequence cs = "雅诗兰黛";

List<LookupResult> results = suggester.lookup(cs, false, 1);

System.out.println(results.get(0).key);

}

The dictionary contains only one line:

雅诗兰黛 50

When cs is exactly "雅诗兰黛", I get the result. But when cs is "雅思兰黛", which
is only one word different from the target, I get nothing back.

I tried FuzzySuggester as well as AnalyzingSuggester. The result is the
same.

Did I miss something here?

Thanks!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message