File Coverage

blib/lib/Set/Similarity/BV/Jaccard.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 18 18 100.0


line stmt bran cond sub pod time code
1             package Set::Similarity::BV::Jaccard;
2              
3 1     1   618 use strict;
  1         1  
  1         29  
4 1     1   4 use warnings;
  1         1  
  1         29  
5              
6 1     1   401 use parent 'Set::Similarity::BV';
  1         299  
  1         6  
7              
8             our $VERSION = '0.06';
9              
10             sub from_integers {
11 5     5 1 6 my ($self, $v1, $v2) = @_;
12              
13 5         12 my $intersection = $self->intersection($v1,$v2);
14 5         12 my $union = $self->combined_length($v1,$v2) - $intersection;
15             # ( A intersect B ) / (A union B)
16 5         20 return ($intersection / $union);
17             }
18              
19             1;
20              
21             __END__