Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ideas for creating a "Did you mean XYZ" feature into website

I'd like to give users the ability to search through a large list of businesses, but still find near matches.

Does anyone have any recommendations on how best to go about this when you're not targeting simple dictionary words, but instead complex names like ABC Business Name?

Regards.

like image 217
Keith Adler Avatar asked Dec 08 '09 22:12

Keith Adler


2 Answers

Check out the wikipedia article on Levenshtein distance. It's a fairly simple concept to wrap your head around and pretty easy to implement an algorithm in whichever language you are using, in your case, C#.

I found an example in C# for you here.

Also, here is an example of a spelling corrector from Peter Norvig of Google. It was said on the SO podcast a few episodes ago that Jon Skeet attempted a rewrite of this same algorithm in C#. Not sure if he completed it and/or made it publicly available though.

like image 56
jamesaharvey Avatar answered Nov 17 '22 21:11

jamesaharvey


Consider using Keyword match and edit distance based similarity. Might combine with 'original searched' to 'actually clicked'.

like image 2
Dr. Xray Avatar answered Nov 17 '22 21:11

Dr. Xray