Similarity/Dice.pm

filter: Statementstmt 100% 13 / 13 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 18 / 18 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Similarity/Cosine.pm ↑ Summary Similarity/Jaccard.pm »
1 package Bag::Similarity::Dice;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use parent 'Bag::Similarity';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 our $VERSION = '0.022';
9  
10 19 ▶sub from_bags {
Subroutine from_bags: called CC=1 SCAR=0.0
Pod documented
11 19 my ($self, $set1, $set2) = @_;
12
13 # $dice = ($intersection * 2 / $combined_length);
14 return (
15 19 $self->intersection($set1,$set2) * 2 / $self->combined_length($set1,$set2)
16 );
17 }
18  
19 2 1;
20  
21  
22 __END__
« Similarity/Cosine.pm ↑ Summary Similarity/Jaccard.pm »