Bag::Similarity - Similarity measures for bags
use Bag::Similarity;
Bag::Similarity is the base class for similarity measures of bags.
All methods can be used as class or object methods.
$object = Bag::Similarity->new();
my $similarity = $object->similarity($any1,$any1,$width);
$any can be an arrayref, a hashref or a string. Strings are tokenized into n-grams of width $width.
$any
$width
$width must be integer, or defaults to 1.
my $similarity = $object->from_tokens(['a','b'],['b']);
my $similarity = $object->from_bags(['a'],['b']);
Croaks if called directly. This method should be implemented in a child module.
my $intersection_size = $object->intersection(['a'],['b']);
my $set_size_sum = $object->combined_length(['a'],['b']);
my $min_set_size = $object->min(['a'],['b']);
my @monograms = $object->ngrams('abc'); my @bigrams = $object->ngrams('abc',2);
my $arrayref = $object->_any($any,$width);
Helmut Wollmersdorfer <helmut@wollmersdorfer.at>
Copyright 2014-2020 Helmut Wollmersdorfer
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Bag::Similarity, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bag::Similarity
CPAN shell
perl -MCPAN -e shell install Bag::Similarity
For more information on module installation, please visit the detailed CPAN module installation guide.