Sentence.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 61 CC 3 SCAR 11.7
CC
3
Cov
0%
_init
6.0
string
6.0
new
2.0
CRAP 3.2
1 package Lingua::EN::Semtags::Sentence;
2
3 use strict;
4 use warnings;
5 use constant TRUE => 1;
6 use constant FALSE => 0;
7
8 our $VERSION = '0.01';
9
10 #============================================================
11 sub new {
12 #============================================================
13 my ($invocant, %args) = @_;
14 my $self = bless ({}, ref $invocant || $invocant);
15 $self->_init(%args);
16 return $self;
17 }
18
19 #============================================================
20 sub _init {
21 #============================================================
22 my ($self, %args) = @_;
23
24 # Initialize attributes
25 $self->{string} = undef;
26 $self->{word_tokens} = {}; # $token => $pos
27 $self->{phrase_tokens} = {}; # $token => TRUE
28 $self->{lunits} = [];
29
30 # Set the args that came from the constructor
31 foreach my $arg (sort keys %args) {
32 die "Unknown argument: $arg!" unless exists $self->{$arg};
33 $self->{$arg} = $args{$arg};
34 }
35 }
36
37 #============================================================
38 sub string { defined $_[1] ? $_[0]->{string} = $_[1] : $_[0]->{string}; }
39 sub word_tokens { $_[0]->{word_tokens}; }
40 sub phrase_tokens { $_[0]->{phrase_tokens}; }
41 sub lunits { @{$_[0]->{lunits}}; }
42 sub add_lunit { push @{$_[0]->{lunits}}, $_[1]; }
43 #============================================================
44
45 TRUE;
46
47 __END__