The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Treex::Core::Phrase::PP

VERSION

version 2.20210102

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.

core_deprel

The deprel that does not describe the relation of the PP to its parent. There are always two important relations in PPs, one of them is reachable via deprel() and the other via core_deprel(). In Prague treebanks, the PP is headed by preposition but the parent relation (indicated by deprel) is labeled at the argument. The label of the preposition (indicated by core_deprel) is always AuxP. In Universal Dependencies, the PP is headed by the argument which also bears the deprel of the parent relation. The preposition is attached to the argument and its label (indicated by core_deprel) is case or mark. Other treebanks may have the preposition as both the head and the parent-deprel bearer, while the argument would be attached as PrepArg (indicated by core_deprel).

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

project_deprel

Returns the deprel that should be used when the phrase tree is projected back to a dependency tree (see the method project_dependencies()). In most cases this is identical to what deprel() returns. However, for instance prepositional phrases in Prague treebanks are attached using AuxP. Their relation to the parent (returned by deprel()) is projected as the label of the dependency between the preposition and its argument.

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.