line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Spellunker::Pod; |
2
|
3
|
|
|
3
|
|
35613
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
94
|
|
3
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
68
|
|
4
|
3
|
|
|
3
|
|
13
|
use utf8; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
18
|
|
5
|
3
|
|
|
3
|
|
888
|
use Spellunker; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
99
|
|
6
|
3
|
|
|
3
|
|
1779
|
use Spellunker::Pod::Parser; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
1403
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
4
|
|
|
4
|
0
|
119897
|
my $class = shift; |
10
|
4
|
|
|
|
|
35
|
bless {spellunker => Spellunker->new()}, $class; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub add_stopwords { |
14
|
3
|
|
|
3
|
0
|
9
|
my $self = shift; |
15
|
3
|
|
|
|
|
29
|
$self->{spellunker}->add_stopwords(@_); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub load_dictionary { |
19
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
20
|
1
|
|
|
|
|
6
|
$self->{spellunker}->load_dictionary(@_); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _check_parser { |
24
|
10
|
|
|
10
|
|
19
|
my ($self, $parser) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# '=for stopwords' |
27
|
10
|
|
|
|
|
13
|
for my $stopwords (@{$parser->stopwords}) { |
|
10
|
|
|
|
|
32
|
|
28
|
2
|
|
|
|
|
12
|
$self->add_stopwords(split /\s+/, $stopwords); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
10
|
|
|
|
|
36
|
my $lines = $parser->lines; |
32
|
10
|
|
|
|
|
44
|
my $line = 0; |
33
|
10
|
|
|
|
|
11
|
my @rv; |
34
|
10
|
|
|
|
|
18
|
for my $line ( @$lines ) { |
35
|
108
|
|
|
|
|
155
|
my $text = $line->[1]; |
36
|
108
|
|
|
|
|
302
|
my @err = $self->{spellunker}->check_line($text); |
37
|
108
|
100
|
|
|
|
280
|
if (@err) { |
38
|
3
|
|
|
|
|
10
|
push @rv, [$line->[0], $line->[1], \@err]; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
10
|
|
|
|
|
216
|
return @rv; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub check_file { |
45
|
10
|
|
|
10
|
0
|
36
|
my ($self, $filename) = @_; |
46
|
|
|
|
|
|
|
|
47
|
10
|
|
|
|
|
86
|
my $parser = Spellunker::Pod::Parser->new(); |
48
|
10
|
|
|
|
|
83
|
$parser->parse_file($filename); |
49
|
10
|
|
|
|
|
345
|
$self->_check_parser($parser); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub check_text { |
53
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $parser = Spellunker::Pod::Parser->new(); |
56
|
0
|
|
|
|
|
|
$parser->parse_string_document($text); |
57
|
0
|
|
|
|
|
|
$self->_check_parser($parser); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|