line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Mining::Algorithm::Base; |
2
|
1
|
|
|
1
|
|
1239
|
use base qw(Text::Mining::Base); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
75
|
|
3
|
|
|
|
|
|
|
use Class::Std; |
4
|
|
|
|
|
|
|
use Class::Std::Utils; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use warnings; |
7
|
|
|
|
|
|
|
use strict; |
8
|
|
|
|
|
|
|
use Carp; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use version; our $VERSION = qv('0.0.8'); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
{ |
13
|
|
|
|
|
|
|
my %attribute_of : ATTR( get => 'attribute', set => 'attribute' ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub version { return "Text::Mining::Algorithm::Base Version $VERSION"; } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub BUILD { |
18
|
|
|
|
|
|
|
my ($self, $ident, $arg_ref) = @_; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
return; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _by_text() { |
24
|
|
|
|
|
|
|
my ($self, $arg_ref) = @_; |
25
|
|
|
|
|
|
|
my $text = $arg_ref->{text}; |
26
|
|
|
|
|
|
|
my @count = split(/\s+/, $text); |
27
|
|
|
|
|
|
|
print "algorithm->_by_text(): Found ", scalar(@count), " tokens.\n"; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _by_section() { |
33
|
|
|
|
|
|
|
my ($self, $arg_ref) = @_; |
34
|
|
|
|
|
|
|
my $section = $arg_ref->{section}; |
35
|
|
|
|
|
|
|
my @count = split(/\s+/, $section); |
36
|
|
|
|
|
|
|
print "algorithm->_by_section(): Found ", scalar(@count), " tokens.\n"; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
return; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _by_paragraph() { |
42
|
|
|
|
|
|
|
my ($self, $arg_ref) = @_; |
43
|
|
|
|
|
|
|
my $paragraph = $arg_ref->{paragraph}; |
44
|
|
|
|
|
|
|
my @count = split(/\s+/, $paragraph); |
45
|
|
|
|
|
|
|
print "algorithm->_by_paragraph(): Found ", scalar(@count), " tokens.\n"; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub _by_line() { |
51
|
|
|
|
|
|
|
my ($self, $arg_ref) = @_; |
52
|
|
|
|
|
|
|
my $line = $arg_ref->{line}; |
53
|
|
|
|
|
|
|
my @count = split(/\s+/, $line); |
54
|
|
|
|
|
|
|
print "algorithm->_by_line(): Found ", scalar(@count), " tokens.\n"; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
61
|
|
|
|
|
|
|
__END__ |