use Treex::Core::Document; use Treex::Core::Phrase::Term; use Treex::Core::Phrase::NTerm; my $document = new Treex::Core::Document; my $bundle = $document->create_bundle(); my $zone = $bundle->create_zone('en'); my $root = $zone->create_atree(); my $node = $root->create_child(); my $tphrase = new Treex::Core::Phrase::Term ('node' => $node); my $ntphrase = new Treex::Core::Phrase::NTerm ('head' => $tphrase);
NTerm is a nonterminal
Phrase. It contains (refers to) one or more child
Phrases. See Treex::Core::Phrase for more details.
Phraseof this phrase that is at the moment considered the head phrase (in the sense of dependency syntax). Head is a special case of child (sub-) phrase. The (one) head must always exist; other children are optional.
- set_head ($child_phrase);
Sets a new head child for this phrase. The new head must be already a child of this phrase. The old head will become an ordinary non-head child.
- replace_core_child ($old_head, $new_head);
Replaces the head by another phrase. This is used when we want to transform the head to a different class of phrases. The replacement must not have a parent yet.
Returns a textual representation of the phrase and all subphrases. Useful for debugging.
Daniel Zeman <firstname.lastname@example.org>
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.