views:

39

answers:

2

Is it possible to get spelling/search suggestions (i.e. "Did you mean") via the RESTful interface to Google's AJAX search API? I'm trying to access this from Python, though the URL query syntax is all I really need.

Thanks!

+1  A: 

the Google AJAX API don't have a spelling check feature see this, you can use the SOAP service but i think it's no longer available .

at last you can look at yahoo API they have a feature for spelling check.

EDIT : check this maybe it can help you:

import httplib
import xml.dom.minidom

data = """
<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1">
    <text> %s </text>
</spellrequest>
"""

word_to_spell = "gooooooogle"

con = httplib.HTTPSConnection("www.google.com")
con.request("POST", "/tbproxy/spell?lang=en", data % word_to_spell)
response = con.getresponse()

dom = xml.dom.minidom.parseString(response.read())
dom_data = dom.getElementsByTagName('spellresult')[0]

for child_node in dom_data.childNodes:
    result = child_node.firstChild.data.split()

print result
singularity