Tomáš Kraut > Treex-Core-0.08590_1 > Treex::Core::Node::EffectiveRelations

Download:
Treex-Core-0.08590_1.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.08590_1   Source   Latest Release: Treex-Core-0.08664

NAME ^

Treex::Core::Node::EffectiveRelations

VERSION ^

version 0.08590_1

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

Eg. in the sentence "Martin and Rudolph came", the tree structure is

 came(and(Martin,Rudolph))

where "and" is a head of a coordination with members "Martin" and "Rudolph". See what the methods get_children, get_echildren, get_parent and get_eparents return when called on various nodes (some pseudocode used for better readability):

 # CHILDREN AND EFFECTIVE CHILDREN

 "came"->get_children()
 # returns "and"
 
 "came"->get_echildren()
 # returns ("Martin", "Rudolph")
 
 "and"->get_children()
 # returns ("Martin", "Rudolph")
 
 "and"->get_echildren()
 # returns ("Martin", "Rudolph") and issues a warning:
 # get_echildren called on coap root ([id_of_and]). Fallback to topological one.
 
 "and"->get_echildren({or_topological => 1})
 # returns ("Martin", "Rudolph") with no warning


 # PARENTS AND EFFECTIVE PARENTS
 
 "Rudolph"->get_parent()
 # returns "and"
 
 "Rudolph"->get_eparents()
 # returns "came"
 
 "and"->get_parent()
 # returns "came"
 
 "and"->get_eparents()
 # returns "came" and issues a warning:
 # get_eparents called on coap root ([id_of_and]). Fallback to topological one.
 
 "and"->get_eparents({or_topological => 1})
 # returns "came" with no warning

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]$/;}>.

or_topological

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

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.

ignore_incorrect_tree_structure

If there is an error in the tree structure, eg. there is a coordination with no members or a non-root node with no parent, a warning is issued (The node [node_id] has no effective parent, using the topological one.). This option supresses the warning. Use thoughtfully (preferably do not use at all).

ordered, add_self, following_only, preceding_only, first_only, last_only

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

$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.

syntax highlighting: