MSTperl/Edge.pm

filter: Statementstmt 73.6% 28 / 38 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 33.3% 1 / 3 totaltotal 69.2% 36 / 52 CC 4 SCAR 11.7
CC
4
Cov
70%
features_all_labeller
5.9
BUILD
2.0
signature
2.0
CRAP 3.2
« MSTperl/Writer.pm ↑ Summary MSTperl/ModelUnlabelled.pm »
1 package Treex::Tool::Parser::MSTperl::Edge;
2 {
3 7 $Treex::Tool::Parser::MSTperl::Edge::VERSION = '0.11949';
4 }
5  
6 7 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 7 ▶use Treex::Tool::Parser::MSTperl::Node;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 7 has config => (
11 isa => 'Treex::Tool::Parser::MSTperl::Config',
12 is => 'rw',
13 );
14  
15 7 has parent => (
16 isa => 'Treex::Tool::Parser::MSTperl::Node',
17 is => 'ro',
18 required => 1,
19 );
20  
21 7 has child => (
22 isa => 'Treex::Tool::Parser::MSTperl::Node',
23 is => 'ro',
24 required => 1,
25 );
26  
27 7 has first => (
28 isa => 'Treex::Tool::Parser::MSTperl::Node',
29 is => 'rw',
30 );
31  
32 7 has second => (
33 isa => 'Treex::Tool::Parser::MSTperl::Node',
34 is => 'rw',
35 );
36  
37 7 has sentence => (
38 isa => 'Treex::Tool::Parser::MSTperl::Sentence',
39 is => 'ro',
40 required => 1,
41 weak_ref => 1,
42 );
43  
44 7 has features => (
45 is => 'rw',
46 isa => 'Maybe[ArrayRef[Str]]',
47 );
48  
49 4334 ▶sub BUILD {
Subroutine BUILD: called CC=2 SCAR=6.9
Pod undocumented
50 4334 my ($self) = @_;
51  
52 4334 ▶ if ( $self->parent->ord < $self->child->ord ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->parent->ord < $self->child->ord) { } 2379 1955 4334
53  
54 # parent precedes child
55 2379 $self->first( $self->parent );
56 2379 $self->second( $self->child );
57  
58 } else {
59  
60 # parent follows child
61 1955 $self->first( $self->child );
62 1955 $self->second( $self->parent );
63 }
64  
65 4334 $self->config( $self->parent->config );
66  
67 4334 return;
68 }
69  
70 0 ▶sub signature {
Subroutine signature: not called CC=1 SCAR=6.9
Pod documented
71 0 my ($self) = @_;
72 return
73 0 $self->sentence->id .
74 '#' . $self->parent->ord .
75 '#' . $self->child->ord .
76 '#' . $self->child->label;
77 }
78  
79 # all features, including dynamic if applicable, for labelling only
80 1792 ▶sub features_all_labeller {
Subroutine features_all_labeller: called CC=3 SCAR=17.8
Pod undocumented
81 1792 my ($self) = @_;
82  
83 1792 my $ALGORITHM = $self->config->labeller_algorithm;
84  
85 1792 ▶ if ( $ALGORITHM < 20 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ALGORITHM < 20) { } 1792 0 1792
86 1792 return $self->features;
87 } else {
88 0 ▶ if ( keys %{ $self->config->labelledFeaturesControl->dynamic_features } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %{$self->config->labelledFeaturesControl->dynamic_features;}) { } 0 0 0
89 0 my @features = @{ $self->features };
90 push @features,
91 @{
92 0 $self->config->labelledFeaturesControl->get_all_features(
93 $self, 1
94 )
95 };
96 0 return \@features;
97 } else {
98 0 return $self->features;
99 }
100 }
101 }
102  
103 7 1;
104  
105 __END__
« MSTperl/Writer.pm ↑ Summary MSTperl/ModelUnlabelled.pm »