- SOURCE REPOSITORY
- COPYRIGHT AND LICENSE
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)
( A intersect B ) / (A union B)
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).
Helmut Wollmersdorfer, <firstname.lastname@example.org>
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.