line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plucene::Analysis::UTF8Tokenizer; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use base qw/Plucene::Analysis::Tokenizer/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
812
|
|
6
|
1
|
|
|
1
|
|
6878
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
90
|
|
7
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
388
|
|
8
|
|
|
|
|
|
|
|
9
|
0
|
|
|
0
|
0
|
|
sub token_re { //o } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub next |
12
|
|
|
|
|
|
|
{ |
13
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
14
|
0
|
|
|
|
|
|
my $fh = $self->{reader}; |
15
|
|
|
|
|
|
|
|
16
|
0
|
0
|
0
|
|
|
|
if (!defined $self->{buffer} or length $self->{buffer} == 0) { |
17
|
0
|
|
|
|
|
|
$self->{buffer} .= <$fh>; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
|
if ($self->{buffer}) { |
21
|
0
|
0
|
|
|
|
|
$self->{word} = [] unless ref $self->{word}; |
22
|
0
|
|
|
|
|
|
$self->scantext($self->{buffer}); |
23
|
0
|
|
|
|
|
|
$self->{buffer} = undef; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub scantext |
28
|
|
|
|
|
|
|
{ |
29
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
30
|
0
|
0
|
|
|
|
|
my $text = shift or return; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
$text = lc $text; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my %tok; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
foreach ($self->{word}) { |
37
|
0
|
|
|
|
|
|
$tok{$_} = 1; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $c = undef; |
41
|
0
|
|
|
|
|
|
while ($text =~ /([a-z\d]+|\S)/go) { |
42
|
0
|
|
|
|
|
|
$tok{$1} = 1; |
43
|
0
|
0
|
|
|
|
|
$tok{$c . $1} = 1 if defined $c; |
44
|
0
|
|
|
|
|
|
$c = $1; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
$self->{word} = [keys %tok]; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
__END__ |