The "Did you mean" feature

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2008
Posts: 3
Reputation: lucym is an unknown quantity at this point 
Solved Threads: 0
lucym lucym is offline Offline
Newbie Poster

The "Did you mean" feature

 
0
  #1
Mar 19th, 2008
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...

I heard Python might be suitable for such things, but I would'n mint to see a non-Python solution

Thanks, Lucy
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 311
Reputation: BearofNH is on a distinguished road 
Solved Threads: 40
BearofNH's Avatar
BearofNH BearofNH is offline Offline
Posting Whiz

Re: The "Did you mean" feature

 
0
  #2
Mar 19th, 2008
Well, that depends upon what you mean ...

Can you keep track of those queries where the user gets back 0 results? Just save the request to a file. Then periodically review the file yourself and manually add the definitions. Python dictionaries could be used there.

So you might see "dvitops" and realize that the user was asking for "dvi2ps", and so set up a dictionary entry didyoumean['dvitops']='dvi2ps' and go from there.

Obviously Google doesn't do it this way but they have the luxury of being able to observe queries one after another from the same person. And they have a huge universe of terms to worry about. You don't have either. You have a relatively small set of names, and therefore a relatively small set of possible mistakes. After the first few dozen entries your didyoumean[] dictionary will grow slowly and your hit rate should increase.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 3
Reputation: lucym is an unknown quantity at this point 
Solved Threads: 0
lucym lucym is offline Offline
Newbie Poster

Re: The "Did you mean" feature

 
0
  #3
Mar 20th, 2008
I can keep track of the searches, in fact I already save them, and their number. but when you have a large number of searches, manual suggestions is not a solutin...

i now try to implement levenstein, soundex, and yahoo api... hopefully one will do the task
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 3
Reputation: lucym is an unknown quantity at this point 
Solved Threads: 0
lucym lucym is offline Offline
Newbie Poster

Re: The "Did you mean" feature

 
0
  #4
Mar 22nd, 2008
OK, the winner is Yahoo Spelling Suggestion (which uses Yahoo API). This gives your site the possibility to suggest exactly what Yahoo Search suggests 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
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 311
Reputation: BearofNH is on a distinguished road 
Solved Threads: 40
BearofNH's Avatar
BearofNH BearofNH is offline Offline
Posting Whiz

Re: The "Did you mean" feature

 
0
  #5
Mar 24th, 2008
I just tried it. Very nice indeed. Thanks for sharing your solution.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



Tag cloud for Python
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC