NAME

Treex::Core::Phrase::Coordination

VERSION

version 2.20151210

SYNOPSIS

use Treex::Core::Document;
use Treex::Core::Phrase::Term;
use Treex::Core::Phrase::Coordination;

my $document = new Treex::Core::Document;
my $bundle   = $document->create_bundle();
my $zone     = $bundle->create_zone('en');
my $root     = $zone->create_atree();
my $coord    = $root->create_child();
my $conj1    = $coord->create_child();
my $conj2    = $coord->create_child();
$coord->set_deprel('Coord');
$conj1->set_deprel('Pred_M');
$conj2->set_deprel('Pred_M');
my $coordphr = new Treex::Core::Phrase::Term ('node' => $coord);
my $conj1phr = new Treex::Core::Phrase::Term ('node' => $conj1);
my $conj2phr = new Treex::Core::Phrase::Term ('node' => $conj2);
my $cphrase  = new Treex::Core::Phrase::Coordination ('conjuncts' => [$conj1phr, $conj2phr], 'coordinators' => [$coordphr], 'head_rule' => 'last_coordinator');

DESCRIPTION

Treex::Core::Phrase::Coordination is a special case of Treex::Core::Phrase::NTerm. It does not have a fixed head but it has a head rule that specifies how the head child should be determined if needed. On the other hand, there are several sets of core children that are not ordinary dependents. They are conjuncts (i.e. the phrases that are coordinated), coordinators (coordinating conjunctions and similar words) and conjunct-delimiting punctuation.

ATTRIBUTES

_conjuncts_ref

Reference to array of sub-Phrases (children) that are coordinated in this phrase. The conjuncts are counted among the core children of Coordination. Every Coordination must always have at least one conjunct.

_coordinators_ref

Reference to array of sub-Phrases (children) that act as coordinating conjunctions and that are words, not punctuation. The coordinators are counted among the core children of Coordination. However, their presence is not required.

_punctuation_ref

Reference to array of sub-Phrases (children) that contain punctuation between conjuncts. The punctuation phrases are counted among the core children of Coordination. However, their presence is not required.

head_rule

A string that says how the head of the coordination should be selected. first_conjunct means that the first conjunct is the head (there is always at least one conjunct). last_coordinator means that the last coordinating conjunction, if any, is the head; in asyndetic coordination (no conjunctions) the last punctuation symbol is the head; if there are neither conjunctions nor punctuation, the first conjunct is the head.

METHODS

A sub-Phrase of this phrase that is at the moment considered the head phrase (in the sense of dependency syntax). It depends on the current head_rule.

conjuncts

Returns the list of conjuncts. The only difference from the getter _conjuncts_ref() is that the getter returns a reference to the array of conjuncts, while this method returns a list of conjuncts. Hence this method is more similar to the other methods that return lists of children.

coordinators

Returns the list of coordinating conjunctions (but not punctuation). The only difference from the getter _coordinators_ref() is that the getter returns a reference to array, while this method returns a list. Hence this method is more similar to the other methods that return lists of children.

punctuation

Returns the list of punctuation symbols between conjuncts. The only difference from the getter _punctuation_ref() is that the getter returns a reference to array, while this method returns a list. Hence this method is more similar to the other methods that return lists of children.

nonhead_children

Returns the list of non-head children of the phrase, i.e. the dependents plus all core children except the one that currently serves as the head.

core_children

Returns the list of the children of the phrase that are not dependents, i.e. all conjuncts, coordinators and punctuation.

project_dependencies

Projects dependencies between the head and the dependents back to the underlying dependency structure. For coordinations the behavior depends on the currently selected head rule: certain deprels may have to be adjusted.

as_string

Returns a textual representation of the phrase and all subphrases. Useful for debugging.

AUTHORS

Daniel Zeman <zeman@ufal.mff.cuni.cz>

COPYRIGHT AND LICENSE

Copyright © 2013, 2015 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.