NAME

Treex::Core::Node::EffectiveRelations

VERSION

version 0.06441

DESCRIPTION

Moose role for nodes with a notion of so called effective parents and effective children. This notion is used both on the a-layer (Treex::Core::Node::A) and on the t-layer (Treex::Core::Node::T).

TODO: explain it, some examples, reference to PDT manual

Note that to skip prepositions and subordinating conjunctions on the a-layer, you must use option dive, e.g.:

my $eff_children = $node->get_echildren({dive=>'AuxCP'});

Methods get_eparents and get_echildren produce a warning "called on coap root ($id). Fallback to topological one." when called on a root of coordination or apposition, because effective children/parents are not properly defined in this case. This warning can be supressed by option or_topological.

METHODS

my @effective_children = $node->get_echildren($arg_ref?)

Returns a list of effective children of the $node. It means that a) instead of coordination/aposition heads, their members are returned b) shared modifiers of a coord/apos (technically hanged on the head of coord/apos) count as effective children of the members.

OPTIONS:

dive=>$sub_ref

Using dive, you can define nodes to be skipped (or dived). dive is a reference to a subroutine that decides whether the given node should be skipped or not. Typically this is used for prepositions and subord. conjunctions on a-layer. You can set dive to the string AuxCP which is a shortcut for sub {my $self=shift;return $self-afun =~ /^Aux[CP]$/;}>.

ordered, add_self, following_only, preceding_only, first_only, last_only

You can specify the same options as in Treex::Core::Node::get_children().

my @effective_parents = $node->get_eparents($arg_ref?)

Returns a list of effective parents of the $node.

OPTIONS

dive

see get_echildren

or_topological

If the notion of effective parent is not defined (if $node is a head of coordination), return the topological parent without warnings.

$node->get_coap_members($arg_ref?)

If the node is a coordination/apposition head (see Node::A::is_coap_root() and Node::T::is_coap_root()) a list of all coordinated members is returned. Otherwise, the node itself is returned.

OPTIONS

direct_only

In case of nested coordinations return only "first-level" members. The default is to return transitive members. For example "(A and B) or C":

$or->get_coap_members();                 # returns A,B,C
$or->get_coap_members({direct_only=>1}); # returns and,C
dive

see get_echildren

AUTHOR

Martin Popel <popel@ufal.mff.cuni.cz>

COPYRIGHT AND LICENSE

Copyright © 2011 by Institute of Formal and Applied Linguistics, Charles University in Prague

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.