line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package KinoSearch1::Analysis::PolyAnalyzer; |
2
|
26
|
|
|
26
|
|
7048
|
use strict; |
|
26
|
|
|
|
|
58
|
|
|
26
|
|
|
|
|
898
|
|
3
|
26
|
|
|
26
|
|
141
|
use warnings; |
|
26
|
|
|
|
|
88
|
|
|
26
|
|
|
|
|
654
|
|
4
|
26
|
|
|
26
|
|
132
|
use KinoSearch1::Util::ToolSet; |
|
26
|
|
|
|
|
54
|
|
|
26
|
|
|
|
|
9771
|
|
5
|
26
|
|
|
26
|
|
153
|
use base qw( KinoSearch1::Analysis::Analyzer ); |
|
26
|
|
|
|
|
55
|
|
|
26
|
|
|
|
|
2647
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
26
|
|
|
26
|
|
271
|
__PACKAGE__->init_instance_vars( |
9
|
|
|
|
|
|
|
# constructor params / members |
10
|
|
|
|
|
|
|
analyzers => undef, |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
26
|
|
|
26
|
|
15132
|
use KinoSearch1::Analysis::LCNormalizer; |
|
26
|
|
|
|
|
77
|
|
|
26
|
|
|
|
|
655
|
|
15
|
26
|
|
|
26
|
|
162
|
use KinoSearch1::Analysis::Tokenizer; |
|
26
|
|
|
|
|
63
|
|
|
26
|
|
|
|
|
505
|
|
16
|
26
|
|
|
26
|
|
14145
|
use KinoSearch1::Analysis::Stemmer; |
|
26
|
|
|
|
|
83
|
|
|
26
|
|
|
|
|
5267
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub init_instance { |
19
|
9
|
|
|
9
|
1
|
19
|
my $self = shift; |
20
|
9
|
|
|
|
|
65
|
my $language = $self->{language} = lc( $self->{language} ); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# create a default set of analyzers if language was specified |
23
|
9
|
100
|
|
|
|
45
|
if ( !defined $self->{analyzers} ) { |
24
|
3
|
50
|
|
|
|
13
|
croak("Must specify either 'language' or 'analyzers'") |
25
|
|
|
|
|
|
|
unless $language; |
26
|
3
|
|
|
|
|
49
|
$self->{analyzers} = [ |
27
|
|
|
|
|
|
|
KinoSearch1::Analysis::LCNormalizer->new( language => $language ), |
28
|
|
|
|
|
|
|
KinoSearch1::Analysis::Tokenizer->new( language => $language ), |
29
|
|
|
|
|
|
|
KinoSearch1::Analysis::Stemmer->new( language => $language ), |
30
|
|
|
|
|
|
|
]; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub analyze { |
35
|
11298
|
|
|
11298
|
1
|
15046
|
my ( $self, $token_batch ) = @_; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# iterate through each of the anayzers in order |
38
|
11298
|
|
|
|
|
11439
|
$token_batch = $_->analyze($token_batch) for @{ $self->{analyzers} }; |
|
11298
|
|
|
|
|
41252
|
|
39
|
|
|
|
|
|
|
|
40
|
11298
|
|
|
|
|
29744
|
return $token_batch; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |