Treex::Core::Phrase::Term
version 2.20210102
use Treex::Core::Document; use Treex::Core::Phrase::Term; my $document = new Treex::Core::Document; my $bundle = $document->create_bundle(); my $zone = $bundle->create_zone('en'); my $root = $zone->create_atree(); my $phrase = new Treex::Core::Phrase::Term ('node' => $root);
Term is a terminal Phrase. It contains (refers to) one Node and it can be part of nonterminal phrases (NTerm). See Treex::Core::Phrase for more details.
Term
Phrase
Node
NTerm
Refers to the Node wrapped in this terminal phrase.
Any label describing the type of the dependency relation between this phrase (its node) and the governing phrase (node of the first ancestor phrase where this one does not act as head). This label is typically taken from the underlying node when the phrase is built, but it may be translated or modified and it is not kept synchronized with the underlying dependency tree during transformations of the phrase structure. Nevertheless it is assumed that once the transformations are done, the final dependency relations will be projected back to the dependency tree.
The deprel attribute can also be supplied separately when creating the Phrase::Term. If it is not supplied, it will be copied from the Node to which the node attribute refers.
deprel
Phrase::Term
node
Returns the list of all nodes covered by the phrase, which in the case of a terminal phrase means just the node wrapped in it.
Returns a one-element list containing this phrase. This method is used to collect all terminal descendants of a phrase. It is similar to nodes() but instead of Node objects, it returns phrases that wrap the nodes.
nodes()
Returns the list of dependents of the phrase. Terminal phrases return an empty list by definition.
Returns the list of children of the phrase. Terminal phrases return an empty list by definition.
Returns the lowest and the highest ord values of the nodes covered by this phrase. For a terminal phrase, the result is just the ord repeated twice.
ord
Projects dependencies between the head and the dependents back to the underlying dependency structure. There is not much to do in the terminal phrase as it does not have any dependents. However, we will attach all nodes to the root, to prevent temporary cycles during the tree construction.
Returns a textual representation of the phrase and all subphrases. Useful for debugging.
Daniel Zeman <zeman@ufal.mff.cuni.cz>
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.
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.