File Coverage

blib/lib/Bag/Similarity/Dice.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Bag::Similarity::Dice;
2              
3 2     2   746 use strict;
  2         4  
  2         63  
4 2     2   11 use warnings;
  2         4  
  2         59  
5              
6 2     2   435 use parent 'Bag::Similarity';
  2         306  
  2         10  
7              
8             our $VERSION = '0.022';
9              
10             sub from_bags {
11 19     19 1 39 my ($self, $set1, $set2) = @_;
12            
13             # $dice = ($intersection * 2 / $combined_length);
14             return (
15 19         52 $self->intersection($set1,$set2) * 2 / $self->combined_length($set1,$set2)
16             );
17             }
18              
19             1;
20              
21              
22             __END__