| 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 || ''
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
| |||||||||||||
| 15 | 0 | ▶ | if ( $parent_functor !~ /(Coord|Apos)/ ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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 || ''
MC/DC0%0/1
$_->afun || ''
$_->afun
Truth table0%0/2
A
A= $_->afun
| |||||||||||||
| 23 | $a_root->get_descendants | ||||||||||||
| 24 | ) | ||||||||||||
| 25 | { | ||||||||||||
| 26 | 0 | ▶ | if ( not grep { $_->is_member } $a_node->get_children ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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. | ||||||||||||