From: Ted P. <tpederse@d.umn.edu> - 2008-11-21 13:37:50
|
Hi Hamed, Thanks for your interest in Text-Similarity. See my comments inline... On Fri, Nov 21, 2008 at 1:13 AM, <kha...@pe...> wrote: > Dear Dr.Pedersen > > I need to use text::similarity module in my project so I wanted to know: > > 1- How to extract only Lesk measurement from text:similarity in case that > I need only that one since when I put > > ('normalize' => 1, 'verbose' => 1) it gives range of measures that I need > only Lesk to put in my program . is there any > > extra functions for that ? in other word I need to put Lesk measure into $my > score to be used for calculating > > sentences semantic relateness in my project. The following code (from http://search.cpan.org/dist/Text-Similarity/lib/Text/Similarity.pm) will give you just the Lesk (overlap) measure. This is not actually the same thing as "semantic relatedness", so if you are interested in that you might want to look at the lesk measure as found in WordNet::Similarity, which is based on the use of Text::Similarity but does some other things too. Text::Similarity (for lesk) simply finds the overlaps between two strings or files. use Text::Similarity::Overlaps; my $mod = Text::Similarity::Overlaps->new; defined $mod or die "Construction of Text::Similarity::Overlaps failed"; # adjust file names to reflect true relative position # these paths are valid from lib/Text/Similarity my $text_file1 = 'sent11.txt'; my $text_file2 = 'sent21.txt'; my $score = $mod->getSimilarity ($text_file1, $text_file2); print "The similarity of $text_file1 and $text_file2 is : $score\n"; > > 2- How to cite the job?in my project? You could use the following type of reference : Pedersen, Ted (2008) Text-Similarity (version 0.07) : A Perl Module to Measure the Pair-Wise Similarity of Files or Strings http://search.cpan.org/dist/Text-Similarity/ Good Luck! Ted > > Thank you very much. > > your attention would be most appreciated . > > Hamed Khanpour > > MCS student. > Malaysia > ------------------------------------------------------------------------------------ > UNIVERSITY OF MALAYA - " Producing Leaders Since 1905 " > -- Ted Pedersen http://www.d.umn.edu/~tpederse |