| 1 | package Treex::Core::Node::T; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | { | ||||||||||||||||||||||||||||||||||||||||||
| 3 | 60 | $Treex::Core::Node::T::VERSION = '0.08633_1'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 60 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 60 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 60 | ▶ | use Treex::Core::Common; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 60 | extends 'Treex::Core::Node'; | |||||||||||||||||||||||||||||||||||||||||
| 11 | 60 | with 'Treex::Core::Node::Ordered'; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 60 | with 'Treex::Core::Node::InClause'; | |||||||||||||||||||||||||||||||||||||||||
| 13 | 60 | with 'Treex::Core::Node::EffectiveRelations'; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | # t-layer attributes | ||||||||||||||||||||||||||||||||||||||||||
| 16 | 60 | has [ | |||||||||||||||||||||||||||||||||||||||||
| 17 | qw( nodetype t_lemma functor subfunctor formeme tfa | ||||||||||||||||||||||||||||||||||||||||||
| 18 | is_dsp_root sentmod is_parenthesis is_passive is_generated | ||||||||||||||||||||||||||||||||||||||||||
| 19 | is_relclause_head is_name_of_person voice | ||||||||||||||||||||||||||||||||||||||||||
| 20 | t_lemma_origin formeme_origin is_infin | ||||||||||||||||||||||||||||||||||||||||||
| 21 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 22 | ] => ( is => 'rw' ); | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | sub get_pml_type_name { | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 45 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_pml_type_name: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 45 | ▶ | return $self->is_root() ? 't-root.type' : 't-node.type'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | # the node is a root of a coordination/apposition construction | ||||||||||||||||||||||||||||||||||||||||||
| 30 | # analogy of PML_T::IsCoord | ||||||||||||||||||||||||||||||||||||||||||
| 31 | sub is_coap_root { | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 42 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_coap_root: called CC=3 SCAR=11.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 42 | ▶ | log_fatal("Incorrect number of arguments") if @_ != 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 42 | ▶ | return ( $self->functor || '' ) =~ /^(CONJ|CONFR|DISJ|GRAD|ADVS|CSQ|REAS|CONTRA|APPS|OPER)$/; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->functor || ''
MC/DC0%0/1
$self->functor || ''
$self->functor
Truth table50%1/2
A
A= $self->functor
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | #----------- helpers for reference lists ------------ | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | sub _get_node_list { | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 3 | ▶ | my ( $self, $list, $arg_ref ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_node_list: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 3 | $list = $self->get_attr($list); | |||||||||||||||||||||||||||||||||||||||||
| 42 | 3 | my $doc = $self->get_document(); | |||||||||||||||||||||||||||||||||||||||||
| 43 | 3 | ▶ | my @nodes = $list ? ( map { $doc->get_node_by_id($_) } @{$list} ) : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 3 | ▶ | return $arg_ref ? $self->_process_switches( $arg_ref, @nodes ) : @nodes; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | sub _set_node_list { | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_node_list: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $list = shift; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | $self->set_attr( $list, [ map { $_->get_attr('id') } @_ ] ); | |||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | sub _add_to_node_list { | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_to_node_list: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | my $list = shift; | |||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | # get the current elements of the list | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | my $cur_ref = $self->get_attr($list); | |||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | ▶ | my @cur = $cur_ref ? @{$cur_ref} : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | # grep only those that aren't already in the list | ||||||||||||||||||||||||||||||||||||||||||
| 63 | my @new = grep { | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | my $id = $_; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | !any { $_ eq $id } @cur | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 1 | } map { $_->get_attr('id') } @_; | |||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | # set the new list value | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 1 | $self->set_attr( $list, [ @cur, @new ] ); | |||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | sub _remove_from_node_list { | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_remove_from_node_list: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | my $list = shift; | |||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | my @prev = $self->_get_node_list($list); | |||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my @remain; | |||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | foreach my $node (@prev) { | |||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if ( !grep { $_ == $node } @_ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | push @remain, $node; | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $self->_set_node_list( $list, @remain ); | |||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | # TODO: with backrefs this method is no more needed | ||||||||||||||||||||||||||||||||||||||||||
| 89 | # remove unindexed IDs from a list attribute | ||||||||||||||||||||||||||||||||||||||||||
| 90 | sub _update_list { | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | my ( $self, $list ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_update_list: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my $doc = $self->get_document(); | |||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my $ref = $self->get_attr($list); | |||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | my (@nodes, @invalid); | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | return if (!$ref); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | foreach my $id (@{$ref}){ | |||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | if ($doc->id_is_indexed($id)){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | push @nodes, $id; | |||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | push @invalid, $id; | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | $self->set_attr( $list, @nodes > 0 ? [@nodes] : undef ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | #----------- a-layer (analytical) nodes ------------- | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | sub get_lex_anode { | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 5 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_lex_anode: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 5 | my $lex_rf = $self->get_attr('a/lex.rf'); | |||||||||||||||||||||||||||||||||||||||||
| 118 | 5 | my $document = $self->get_document(); | |||||||||||||||||||||||||||||||||||||||||
| 119 | 5 | ▶ | return $document->get_node_by_id($lex_rf) if $lex_rf; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | sub set_lex_anode { | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 4 | ▶ | my ( $self, $lex_anode ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_lex_anode: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 4 | ▶ | my $new_id = defined $lex_anode ? $lex_anode->get_attr('id') : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | 4 | $self->set_attr( 'a/lex.rf', $new_id ); | |||||||||||||||||||||||||||||||||||||||||
| 127 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | sub get_aux_anodes { | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | my ( $self, $arg_ref ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_aux_anodes: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | log_fatal('Switches preceding_only and following_only cannot be used with get_aux_anodes (t-nodes vs. a-nodes).') | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if $arg_ref and ( $arg_ref->{preceding_only} or $arg_ref->{following_only} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$arg_ref and $arg_ref->{"preceding_only"} || $arg_ref->{"following_only"}
$arg_ref->{"preceding_only"} or $arg_ref->{"following_only"}
MC/DC0%0/3
$arg_ref and $arg_ref->{"preceding_only"} || $arg_ref->{"following_only"}
$arg_ref
$arg_ref->{"preceding_only"}
$arg_ref->{"following_only"}
Truth table0%0/4
A and B or C
A= $arg_refB= $arg_ref->{"preceding_only"}C= $arg_ref->{"following_only"}
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | return $self->_get_node_list( 'a/aux.rf', $arg_ref ); | |||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | sub set_aux_anodes { | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_aux_anodes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | return $self->_set_node_list( 'a/aux.rf', @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | sub add_aux_anodes { | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_aux_anodes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | return $self->_add_to_node_list( 'a/aux.rf', @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | sub remove_aux_anodes { | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_aux_anodes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | return $self->_remove_from_node_list( 'a/aux.rf', @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | sub get_anodes { | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | my ( $self, $arg_ref ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_anodes: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | my $lex_anode = $self->get_lex_anode(); | |||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | my @nodes = ( ( defined $lex_anode ? ($lex_anode) : () ), $self->get_aux_anodes() ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | return @nodes if !$arg_ref; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | log_fatal('Switches preceding_only and following_only cannot be used with get_anodes (t-nodes vs. a-nodes).') | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | if $arg_ref->{preceding_only} || $arg_ref->{following_only}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$arg_ref->{"preceding_only"} or $arg_ref->{"following_only"}
MC/DC0%0/2
$arg_ref->{"preceding_only"} or $arg_ref->{"following_only"}
$arg_ref->{"preceding_only"}
$arg_ref->{"following_only"}
Truth table0%0/3
A or B
A= $arg_ref->{"preceding_only"}B= $arg_ref->{"following_only"}
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | return $self->_process_switches( $arg_ref, @nodes ); | |||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | #------------ coreference nodes ------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | sub get_coref_nodes { | ||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | my ( $self, $arg_ref ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_coref_nodes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my @nodes = ( $self->_get_node_list('coref_gram.rf'), $self->_get_node_list('coref_text.rf') ); | |||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | return $self->_process_switches( $arg_ref, @nodes ); | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | sub get_coref_gram_nodes { | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 2 | ▶ | my ( $self, $arg_ref ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_coref_gram_nodes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 2 | return $self->_get_node_list( 'coref_gram.rf', $arg_ref ); | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | sub get_coref_text_nodes { | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 1 | ▶ | my ( $self, $arg_ref ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_coref_text_nodes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | return $self->_get_node_list( 'coref_text.rf', $arg_ref ); | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | # it doesn't return a complete chain, just the members which are accessible | ||||||||||||||||||||||||||||||||||||||||||
| 183 | # from the current node | ||||||||||||||||||||||||||||||||||||||||||
| 184 | # TODO: with backrefs the whole chain is accessible now | ||||||||||||||||||||||||||||||||||||||||||
| 185 | sub get_coref_chain { | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | my ( $self, $arg_ref ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_coref_chain: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my %visited_nodes = (); | |||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | my @nodes; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my @queue = ( $self->_get_node_list('coref_gram.rf'), $self->_get_node_list('coref_text.rf') ); | |||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | while ( my $node = shift @queue ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $visited_nodes{$node} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | push @nodes, $node; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my @antes = ( $node->_get_node_list('coref_gram.rf'), $node->_get_node_list('coref_text.rf') ); | |||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | foreach my $ante (@antes) { | |||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if ( !defined $visited_nodes{$ante} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | push @queue, $ante; | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | return $self->_process_switches( $arg_ref, @nodes ); | |||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | sub add_coref_gram_nodes { | ||||||||||||||||||||||||||||||||||||||||||
| 206 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_coref_gram_nodes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | 1 | return $self->_add_to_node_list( 'coref_gram.rf', @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | sub add_coref_text_nodes { | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_coref_text_nodes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | return $self->_add_to_node_list( 'coref_text.rf', @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | sub remove_coref_nodes { | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_coref_nodes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | $self->_remove_from_node_list( 'coref_gram.rf', @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $self->_remove_from_node_list( 'coref_text.rf', @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | # remove unindexed IDs from coreference lists | ||||||||||||||||||||||||||||||||||||||||||
| 223 | sub update_coref_nodes { | ||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_coref_nodes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $self->_update_list('coref_gram.rf'); | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $self->_update_list('coref_text.rf'); | |||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | # ----------- complement nodes ------------- | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | sub add_compl_nodes { | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_compl_nodes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | return $self->_add_to_node_list( 'compl.rf', @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | sub remove_compl_nodes { | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_compl_nodes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $self->_remove_from_node_list( 'compl.rf', @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | sub update_compl_nodes { | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_compl_nodes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | $self->_update_list('compl.rf'); | |||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | #----------- n-layer (named entity) nodes ------------- | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | sub get_n_node { | ||||||||||||||||||||||||||||||||||||||||||
| 253 | 2 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_n_node: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 2 | ▶ | my $lex_anode = $self->get_lex_anode() or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 2 | return $lex_anode->n_node(); | |||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | #----------- source t-layer (source-language in MT) nodes ------------- | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | sub src_tnode { | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
src_tnode: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | my $source_node_id = $self->get_attr('src_tnode.rf') or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | return $self->get_document->get_node_by_id($source_node_id); | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | sub set_src_tnode { | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | my ( $self, $source_node ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_src_tnode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $self->set_attr( 'src_tnode.rf', $source_node->id ); | |||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | # ---- attributes that contain references | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | override '_get_reference_attrs' => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 67 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 67 | return ('a/lex.rf', 'original_parent.rf', 'src_tnode.rf', 'a/aux.rf', 'compl.rf', 'coref_gram.rf', 'coref_text.rf'); | |||||||||||||||||||||||||||||||||||||||||
| 278 | 60 | }; | |||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | #----------- grammatemes ------------- | ||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | #TODO: make these real Moose attributes | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | sub gram_sempos { return $_[0]->get_attr('gram/sempos'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_sempos: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | sub gram_gender { return $_[0]->get_attr('gram/gender'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_gender: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | sub gram_number { return $_[0]->get_attr('gram/number'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_number: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | sub gram_degcmp { return $_[0]->get_attr('gram/degcmp'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_degcmp: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | sub gram_verbmod { return $_[0]->get_attr('gram/verbmod'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_verbmod: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | sub gram_deontmod { return $_[0]->get_attr('gram/deontmod'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_deontmod: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | sub gram_tense { return $_[0]->get_attr('gram/tense'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_tense: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | sub gram_aspect { return $_[0]->get_attr('gram/aspect'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_aspect: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | sub gram_resultative { return $_[0]->get_attr('gram/resultative'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_resultative: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | sub gram_dispmod { return $_[0]->get_attr('gram/dispmod'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_dispmod: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | sub gram_iterativeness { return $_[0]->get_attr('gram/iterativeness'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_iterativeness: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | sub gram_indeftype { return $_[0]->get_attr('gram/indeftype'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_indeftype: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | sub gram_person { return $_[0]->get_attr('gram/person'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_person: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | sub gram_numertype { return $_[0]->get_attr('gram/numertype'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_numertype: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | sub gram_politeness { return $_[0]->get_attr('gram/politeness'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_politeness: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | sub gram_negation { return $_[0]->get_attr('gram/negation'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_negation: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | sub gram_definiteness { return $_[0]->get_attr('gram/definiteness'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_definiteness: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | sub gram_diathesis { return $_[0]->get_attr('gram/diathesis'); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gram_diathesis: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | sub set_gram_sempos { return $_[0]->set_attr( 'gram/sempos', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_sempos: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | sub set_gram_gender { return $_[0]->set_attr( 'gram/gender', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_gender: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | sub set_gram_number { return $_[0]->set_attr( 'gram/number', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_number: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | sub set_gram_degcmp { return $_[0]->set_attr( 'gram/degcmp', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_degcmp: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | sub set_gram_verbmod { return $_[0]->set_attr( 'gram/verbmod', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_verbmod: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | sub set_gram_deontmod { return $_[0]->set_attr( 'gram/deontmod', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_deontmod: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | ▶ | sub set_gram_tense { return $_[0]->set_attr( 'gram/tense', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_tense: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | sub set_gram_aspect { return $_[0]->set_attr( 'gram/aspect', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_aspect: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | sub set_gram_resultative { return $_[0]->set_attr( 'gram/resultative', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_resultative: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | sub set_gram_dispmod { return $_[0]->set_attr( 'gram/dispmod', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_dispmod: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | sub set_gram_iterativeness { return $_[0]->set_attr( 'gram/iterativeness', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_iterativeness: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | sub set_gram_indeftype { return $_[0]->set_attr( 'gram/indeftype', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_indeftype: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | sub set_gram_person { return $_[0]->set_attr( 'gram/person', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_person: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | sub set_gram_numertype { return $_[0]->set_attr( 'gram/numertype', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_numertype: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | sub set_gram_politeness { return $_[0]->set_attr( 'gram/politeness', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_politeness: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | sub set_gram_negation { return $_[0]->set_attr( 'gram/negation', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_negation: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | sub set_gram_definiteness { return $_[0]->set_attr( 'gram/definiteness', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_definiteness: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | sub set_gram_diathesis { return $_[0]->set_attr( 'gram/diathesis', $_[1] ); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gram_diathesis: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | 60 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | __END__ | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | =encoding utf-8 | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | Treex::Core::Node::T | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | version 0.08633_1 | ||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | t-layer (tectogrammatical) node | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | =head2 Access to a-layer (analytical nodes) | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | =item $node->add_aux_anodes(@aux_anodes) | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | Add auxiliary a-nodes (to C<a/aux.rf>) | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | =item $anodes = $node->get_anodes() | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | Return a-nodes (both auxiliary and lexical, ie. C<a/aux.rf> and C<a/lex.rf>) | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | =item @aux_anodes = $node->get_aux_anodes() | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | Return auxiliary a-nodes (from C<a/aux.rf>). | ||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | =item $lex_anod = $node->get_lex_anode() | ||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | Return the lexical a-nodes (from C<a/lex.rf>). | ||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | =item $node->set_aux_anodes(@aux_anodes) | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | Set the auxiliary a-nodes (to C<a/aux.rf>). | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | =item set_lex_anode | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | Set the lexical a-node (to C<a/lex.rf>). | ||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | =item $node->remove_aux_anodes(@to_remove) | ||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | Remove the specified a-nodes from C<a/aux.rf> (if they are contained in it). | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | =item $node->get_coref_nodes() | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | Return textual and grammatical coreference nodes (from C<coref_gram.rf> and C<coref_text.rf>). | ||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | =item $node->get_coref_gram_nodes() | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | Return grammatical coreference nodes (from C<coref_gram.rf>). | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | =item $node->get_coref_text_nodes() | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | Return textual coreference nodes (from C<coref_text.rf>). | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | =item $node->add_coref_gram_nodes(@nodes) | ||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | Add grammatical coreference nodes (to C<coref_gram.rf>). | ||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | =item $node->add_coref_gram_nodes(@nodes) | ||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | Add textual coreference nodes (to C<coref_text.rf>). | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | =item $node->remove_coref_nodes() | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | Remove the specified nodes from C<coref_gram.rf> or C<coref_text.rf> (if they are contained in one or both of them). | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | =item $node->update_coref_nodes() | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | Remove all invalid coreferences from C<coref_gram.rf> and C<coref_text.rf>. | ||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | =head2 Access to source language t-layer (in MT) | ||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||
| 406 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | =item $src_tnode = $node->src_tnode() | ||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | Return the source language (in MT) t-node (from C<src_tnode.rf>). | ||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||
| 412 | =item set_src_tnode | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | Set the source language (in MT) t-node (to C<src_tnode.rf>). | ||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | =head2 Access to n-layer (named entity nodes) | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | Note there is no C<set_n_node> method. | ||||||||||||||||||||||||||||||||||||||||||
| 421 | You must set the link from n-node to a a-node. | ||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | =item $node->get_n_node() | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | This is a shortcut for C<< $self->get_lex_anode()->n_node; >> | ||||||||||||||||||||||||||||||||||||||||||
| 428 | If this t-node is a part of a named entity, | ||||||||||||||||||||||||||||||||||||||||||
| 429 | this method returns the corresponding n-node (L<Treex::Core::Node::N>). | ||||||||||||||||||||||||||||||||||||||||||
| 430 | If this node is a part of more than one named entities, | ||||||||||||||||||||||||||||||||||||||||||
| 431 | only the most nested one is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 432 | For example: "Bank of China" | ||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | $n_node_for_china = $t_node_china->get_n_node(); | ||||||||||||||||||||||||||||||||||||||||||
| 435 | print $n_node_for_china->get_attr('normalized_name'); # China | ||||||||||||||||||||||||||||||||||||||||||
| 436 | $n_node_for_bank_of_china = $n_node_for_china->get_parent(); | ||||||||||||||||||||||||||||||||||||||||||
| 437 | print $n_node_for_bank_of_china->get_attr('normalized_name'); # Bank of China | ||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | =head2 Other methods | ||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | =item is_coap_root | ||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | Is this node a root (or head) of a coordination/apposition construction? | ||||||||||||||||||||||||||||||||||||||||||
| 449 | On t-layer this is decided based on C<functor =~ /^(CONJ|CONFR|DISJ|GRAD|ADVS|CSQ|REAS|CONTRA|APPS|OPER)/>. | ||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||
| 454 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | Zdeněk Žabokrtský <zabokrtsky@ufal.mff.cuni.cz> | ||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | Martin Popel <popel@ufal.mff.cuni.cz> | ||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||
| 460 | Ondřej Dušek <odusek@ufal.mff.cuni.cz> | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | Copyright © 2011-2012 by Institute of Formal and Applied Linguistics, Charles University in Prague | ||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||