WebService::GoogleHack::Rate - This module implements a simple relatedness measure and semantic orientation related type functions.


WebService-GoogleHack documentation  | view source Contained in the WebService-GoogleHack distribution.

Index


NAME

Top

WebService::GoogleHack::Rate - This module implements a simple relatedness measure and semantic orientation related type functions.

SYNOPSIS

Top

    


    use WebService::GoogleHack::Rate;

    #GIVE PATH TO INPUT FILE HERE

    my $INPUTFILE="";

    #GIVE PATH TO TRACE FILE HERE

    my $TRACEFILE="";

    #create an object of type Rate

    my $rate = WebService::GoogleHack::Rate->new(); 

    $results=$rate->measureSemanticRelatedness1("dog", "cat");

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

    $results=$rate->predictSemanticOrientation($INPUTFILE, "excellent", "bad",$TRACEFILE);

    #The resutls can be accessed through 
    print $results->{'prediction'}."\n"; 
    $results->{'PMI Measure'}."\n"; 
    $rate->{'prediction'} &."\n"; 
    $rate->{'PMI Measure'}."\n"; 




DESCRIPTION

Top

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.

PACKAGE METHODS

Top

__METHOD__->new()

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

__METHOD__->init(Params Given Below)

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

Valid arguments are :

__METHOD__->measureSemanticRelatedness1(searchString1,searchString2)

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

Formula used: log(hits(w1)) + log(hits(w2)) - log(hits(w1w2))

Valid arguments are :

Returns: Returns the object containing the relatedness measure.

__METHOD__->measureSemanticRelatedness2(searchString1,searchString2)

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

Formula used: log(w1w2/(w1+w2))

Valid arguments are :

Returns: Returns the object containing the relatedness measure.

__METHOD__->measureSemanticRelatedness3(searchString1,searchString2)

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

Formula used: log( hits(w1w2) / (hits(w1) * hits(w2)))

Valid arguments are :

Returns: Returns the object containing the relatedness measure.

__METHOD__->predictSemanticOrientation(infile,posInf, negInf,trace)

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

Valid arguments are :

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

__METHOD__->predictWordSentiment(infile,posInf,negInf,html,trace)

Purpose:Given an file containing text, this function tries to find the positive and negative words. The formula used to calculate the sentiment of a word is based on the PMI-IR formula given in Peter Turneys paper.

              (hits(word AND "excellent") hits (poor))

         log2 ----------------------------------------

              (hits(word AND "poor") hits (excellent))




For more information refer the paper, "Thumbs Up or Thumbs Down? Semantic Orientation Applied to Unsupervised Classification of Reviews" By Peter Turney.

returns : Returns an html or text version of the results.

__METHOD__->predictPhraseSentiment(infile,,posInf,negInf,html,trace)

Purpose:Given an file containing text, this function tries to find the positive and negative phrases. The formula used to calculate the sentiment of a phrase is based on the PMI-IR formula given in Peter Turneys paper.

              (hits(phrase AND "excellent") hits (poor))

         log2 ------------------------------------------

              (hits(phrase AND "poor") hits (excellent))

For more information refer the paper, "Thumbs Up or Thumbs Down? Semantic Orientation Applied to Unsupervised Classification of Reviews" By Peter Turney.

returns : Returns an html or text version of the results.

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  | view source Contained in the WebService-GoogleHack distribution.