line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bag::Similarity::Jaccard; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1044
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
56
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
40
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
435
|
use parent 'Bag::Similarity'; |
|
1
|
|
|
|
|
302
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
425
|
use Bag::Similarity::Dice; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
70
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.020'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub from_bags { |
12
|
27
|
|
|
27
|
1
|
34
|
my ($self, $set1, $set2) = @_; |
13
|
|
|
|
|
|
|
|
14
|
27
|
|
|
|
|
73
|
my $intersection = $self->intersection($set1,$set2); |
15
|
27
|
|
|
|
|
83
|
my $union = $self->combined_length($set1,$set2) - $intersection; |
16
|
|
|
|
|
|
|
# ( A intersect B ) / (A union B) |
17
|
27
|
|
|
|
|
179
|
return ($intersection / $union); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__END__ |