NAME

Treex::Core::Phrase::PP

VERSION

version 2.20151210

SYNOPSIS

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

my $document = new Treex::Core::Document;
my $bundle   = $document->create_bundle();
my $zone     = $bundle->create_zone('en');
my $root     = $zone->create_atree();
my $prep     = $root->create_child();
my $noun     = $prep->create_child();
$prep->set_deprel('AuxP');
$noun->set_deprel('Adv');
my $prepphr  = new Treex::Core::Phrase::Term ('node' => $prep);
my $argphr   = new Treex::Core::Phrase::Term ('node' => $noun);
my $pphrase  = new Treex::Core::Phrase::PP ('fun' => $prepphr, 'arg' => $argphr, 'fun_is_head' => 1);

DESCRIPTION

Phrase::PP (standing for prepositional phrase) is a special case of Phrase::NTerm. The model example is a preposition (possibly compound) and its argument (typically a noun phrase), plus possible dependents of the whole, such as emphasizers or punctuation. However, it can be also used for subordinating conjunctions plus relative clauses, or for any pair of a function word and its (one) argument.

While we know the two key children (let's call them the preposition and the argument), we do not take for fixed which one of them is the head (but the head is indeed one of these two, and not any other child). Depending on the preferred annotation style, we can pick the preposition or the argument as the current head.

ATTRIBUTES

fun

A sub-Phrase of this phrase that contains the preposition (or another function word if this is not a true prepositional phrase).

arg

A sub-Phrase (typically a noun phrase) of this phrase that contains the argument of the preposition (or of the other function word if this is not a true prepositional phrase).

fun_is_head

Boolean attribute that defines the currently preferred annotation style. True means that the function word is considered the head of the phrase. False means that the argument is the head.

deprel_at_fun

Where (at what core child) is the label of the relation between this phrase and its parent? It is either at the function word or at the argument, regardless which of them 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). Depending on the current preference, it is either the function word or its argument.

nonhead_children

Returns the list of non-head children of the phrase, i.e. the dependents plus either the function word or the argument (whichever is currently not the head).

core_children

Returns the list of the children of the phrase that are not dependents, i.e. both the function word and the argument.

deprel

Returns the type of the dependency relation of the phrase to the governing phrase. A prepositional phrase has the same deprel as one of its core children. Depending on the current preference it is either the function word or the argument. This is not necessarily the same child that is the current head. For example, in the Prague annotation style, the preposition is head but its deprel is always AuxP while the real deprel of the whole phrase is stored at the argument.

set_deprel

Sets a new type of the dependency relation of the phrase to the governing phrase. For PPs the label is propagated to one of the core children. Depending on the current preference it is either the function word or the argument. This is not necessarily the same child that is the current head. The label is not propagated to the underlying dependency tree (the project_dependencies() method would have to be called to achieve that).

replace_core_child

Replaces one of the core children (function word or argument) by another phrase. This is used when we want to transform the child to a different class of phrase. The replacement must not have a parent yet.

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.