Text::SenseClusters::LabelEvaluation::SimilarityScore - Module for getting the similarity score between the contents of the two files.


                # The following code snippet will show how to use SimilarityScore.
                package Text::SenseClusters::LabelEvaluation::Test_SimilarityScore;

                # Including the LabelEvaluation Module.
                use Text::SenseClusters::LabelEvaluation::SimilarityScore;

                my $firstString = "IBM::: vice president, million dollars, Wall Street, Deep Blue, ".
                                        "International Business, Business Machines, International Machines, ".
                                        "United States, Justice Department, personal computers";
                my $secondString = "vice president, million dollars, Deep Blue, International Business, ".
                                                "Business Machines, International Machines, United States, Justice Department";
                my $similarityObject = Text::SenseClusters::LabelEvaluation::SimilarityScore->
                                new($firstString,$secondString, "./stoplist.txt");
                #my $score = $similarityObject->computeOverlappingScores();
                        my ($score, %allScores) = $similarityObject->computeOverlappingScores();
                print "Score:: $score \n";
                print "Lesk Score :: $allScores{'lesk'} \n";
                print "Raw Lesk Score :: $allScores{'raw_lesk'} \n";
                print "precision Score :: $allScores{'precision'} \n";
                print "recall Score :: $allScores{'recall'} \n";
                print "F Score :: $allScores{'F'} \n";
                print "dice Score :: $allScores{'dice'} \n";
                print "E Score :: $allScores{'E'} \n";
                print "cosine Score :: $allScores{'cosine'} \n";
                print "\n\n";


This module provide a function that will compare the two strings and return the overlapping scores. Please refer the following for details description how it will calculate the similarity score:

Constructor: new()

This is the constructor which will create object for this class. Reference :

This constructor takes these argument and intialize it for the class:

        1. $clusterData :  Datatype: String
                  This variable contains the labels generated by the SenseClusters.
        2. $scoreObject :  Datatype: String
                  This variable contains the Gold standard key's data.
        3. $stopListFileLoc :  Datatype: String
                  This variable contains the user defined location for the stop list file.
        4. $verbose :  Datatype: integer
                  This variable tells whether to display all type of similarity score or not.             

Function: computeOverlappingScores

Function that will compare the labels file with the wiki files and will return the overlapping score.

@argument1 : Name of the cluster file. @argument2 : Name of the file containing the data from Wikipedia. @argument3 : Name of the file containing the stop word lists.

@return : Return the overlapping scores between these files.

@description : 1). Reading the file name from the command line argument. 2). Invoking the Text::Similarity::Overlaps module and passing the file names for similarity comparison. 3). Then overlapping scores obtained from this module is returned as the similarity value.


Last modified by : $Id:,v 1.6 2013/03/18 00:47:24 jhaxx030 Exp $


        Anand Jha, University of Minnesota, Duluth
        jhaxx030 at

        Ted Pedersen, University of Minnesota, Duluth
        tpederse at


Copyright (C) 2012 Ted Pedersen, Anand Jha

See for more information.

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