Implementation "Did you mean?" feature used on Amazon and Google


I have a website and I use a Google widget to search. Now I would like to have, if possible, the “You mean:” function as used on Amazon and Google . This function will allow the user to search for a product, and if the desired product does not exist, the search results will offer an offer. For instance. if a visitor searches for “ Wonder Mop 3000 ”, but the site offers only “ Wonder Mop 1000 ”, then the result above the search results will look like this:

Did you mean: "Wonder Mop 1000"
---------------------------------------
Results for "Wonder Mop 3000"
...

Is this possible when searching on Google or do I need another search engine?

+5
source share
1 answer

Here's an excellent, accessible article by Peter Norwig, Google Research Director, on how to implement the “you meant” function in a few lines of code. This is really great.

http://norvig.com/spell-correct.html

Essentially, you will need a “corpus” or a list of valid searches, and when you search, you will try to find the “most likely” correct search. Below there are links to implementations in different languages, including PHP, of course. Check this:)

+9
source

All Articles