开发者

Lucene.NET (strings fuzzy matching)

Could anyone give me an example about how to do 开发者_JAVA技巧fuzzy matching of two strings using Lucene.NET (or using Java version of Lucene, or in any other language that has port of Lucene).


Could you be a bit more specific on what you mean by fuzzy matching?

Lucene offers fuzzy queries using the tilde(~) operator and the wildcards (* & ?) See here

If you want to compare string distance of 2 strings using methods such as Levenshtein, Jaro-Winkler etc. you are better off using a separate library such as SimMetrics. I use Simmetrics in my production site and it works fab.

SimMetricsMetricUtilities.Levenstein ls = new SimMetricsMetricUtilities.Levenstein(); //compare string 1, string 2 
double sim = ls.GetSimilarity(string_1, string_2); 
if(sim > [some value]) 
{ 
//do something 
} 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜