blib/lib/Bag/Similarity/Overlap.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::Overlap; | ||||||
2 | |||||||
3 | 1 | 1 | 912 | use strict; | |||
1 | 2 | ||||||
1 | 56 | ||||||
4 | 1 | 1 | 5 | use warnings; | |||
1 | 2 | ||||||
1 | 36 | ||||||
5 | |||||||
6 | 1 | 1 | 598 | use parent 'Bag::Similarity'; | |||
1 | 557 | ||||||
1 | 11 | ||||||
7 | |||||||
8 | our $VERSION = '0.020'; | ||||||
9 | |||||||
10 | sub from_bags { | ||||||
11 | 20 | 20 | 1 | 26 | my ($self, $set1, $set2) = @_; | ||
12 | |||||||
13 | # ( A intersect B ) / min(A,B) | ||||||
14 | return ( | ||||||
15 | 20 | 48 | $self->intersection($set1,$set2) / $self->min($set1,$set2) | ||||
16 | ); | ||||||
17 | } | ||||||
18 | |||||||
19 | 1; | ||||||
20 | |||||||
21 | __END__ |