[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
external:tectomt:tutorial [2009/01/21 11:06]
kravalova
external:tectomt:tutorial [2009/01/21 11:09]
kravalova
Line 17: Line 17:
   * Your shell is bash   * Your shell is bash
   * You have basic experience bash and you can read Perl   * You have basic experience bash and you can read Perl
 +
  
  
Line 35: Line 36:
 </code> </code>
  
-  * In ''tectomt/install/'' run ./install.sh:+  * In ''tectomt/install/'' run ''./install.sh'':
  
 <code bash> <code bash>
Line 240: Line 241:
 This block illustrates some of the most common methods for accessing objects: This block illustrates some of the most common methods for accessing objects:
  
-  * ''my @bundles = $document->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->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->get_children();'' - array of the node's children +  * ''my @children = $node<nowiki>-></nowiki>get_children();'' - array of the node's children 
-  * ''my @descendants = $node->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->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->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->get_attr($attr_name);'' +  * ''$node<nowiki>-></nowiki>get_attr($attr_name);'' 
-  * ''$node->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:
Line 360: Line 361:
 **Instructions**:  **Instructions**: 
  
-  * To find an object to a verb, look for objects among effective children of a verb (''$child->get_attr('afun') eq 'Obj' ''). That implies working on analytical layer. +  * To find an object to a verb, look for objects among effective children of a verb (''$child<nowiki>-></nowiki>get_attr('afun') eq 'Obj' ''). That implies working on analytical layer. 
-  * For debugging, a method returning surface word order of a node is useful: ''$node->get_attr('ord')''. It can be used to print out nodes sorted by attribute ''ord''+  * For debugging, a method returning surface word order of a node is useful: ''$node<nowiki>-></nowiki>get_attr('ord')''. It can be used to print out nodes sorted by attribute ''ord''
-  * Once you have node ''$object'' and node ''$verb'', use method ''$object->shift_before_node($verb)''. This method takes the whole subtree under node ''$object'' and counts the attributes ''ord'' (surface word order) so that all nodes in subtree under ''$object'' have smaller ''ord'' than ''$verb''. That is, the method rearranges the surface word order from VO to OV.+  * Once you have node ''$object'' and node ''$verb'', use method ''$object<nowiki>-></nowiki>shift_before_node($verb)''. This method takes the whole subtree under node ''$object'' and counts the attributes ''ord'' (surface word order) so that all nodes in subtree under ''$object'' have smaller ''ord'' than ''$verb''. That is, the method rearranges the surface word order from VO to OV.
  
  
Line 401: Line 402:
  
 You are going to need these new methods: You are going to need these new methods:
-  * ''my @children = $node->get_children'' +  * ''my @children = $node<nowiki>-></nowiki>get_children'' 
-  * ''my $parent = $node->get_parent'' +  * ''my $parent = $node<nowiki>-></nowiki>get_parent'' 
-  * ''$node->set_parent($parent)''+  * ''$node<nowiki>-></nowiki>set_parent($parent)''
  
 //Hint//:  //Hint//: 
-  * On analytical layer, you can use this test to recognize prepositions: ''$node->get_attr('afun') eq 'AuxP' '' +  * On analytical layer, you can use this test to recognize prepositions: ''$node<nowiki>-></nowiki>get_attr('afun') eq 'AuxP' '' 
   * You can use block template in ''libs/blocks/BlockTemplate.pm''. To see the results, you can again use TrEd (''tmttred sample.tmt'')   * You can use block template in ''libs/blocks/BlockTemplate.pm''. To see the results, you can again use TrEd (''tmttred sample.tmt'')
  

[ Back to the navigation ] [ Back to the content ]