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:
"Just for Girls"
"Just for Fun: Easy Rock Banjo"
"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
精彩评论