开发者

Approximation String Match in Ruby

I am writing a small utility where I want to filter the most relevant results based on the searched values:

For example : If the user has searched for "just for fun linus" , and my search result is following:

  1. "Just for Girls"

  2. "Just for Fun: Easy Rock Banjo"

  3. "Just For Fun: The Sto开发者_Python百科ry Of An Accidental Revolutionary Linus Torvalds"

my algorithm should give highest weight to the last one. Currently I have a homegrown algorithm which uses soundex match to give weight but fails sometimes.

Is there a ruby gem that can give me best possible way to find the nearest matching string ? I tried using 'amatch' - but its not giving correct match weights.


I found a gem - amatch - which does this task really well

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜