The following Perl program is a small example of using the spelling suggestion part of the Google API via the Net-Google module.
# gspelling.pl - Net-Google example
#
# © Copyright, 2004-2005 By John Bokma, http://johnbokma.com/
#
# $Id$
use strict;
use warnings;
use Net::Google;
use constant GOOGLE_LICENSE_KEY =>
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
unless ( @ARGV ) {
print "usage: gspelling.pl phrase\n";
exit( 1 );
}
my $google = Net::Google->new( key => GOOGLE_LICENSE_KEY );
my $spelling = $google->spelling( phrase => \@ARGV );
my $result = $spelling->suggest;
print $result ? "Suggestion: $result\n" : "No suggestion\n";
Example of program usage and output:
gspelling.pl exmple
Suggestion: example