Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Google: "Did you mean:"
#1
Is there any way to use google to check the spelling of things without opening a web browser?

Like can I send a search word to google, and then grab the HTML result of the query then check for a "Did you mean:" then reply back to my program the corrected part?

It's just an idea. Does anyone know if it can be done?

Thanks,
Jimmy Vig
#2
The first part is possible...

str SearchWord="joey figjiani"
SearchWord.findreplace(" " "+")

Code:
Copy      Help
str url.format("http://www.google.com/search?hl=en&q=%s" SearchWord)
HtmlDoc d.InitFromWeb(url)
str s=d.GetHtml
out s

The "Did you mean:" is right here in the HTML there in this section:
Code:
Copy      Help
<DIV class=med id=res>
<H2 class=hd>Search Results</H2>
<DIV>
<OL>
<LI>
<P><FONT class=p color=#cc0000>Did you mean: </FONT><A class=p href="/search?hl=en&amp;ie=UTF-8&amp;sa=X&amp;oi=spell&amp;resnum=1&amp;ct=result&amp;cd=1&amp;q=joey+figgiani&amp;spell=1">joey <B><I>figgiani</I></B></A>

Now to just grab "Joey Figgiani" instead of "Joey Figjiani"

Do you think this would be against Google's policy or anything?
#3
Well...I think I have it figured out!

Spell Check with google "Did you mean:"
Code:
Copy      Help
out
str SearchWord="Joey Figjiani"
str GoogleWord=SearchWord
GoogleWord.findreplace(" " "+")

str url.format("http://www.google.com/search?hl=en&q=%s" SearchWord)
HtmlDoc d.InitFromWeb(url)
str s2=d.GetText("LI")
if _s.get(s2 0 14)="Did you mean: "
,s2.findreplace("Did you mean: " "")
,strrev s2
,s2.findreplace("nwohs stluser 2 poT  " "")
,strrev s2
,SearchWord=s2
else
,out "Word had no suggestions:"
out SearchWord


Forum Jump:


Users browsing this thread: 1 Guest(s)