Free Web Hosting by Netfirms
Web Hosting by Netfirms | Free Domain Names by Netfirms

Webscrape

A Web 'Screen Scraper' 

mailto:info@webscrape.com


To get Google to suggest an alternative spelling

Google is everybody's friend,  lately I have even been using it to help me with my spelling!  If you type an incorrectly spelled word as part of the search string, it performs the search, but will also suggest a modified search string very often with the spelling mistake fixed.  I use this feature when I don't know how to spell a word.  Consider the word 'thesaurus', if I were to try to spell it I would probably guess something like 'theasarus' which I will be well aware is wrong.  I just ask Google to search for 'theasarus' and sure enough Google says:

Did you mean: thesaurus

Very handy!  Google the stalwart dutifully searches all of its databases for a word that doesn't exist, while I take advantage of its superior spelling knowledge!  There are two cases where Google will not offer an alternative, If the word is really badly spelled, or simply does not exist or if the word is actually correctly spelled.

It is easy to get PageScrape to web clip the spelling suggestion.  Take a look at the HTML source.  The following Regular Expression does the trick: 

Did you mean.*q=([^&]+)&

So to check 'thesaurus' the command line is:

pscrape -u"http://www.google.com/search?q=theasarus" -e"Did you mean.*q=([^&]+)&"

The following is a small Perl script which checks a word that is passed to it as an argument and Screen Scrapes Google's suggestion:

$word = $ARGV[0];
$url = "http://www.google.com/search?q=$word";
$expr = "Did you mean.*q=(
[^&]+)&";
$cmd = "pscrape -u\"$url\" -e\"$expr\"";

$resp = `$cmd`;

if ($resp =~ /.*Error Could/)
{
    print "Google didn't suggest an alternative spelling\n";
}
else
{
    print "Google suggests - $resp";
}