blib/lib/PMLTQ/Relation/Treex/TEParentIterator.pm

filter: Statementstmt 55.5% 15 / 27 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 45.2% 19 / 42 CC 6 SCAR 31.6
CC
6
Cov
45%
dump_relation
42.0
get_node_list
2.0
BEGIN
1.0
CRAP 23.5
« blib/lib/PMLTQ/Command/load.pm ↑ Summary blib/lib/PMLTQ/Relation/FSFileIterator.pm »
1 package PMLTQ::Relation::Treex::TEParentIterator;
2 12 our $AUTHORITY = 'cpan:MATY';
3 12 $PMLTQ::Relation::Treex::TEParentIterator::VERSION = '1.2.2';
4 # ABSTRACT: Effective parent relation iterator on t-nodes for Treex treebanks
5  
6 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 12 ▶use base qw(PMLTQ::Relation::SimpleListIterator);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 use PMLTQ::Relation {
10 12 name => 'eparent',
11 table_name => 'tdata__#eparents',
12 schema => 'treex_document',
13 reversed_relation => 'implementation:echild',
14 start_node_type => 't-node',
15 target_node_type => 't-node',
16 iterator_class => __PACKAGE__,
17 iterator_weight => 2,
18 test_code => q( grep($_ == $end, PMLTQ::Relation::Treex::TGetEParents($start)) ? 1 : 0 ),
19 12 ▶};
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21  
22 sub get_node_list {
23 0 ▶ my ( $self, $node ) = @_;
Subroutine get_node_list: not called CC=1 SCAR=6.9
Pod undocumented
24 0 my $type = $node->type->get_base_type_name;
25 0 my $fsfile = $self->start_file;
26 0 return [ map [ $_, $fsfile ], PMLTQ::Relation::Treex::TGetEParents($node) ];
27 }
28  
29 sub dump_relation {
30 0 ▶ my ($tree, $hash, $fh ) = @_;
Subroutine dump_relation: not called CC=6 SCAR=37.4
Pod undocumented
31  
32 0 my $name = $tree->type->get_schema->get_root_name;
33 0 ▶ die 'Trying dump relation eparent for incompatible schema' unless $name =~ /^treex_document/;
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /^treex_document/ 0 0 0
34  
35 0 ▶ my $struct_name = $tree->type->get_structure_name || '';
Condition0%0/2
$tree->type->get_structure_name || ''
l!l
00
MC/DC0%0/1
$tree->type->get_structure_name || ''
$tree->type->get_structure_name
Truth table0%0/2
A
A= $tree->type->get_structure_name
Aresult
11
00
36 0 ▶ return unless $struct_name eq 't-root';
Branch: 1 branch
BranchTrueFalseTotal
unless $struct_name eq "t-root" 0 0 0
37  
38 0 for my $node ( $tree->descendants ) {
39 0 for my $p ( PMLTQ::Relation::Treex::TGetEParents($node) ) {
40 0 $fh->print( PMLTQ::PML2BASE::mkdump( $hash->{$node}{'#idx'}, $hash->{$p}{'#idx'} ) );
41 }
42 }
43 }
44  
45 12 1;
46  
47 __END__
« blib/lib/PMLTQ/Command/load.pm ↑ Summary blib/lib/PMLTQ/Relation/FSFileIterator.pm »