Name

WebService::GoogleHack::Rate

SYNOPSIS

To use this module you would also need some extra files. They are: adjectives_list.txt nouns_list.txt adverbs_list.txt verbs_list.txt.

You would also need the WebService::GoogleHack::Text package to use this module.

use WebService::GoogleHack::Rate; my $search = WebService::GoogleHack::Rate->new(); #create an object of type Rate $results=$search->measureSemanticRelatedness("string 1", "string 2");

The PMI measure is stored in the variable $results, and it can also be accessed as $search->{'PMI'};

$results=$search->predictSemanticOrientation("file", "positive", "negative","trace file");

The resutls can be accessed through $results->{'prediction'} & $results->{'PMI Measure'}

or $search->{'prediction'} & $search->{'PMI Measure'}

DESCRIPTION

WebService::GoogleHack::Rate - This package uses Google to do some basic natural language processing. For example, given two words, say "knife" and "cut", the module has the ability to retrieve a semantic relatedness measure, commonly known as the PMI (Pointwise mututal information) measure. The larger the measure the more related the words are. The package can also predict the semantic orientation of a given paragraph of english text. A positive measure means that the paragraph has a positive meaning, and negative measure means the opposite.

WebService::GoogleHack::Text, Search, Rate, Spelling

AUTHOR

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

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

BUGS

SEE ALSO

WebService::GoogleHack home page Pratheepan Raveendranathan Ted Pedersen

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

COPYRIGHT AND LICENSE

Copyright (c) 2003 by Pratheepan Raveendranathan, Ted Pedersen

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to

The Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

PACKAGE METHODS

__PACKAGE__->new(\%args)

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

__PACKAGE__->init(\%args)

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

Valid arguments are :

  • key

    string. key to the google-api

  • File_location

    string. This the wsdl file name

__PACKAGE__->measureSemanticRelatedness(\%args)

Purpose: this is function is used to measure the relatedness between two words.

Valid arguments are :

  • searchString1

    string. The search string which can be a phrase or word

  • searchString2

    string. The search string which can be a phrase or word

Returns: Returns the object containing the PMI measure. ($google->{'PMI'}).

__PACKAGE__->predictSemanticOrientation(\%args)

Purpose: this function tries to predict the semantic orientation of a paragraph of text.

Valid arguments are :

  • config_file

    string. The location of the review file

  • positive_inference.

    string. Positive inference such as excellent

  • negative_inference.

    string. Negative inference such a poor

  • trace_file.

    string. The location of the trace file. If a file_name is given, the results are stored in this file

Returns : the PMI measure and the prediction which is 0 or 1.