Both sides previous revision
Previous revision
Next revision
|
Previous revision
Next revision
Both sides next revision
|
external:tectomt:tutorial [2009/01/21 12:09] kravalova |
external:tectomt:tutorial [2009/01/21 13:12] kravalova |
tmttred sample.tmt | tmttred sample.tmt |
</code> | </code> |
| |
| |
| |
| |
* ''my @bundles = $document<nowiki>-></nowiki>get_bundles()'' - an array of bundles contained in the document | * ''my @bundles = $document<nowiki>-></nowiki>get_bundles()'' - an array of bundles contained in the document |
* ''my $root_node = $bundle<nowiki>-></nowiki>get_tree($layer_name);'' - the root node of the tree of the given type in the given bundle | * ''my $root_node = $bundle<nowiki>-></nowiki>get_tree($layer_name)'' - the root node of the tree of the given type in the given bundle |
* ''my @children = $node<nowiki>-></nowiki>get_children();'' - array of the node's children | * ''my @children = $node<nowiki>-></nowiki>get_children()'' - array of the node's children |
* ''my @descendants = $node<nowiki>-></nowiki>get_descendants();'' - array of the node's children and their children and children of their children ... | * ''my @descendants = $node<nowiki>-></nowiki>get_descendants()'' - array of the node's children and their children and children of their children ... |
* ''my $parent = $node<nowiki>-></nowiki>get_parent();'' - parent node of the given node, or undef for root | * ''my $parent = $node<nowiki>-></nowiki>get_parent()'' - parent node of the given node, or undef for root |
* ''my $root_node = $node<nowiki>-></nowiki>get_root();'' - the root node of the tree into which the node belongs | * ''my $root_node = $node<nowiki>-></nowiki>get_root()'' - the root node of the tree into which the node belongs |
| |
Attributes of documents, bundles or nodes can be accessed by attribute getters and setters, for example: | Attributes of documents, bundles or nodes can be accessed by attribute getters and setters, for example: |
* ''$node<nowiki>-></nowiki>get_attr($attr_name);'' | * ''$node<nowiki>-></nowiki>get_attr($attr_name)'' |
* ''$node<nowiki>-></nowiki>set_attr($attr_name, $attr_value);'' | * ''$node<nowiki>-></nowiki>set_attr($attr_name, $attr_value)'' |
| |
Our tutorial block ''Print_node_info.pm'' is ready to use. You only need to add this block to our scenario, e.g. as a new Makefile target: | Our tutorial block ''Print_node_info.pm'' is ready to use. You only need to add this block to our scenario, e.g. as a new Makefile target: |
</code> | </code> |
| |
//Advanced version//: Try to change the block so that it prints out the information only for verbs. (You need to look at an attribute ''tag'' at the ''m'' level). The tagset used is Penn Treebank Tagset. | Try to change the block so that it prints out the information only for verbs. (You need to look at an attribute ''tag'' at the ''m'' level). The tagset used is Penn Treebank Tagset. |
| |
| |
==== Task ==== | ==== Task ==== |
A block which, given an analytical tree (''SEnglishA''), fills each ''a-node'' with boolean attribute ''is_clause_head'' which is set to ''1'' if the ''a-node'' corresponds to a finite verb, and to ''0'' otherwise. | A block which, given an analytical tree (''SEnglishA''), fills each ''a-node'' with boolean attribute ''is_clause_head'' which is set to ''1'' if the ''a-node'' corresponds to a finite verb, and to ''0'' otherwise. |
| |
| |
| |