Block/W2A/CS/FixIsMember.pm

filter: Statementstmt 53.5% 15 / 28 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 43.1% 19 / 44 CC 8 SCAR 38.8
CC
8
Cov
42%
process_atree
72.0
BEGIN
1.0
BEGIN
1.0
CRAP 48.3
« Block/W2A/CS/FixReflexivePronouns.pm ↑ Summary Block/W2A/CS/FixAtreeAfterMcD.pm »
1 package Treex::Block::W2A::CS::FixIsMember;
2 1 $Treex::Block::W2A::CS::FixIsMember::VERSION = '2.20151102';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Treex::Core::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 extends 'Treex::Core::Block';
8  
9 0 ▶sub process_atree {
Subroutine process_atree: not called CC=8 SCAR=42.8
Pod undocumented
10 0 my ( $self, $a_root ) = @_;
11  
12 # (1) every member must be below coap
13 0 foreach my $a_node ( grep { $_->is_member } $a_root->get_descendants ) {
14 0 ▶ my $parent_functor = $a_node->get_parent->afun || '';
Condition0%0/2
$a_node->get_parent->afun || ''
l!l
00
MC/DC0%0/1
$a_node->get_parent->afun || ''
$a_node->get_parent->afun
Truth table0%0/2
A
A= $a_node->get_parent->afun
Aresult
11
00
15 0 ▶ if ( $parent_functor !~ /(Coord|Apos)/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($parent_functor =~ /(Coord|Apos)/) 0 0 0
16 0 $a_node->set_is_member(undef);
17 }
18 }
19  
20 # (2) there should be at least one member below every co/ap
21 0 foreach my $a_node (
22 0 ▶ grep { ( $_->afun || "" ) =~ /(Coord|Apos)/ }
Condition0%0/2
$_->afun || ''
l!l
00
MC/DC0%0/1
$_->afun || ''
$_->afun
Truth table0%0/2
A
A= $_->afun
Aresult
11
00
23 $a_root->get_descendants
24 )
25 {
26 0 ▶ if ( not grep { $_->is_member } $a_node->get_children ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep {$_->is_member;} $a_node->get_children) 0 0 0
27  
28 # !!! vetsinou jde opravdu o bezdetne PRECy, zbyvajici vyjimky by se musely o dost resit sloziteji
29 0 foreach my $child ( $a_node->get_children ) {
30 0 $child->set_is_member(1);
31 }
32 }
33 }
34 0 return;
35 }
36  
37 1 1;
38  
39 =over
40  
41 =item Treex::Block::W2A::CS::FixIsMember
42  
43 The attribute C<is_member> is fixed: (1) is_member can be equal to
44 1 only below coap nodes, (2) below each coap node there has to be
45 at least one node with is_member equal to 1.
46  
47 =back
48  
49 =cut
50  
51 # Copyright 2008-2011 Zdenek Zabokrtsky, David Marecek
52  
53 # This file is distributed under the GNU General Public License v2. See $TMT_ROOT/README.
« Block/W2A/CS/FixReflexivePronouns.pm ↑ Summary Block/W2A/CS/FixAtreeAfterMcD.pm »