« blib/lib/PMLTQ/Relation/CurrentTreeIterator.pm
↑ Summary
blib/lib/PMLTQ/Relation/PDT/TEParentIterator.pm »
| 1 | package PMLTQ::Relation::PDT::AEParentIterator; | ||||||||||
| 2 | 11 | our $AUTHORITY = 'cpan:MATY'; | |||||||||
| 3 | 11 | $PMLTQ::Relation::PDT::AEParentIterator::VERSION = '1.5.0'; | |||||||||
| 4 | # ABSTRACT: Effective parent relation iterator on a-nodes for PDT like treebanks | ||||||||||
| 5 | |||||||||||
| 6 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 11 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 11 | ▶ | use base qw(PMLTQ::Relation::SimpleListIterator); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 11 | ▶ | use PMLTQ::PML2BASE; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | use PMLTQ::Relation { | ||||||||||
| 11 | 11 | name => 'eparent', | |||||||||
| 12 | table_name => 'adata__#eparents', | ||||||||||
| 13 | schema => 'adata', | ||||||||||
| 14 | tree_root => 'a-root', | ||||||||||
| 15 | reversed_relation => 'implementation:echild', | ||||||||||
| 16 | start_node_type => 'a-node', | ||||||||||
| 17 | target_node_type => 'a-node', | ||||||||||
| 18 | iterator_class => __PACKAGE__, | ||||||||||
| 19 | iterator_weight => 2, | ||||||||||
| 20 | test_code => q( grep($_ == $end, PMLTQ::Relation::PDT::AGetEParents($start,\&PMLTQ::Relation::PDT::ADiveAuxCP)) ? 1 : 0 ), | ||||||||||
| 21 | 11 | ▶ | }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 11 | ▶ | use PMLTQ::Relation::PDT; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | sub get_node_list { | ||||||||||
| 25 | 0 | ▶ | my ($self, $node) = @_; | ||||||||
|
Subroutine
get_node_list: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 26 | 0 | my $type = $node->type->get_base_type_name; | |||||||||
| 27 | 0 | my $fsfile = $self->start_file; | |||||||||
| 28 | 0 | return [ map [ $_, $fsfile ], PMLTQ::Relation::PDT::AGetEParents($node, \&PMLTQ::Relation::PDT::ADiveAuxCP) ]; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | sub dump_relation { | ||||||||||
| 32 | 0 | ▶ | my ($tree,$hash,$fh)=@_; | ||||||||
|
Subroutine
dump_relation: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 33 | |||||||||||
| 34 | 0 | my $name = $tree->type->get_schema->get_root_name; | |||||||||
| 35 | 0 | ▶ | die 'Trying dump relation eparent for incompatible schema' unless $name =~ /^adata/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | |||||||||||
| 37 | 0 | for my $node ($tree->descendants) { | |||||||||
| 38 | 0 | for my $p (PMLTQ::Relation::PDT::AGetEParents($node,\&PMLTQ::Relation::PDT::ADiveAuxCP)) { | |||||||||
| 39 | 0 | $fh->print(PMLTQ::PML2BASE::mkdump($hash->{$node}{'#idx'},$hash->{$p}{'#idx'})); | |||||||||
| 40 | } | ||||||||||
| 41 | } | ||||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | |||||||||||
| 45 | 11 | 1; | |||||||||
| 46 | |||||||||||
| 47 | __END__ | ||||||||||