Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   The "Did you mean" feature (http://www.go4expert.com/forums/mean-feature-t9437/)

lucym 18Mar2008 22:31

The "Did you mean" feature
 
Hello, I want to add the 'did you mean' feature (like on Google) on my shareware site, where a lot of users have mistypes, and they get 0 results... so they exit the site very fast. Do you have any idea how I could implement such a thing? Does it require a dictionary or something? I found some scripts, but none of them gave relevant results... just stupid, irrelevant suggestions. Any help would be appreciated...
Thanks, Lucy

shabbir 20Mar2008 11:57

Re: The "Did you mean" feature
 
You need a meta data about the data you are searching and then have a sound matching algorithm to find the words that resembles.

As an example I am searching where the following text is in the database :
"You need a meta data about the data you are searching."

Now the meta data would be the following
meta data
data
searching
meta

Now you also have the suggestions based on your meta

say a user types
serching then you don't have the stuff in the meta data and so you suggest him the nearest match like searching.

The meta data that I am talking about can be a dictionary as well.

lucym 20Mar2008 20:13

Re: The "Did you mean" feature
 
i am now testing Levenstein, Soundex, and Yahoo API. I hope at least one will give me good results :)

lucym 22Mar2008 20:47

Re: The "Did you mean" feature
 
OK, the winner is Yahoo Spelling Suggestion (which uses Yahoo API). This gives your site the possibility to suggest exactly what Yahoo Search suggests :cool: Awesome, I would say!

Here is a short summary about using it, if you guys want to use it too: it requires a Yahoo API key, which can be got free. It is limited to 5000 queries per day, so I suggest caching the suggestion (which I implemented, as my site has more then 5000 searches per day). The page returned by Yahoo needs to be parsed, and see if there is a suggestion given. This is a page that gives a suggestion, this is one that has no suggestion.

You can see it live on my shareware site: http://www.coredownload.com/ try some mistypes, like "enail backup", "rgistry cleaner" or whatever you want. I also implemented a function to make bold italic the words that are different between the search query and the suggestion from Yahoo. ;)

If you need assistance on implementing this on your site, let me know.

Thanks, Lucy

cutpasghost 9May2008 05:10

Re: The "Did you mean" feature
 
might be a silly question....but how would you go about caching the suggestions?

you can also email me.
couto.josh at gmail dot com

thanks
Josh


All times are GMT +5.5. The time now is 19:07.