line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bag::Similarity::Jaccard; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
742
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
408
|
use parent 'Bag::Similarity'; |
|
1
|
|
|
|
|
290
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
502
|
use Bag::Similarity::Dice; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
88
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.022'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub from_bags { |
12
|
27
|
|
|
27
|
1
|
49
|
my ($self, $set1, $set2) = @_; |
13
|
|
|
|
|
|
|
|
14
|
27
|
|
|
|
|
63
|
my $intersection = $self->intersection($set1,$set2); |
15
|
27
|
|
|
|
|
69
|
my $union = $self->combined_length($set1,$set2) - $intersection; |
16
|
|
|
|
|
|
|
# ( A intersect B ) / (A union B) |
17
|
27
|
|
|
|
|
154
|
return ($intersection / $union); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__END__ |