| | |
The "Did you mean" feature
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2008
Posts: 3
Reputation:
Solved Threads: 0
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
I heard Python might be suitable for such things, but I would'n mint to see a non-Python solution

Thanks, Lucy
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
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.
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.
•
•
Join Date: Mar 2008
Posts: 3
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- "some" program updaters no longer access internet (Windows NT / 2000 / XP)
- ":" other than inheritance? (C++)
- XP Home "no like" Joe!!! (Windows NT / 2000 / XP)
- Yellow flashing question mark/ "X".....GRRRRRRR (Viruses, Spyware and other Nasties)
- red circle with white "x" ??? help (Viruses, Spyware and other Nasties)
- Removal of "Home Search Assistant", "Search Extender", & "Shopping Wizard" (Viruses, Spyware and other Nasties)
- Hi there... I'm the new "old" guy who stumbled into Daniweb (Community Introductions)
- hotmail not showing "from" in inbox (Web Browsers)
Other Threads in the Python Forum
- Previous Thread: reading date format
- Next Thread: XML parsing
| Thread Tools | Search this Thread |
Tag cloud for Python
accessdenied advanced argv beginner change code command convert csv cursor def dictionary digital dynamic dynamically editing enter event examples excel file float format frange ftp function google gui homework i/o import input jaunty java keyboard lapse line linux list lists loop microphone mouse newb number numbers obexftp output panel parameters parsing path port prime program programming projects py2exe pygame pygtk pyopengl pyqt python random recursion recursive remote return scrolledtext session skinning sprite ssh stderr string strings strip subprocess syntax table tennis terminal text thread threading time tkinter tlapse tuple tutorial ubuntu unicode unit urllib urllib2 variable voip web-scrape windows wxpython





