blib/lib/Lingua/Ogmios/Annotations/Stem.pm

filter: Statementstmt 22.9% 11 / 48 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 30.0% 3 / 10 Podpod 0.0% 0 / 7 totaltotal 15.9% 14 / 88 CC 11 SCAR 24.8
CC
11
Cov
16%
new
30.0
setstem_form_idx
12.0
refid_word
6.0
CRAP 11.9
« blib/lib/Lingua/Ogmios/NLPWrappers/BasicWordSegmentizer.pm ↑ Summary blib/script/SplitCollection.pl »
1 package Lingua::Ogmios::Annotations::Stem;
2  
3 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 16 ▶use Lingua::Ogmios::Annotations::Element;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 16 our @ISA = qw(Lingua::Ogmios::Annotations::Element);
8  
9  
10 # <!-- =================================================== -->
11 # <!-- STEM LEVEL -->
12 # <!-- =================================================== -->
13 # <!ELEMENT stem_level (log_id?, comments*, stem+) >
14
15 # <!-- stem -->
16 # <!ELEMENT stem (id, log_id?, stem_form+,
17 # refid_word, form?) >
18
19 # <!-- stem form -->
20 # <!ELEMENT stem_form (#PCDATA) >
21
22 0 ▶sub new {
Subroutine new: not called CC=5 SCAR=34.0
Pod undocumented
23 0 my ($class, $fields) = @_;
24  
25 0 ▶ if (!defined $fields->{'id'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $fields->{"id"}) 0 0 0
26 0 $fields->{'id'} = -1;
27 }
28 0 ▶ if (!defined $fields->{'refid_word'}) { # refid_word
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $fields->{"refid_word"}) 0 0 0
29 0 die("refid_word is not defined");
30 }
31 0 ▶ if (!defined $fields->{'stem_form'}) { # stem_form
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $fields->{"stem_form"}) 0 0 0
32 0 die("stem_form is not defined");
33 }
34 my $stem = $class->SUPER::new({
35 0 'id' => $fields->{'id'},
36 # 'form' => $fields->{'form'},
37 }
38 );
39 0 bless ($stem,$class);
40  
41 0 $stem->stem_form($fields->{'stem_form'});
42 0 $stem->refid_word($fields->{'refid_word'});
43  
44 0 ▶ if (defined $fields->{'log_id'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $fields->{"log_id"}) 0 0 0
45 0 $stem->setLogId($fields->{'log_id'});
46 }
47 0 return($stem);
48 }
49  
50 0 ▶sub refid_word {
Subroutine refid_word: not called CC=2 SCAR=17.9
Pod undocumented
51 0 my $self = shift;
52  
53 0 ▶ $self->{'refid_word'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
54 0 return($self->{'refid_word'});
55 }
56  
57 0 ▶sub stem_form {
Subroutine stem_form: not called CC=2 SCAR=17.9
Pod undocumented
58 0 my $self = shift;
59  
60 0 ▶ $self->{"stem_form"} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
61 0 return($self->{"stem_form"});
62 }
63  
64 0 ▶sub setstem_form_idx {
Subroutine setstem_form_idx: not called CC=3 SCAR=24.8
Pod undocumented
65 0 my ($self, $idx , $value) = @_;
66  
67 0 ▶ if ((defined $idx) && (defined $value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $idx and defined $value) { } 0 0 0
Condition0%0/3
defined $idx and defined $value
!ll&&!rl&&r
000
MC/DC0%0/2
defined $idx and defined $value
defined $idx defined $value
Truth table0%0/3
A and B
A= defined $idxB= defined $value
ABresult
0X0
100
111
68  
69 0 $self->stem_form->[$idx] = $value;
70 0 return($value);
71 } else {
72 0 return(undef);
73 }
74 }
75  
76 0 ▶sub add_stem_form_idx {
Subroutine add_stem_form_idx: not called CC=2 SCAR=17.9
Pod undocumented
77 0 my ($self, $value) = @_;
78  
79 0 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 0 0 0
80  
81 0 push @{$self->stem_form}, $value;
82 0 return($value);
83 } else {
84 0 return(undef);
85 }
86 }
87  
88  
89 0 ▶sub getstem_form_idx {
Subroutine getstem_form_idx: not called CC=2 SCAR=17.9
Pod undocumented
90 0 my ($self, $idx) = @_;
91  
92 0 ▶ if (defined $idx) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $idx) { } 0 0 0
93 0 return($self->stem_form->[$idx]);
94 } else {
95 0 return(undef);
96 }
97 }
98  
99 0 ▶sub XMLout {
Subroutine XMLout: not called CC=1 SCAR=6.9
Pod undocumented
100 0 my ($self, $order) = @_;
101
102 0 return($self->SUPER::XMLout("stem", $order));
103 }
104  
105  
106 16 1;
107  
108 __END__
« blib/lib/Lingua/Ogmios/NLPWrappers/BasicWordSegmentizer.pm ↑ Summary blib/script/SplitCollection.pl »