Treex::Core::Node::EffectiveRelations
version 0.06903_1
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.:
dive
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.
get_eparents
get_echildren
called on coap root ($id). Fallback to topological one.
or_topological
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.
$node
OPTIONS:
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]$/;}>.
AuxCP
sub {my $self=shift;return $self-
You can specify the same options as in Treex::Core::Node::get_children().
Returns a list of effective parents of the $node.
OPTIONS
see get_echildren
If the notion of effective parent is not defined (if $node is a head of coordination), return the topological parent without warnings.
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.
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
Martin Popel <popel@ufal.mff.cuni.cz>
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.
To install Treex::Core, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Treex::Core
CPAN shell
perl -MCPAN -e shell install Treex::Core
For more information on module installation, please visit the detailed CPAN module installation guide.