blib/lib/KSx/Index/LongFieldSim.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 12 | 12 | 100.0 |
branch | 1 | 2 | 50.0 |
condition | n/a | ||
subroutine | 4 | 4 | 100.0 |
pod | 1 | 1 | 100.0 |
total | 18 | 19 | 94.7 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | 2 | 2 | 551 | use strict; | |||
2 | 5 | ||||||
2 | 90 | ||||||
2 | 2 | 2 | 14 | use warnings; | |||
2 | 6 | ||||||
2 | 136 | ||||||
3 | |||||||
4 | package KSx::Index::LongFieldSim; | ||||||
5 | 2 | 2 | 13 | use base qw( KinoSearch::Index::Similarity ); | |||
2 | 14 | ||||||
2 | 118311 | ||||||
6 | |||||||
7 | sub length_norm { | ||||||
8 | 2 | 2 | 1 | 270 | my ( $self, $num_tokens ) = @_; | ||
9 | 2 | 50 | 7 | $num_tokens = $num_tokens < 100 ? 100 : $num_tokens; | |||
10 | 2 | 61 | return 1 / sqrt($num_tokens); | ||||
11 | } | ||||||
12 | |||||||
13 | 1; | ||||||
14 | |||||||
15 | __END__ |