NAME

Text::Similarity::Overlaps - module for computing the similarity of text documents using literal string (word token) overlaps

SYNOPSIS

# this will return an un-normalized score that just gives the
# number of overlaps

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 = '../../../t/test1.txt';
my $text_file2 = '../../../t/test2.txt';

my $score = $mod->getSimilarity ($text_file1, $text_file2);
print "The similarity of $text_file1 and $text_file2 is : $score\n";

DESCRIPTION

This module computes the similarity of two text documents by searching for literal word token overlaps in the two documents. The score is based on the F-measure and ranges between 0 and 1. The F-measure is defined as follows :

precision = overlap_score / length_of_file_2
recall    = overlap_score / length_of_file_1
F-measure = 2 * precision * recall / (precision + recall)

SEE ALSO

AUTHOR

Ted Pedersen, University of Minnesota, Duluth tpederse at d.umn.edu

Jason Michelizzi

Last modified by : $Id: Overlaps.pm,v 1.11 2008/03/20 04:40:46 tpederse Exp $

COPYRIGHT AND LICENSE

Copyright (C) 2004-2008 by Jason Michelizzi and 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