I want to use Google's spelling correction/suggestions in an app I'm doing. I've googled it but all I found was examples for Google's canceled SOAP API and the newly deprecated XML Web Search API.
I just want to be able to send a search query and get back the suggested correction.
Which API can I use now? Could you give an example of its usage? Is there a C# Wrapper around it?
Thanks!
EDIT:
The problem with Bing and Yahoo's spelling API is that they seem to check against a dictionary, so some brand/product names are not recognized, Googles seem to be based on usual spelling mistakes and pages they ended up visiting, so it can suggest spell checking for the most common things, ie:
if you type
"hello word"
it will say
"do you mean hello world?"
even though it is spelled correctly
You can check your spelling and grammar in Google Docs, then accept or ignore the corrections. Spelling and grammar suggestions are available in English, Spanish, French, German, Portuguese, and Italian.
Google figures out possible misspellings and their likely correct spellings by using words it finds while searching the web and processing user queries.
If you don't have to use Google, the Bing API actually includes Spelling, you can use http://bingsharp.codeplex.com/
If anything, you could build it yourself with a small C# program that downloaded google's search page for a particular word i.e http://www.google.com/search?q=filipines and search for the
Showing results for philippines. Search instead for filipines
fragment, which would be contained in a <p class="sp_cnt">
in case the wording was incorrect, from there you could just extract the suggested correct spelling
Update: Actually, depending on a couple of things, it could also be in a <p class="ssp">
, I think it depends on how long the phrase is, anyways you could search for the <span id="topstuff">
and find a child paragraph with either class, and extract the correct spelling from there, note that in the "ssp"
case the wording is different:
Did you mean: showing result for phi
You could parse the page as an XML, if the code is XHTML compliant, then hurrah, otherwise you would have to tweak it a bit, making it "well-formed" to be loaded with XML as a XMLDocument. After that it should be easy finding the fragment of the page (should it exist) that tells you the appropriate spelling
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With