WebService::GoogleHack::Spelling - Retrieves spelling suggestion given a string.


WebService-GoogleHack documentation Contained in the WebService-GoogleHack distribution.

Index


Code Index:

NAME

Top

WebService::GoogleHack::Spelling - Retrieves spelling suggestion given a string.

SYNOPSIS

Top

    use WebService::GoogleHack::Spelling;

    #create an object of type spelling
    my $spelling = WebService::GoogleHack::Spelling->new(); 

    #make sure to initialize the correct wsdl file
    $spelling->init("key","wsdl file"); 

    $results = $spelling->spellingSuggestion($searchString);

    #$results will be a string containing the suggestion (If there is a suggestion given by Google, otherwise it would be a null variable).

    #The suggested "correction" string can also be accessed by,

    #$spelling->{'correction'};




DESCRIPTION

Top

This module interacts with Google to retrieve a spelling suggestion given a string. It is used by the WebService::GoogleHack driver module.

PACKAGE METHODS

Top

__METHOD__->new()

Purpose: This function creates an object of type Spelling and returns a blessed reference.

__METHOD__->init(Key,wsdl_location)

Purpose: This this function can used to inititalize the member variables.

Valid arguments are :

__METHOD__->spellingSuggestion(searchString)

Purpose: This is function is used to retrieve a spelling suggestion from Google

Valid arguments are :

Returns: Returns suggested spelling if there is one, otherwise returns "No Spelling Suggested".

AUTHOR

Top

Pratheepan Raveendranathan, <rave0029@d.umn.edu>

Ted Pedersen, <tpederse@d.umn.edu>

BUGS

Top

SEE ALSO

Top

WebService::GoogleHack home page - http://google-hack.sourceforge.net

Pratheepan Raveendranathan - http://www.d.umn.edu/~rave0029/research

Ted Pedersen - www.d.umn.edu./~tpederse

Google-Hack Maling List <google-hack-users@lists.sourceforge.net>

COPYRIGHT AND LICENSE

Top


WebService-GoogleHack documentation Contained in the WebService-GoogleHack distribution.

#!/usr/local/bin/perl 


package WebService::GoogleHack::Spelling;

our $VERSION = '0.15';

use SOAP::Lite;

sub new
{
my $this = {};  

$this-> {'Key'} = undef;
$this-> {'File_Location'} = undef;
$this-> {'correction'} = undef;

bless $this;

return $this;
}


sub init
{
my $this = shift;

$this->{'Key'} = shift;
$this->{'File_Location'} = shift;

}

sub spellingSuggestion
{
    my $searchInfo=shift;
    $searchString=shift;
    
    $key  = $searchInfo->{'Key'}; 
    $wsdl_path =$searchInfo->{'File_Location'}; 
    
# Initialize with local SOAP::Lite file
    
    $service = SOAP::Lite
	-> service("file:$wsdl_path");
    
    $correction = $service->doSpellingSuggestion($key,$searchString);

if($correction eq "")
{
    $correction="No Spelling Suggested";

}
    
  #  print "\n\nDid you mean: $correction \n";
    $this-> {'correction'} = $correction;
    
    return $correction;


}

1;