Bag::Similarity::Jaccard - Jaccard similarity for bags
use Bag::Similarity::Jaccard; # object method my $jaccard = Bag::Similarity::Jaccard->new; my $similarity = $jaccard->similarity('Photographer','Fotograf');
$dice / (2 - $dice)
or
( A intersect B ) / (A union B)
Bag::Similarity::Jaccard inherits all methods from Bag::Similarity and implements the following new ones.
my $similarity = $object->from_bags(['a'],['b']);
This method expects two arrayrefs of strings as parameters. The parameters are not checked, thus can lead to funny results or uncatched divisions by zero.
If you want to use this method directly, you should catch the situation where one of the arrayrefs is empty (similarity is 0), or both are empty (similarity is 1).
http://github.com/wollmers/Bag-Similarity
Helmut Wollmersdorfer, <helmut.wollmersdorfer@gmail.com>
Copyright (C) 2014 by 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.