[ 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/22 10:45]
kravalova
external:tectomt:tutorial [2009/01/22 11:11]
kravalova
Line 124: Line 124:
  
 There are also other directories for other purpose blocks, for example blocks which only print out some information go to ''libs/Print''. Our tutorial blocks are in ''libs/blocks/Tutorial/''. There are also other directories for other purpose blocks, for example blocks which only print out some information go to ''libs/Print''. Our tutorial blocks are in ''libs/blocks/Tutorial/''.
 +
  
  
Line 151: Line 152:
   * Each bundle contains tree shaped sentence representations on various linguistic layers. In our example ''sample.tmt'' we have morphological tree (''SEnglishM'') in each bundle. Later on, also an analytical layer (''SEnglishA'') will appear in each bundle as we proceed with our analysis.    * Each bundle contains tree shaped sentence representations on various linguistic layers. In our example ''sample.tmt'' we have morphological tree (''SEnglishM'') in each bundle. Later on, also an analytical layer (''SEnglishA'') will appear in each bundle as we proceed with our analysis. 
   * Trees are formed by nodes and edges. Attributes can be attached only to nodes. Edge's attributes must be equivalently stored as the lower node's attributes. Tree's attributes must be stored as attributes of the root node.   * Trees are formed by nodes and edges. Attributes can be attached only to nodes. Edge's attributes must be equivalently stored as the lower node's attributes. Tree's attributes must be stored as attributes of the root node.
 +
 +
  
  
Line 214: Line 217:
  
 we can examine our ''sample.tmt'' again. Really, an analytical layer ''SEnglishA'' describing a dependency tree with analytical functions (''<afun>'') has been added to each bundle. we can examine our ''sample.tmt'' again. Really, an analytical layer ''SEnglishA'' describing a dependency tree with analytical functions (''<afun>'') has been added to each bundle.
- 
-You can view the trees in ''sample.tmt'' with TrEd by typing 
- 
-<code bash> 
-tmttred sample.tmt 
-</code> 
- 
-Try to click on some nodes to see their parameters (tag, lemma, form, analytical function etc). 
  
 Blocks can also be parametrized. For syntax parser, we might want to use a smaller but faster model. To achieve this, replace the line Blocks can also be parametrized. For syntax parser, we might want to use a smaller but faster model. To achieve this, replace the line
Line 234: Line 229:
 SEnglishM_to_SEnglishA::McD_parser_local MT_PARAM_MCD_EN_MODEL=conll_mcd_order2_0.1.model \ SEnglishM_to_SEnglishA::McD_parser_local MT_PARAM_MCD_EN_MODEL=conll_mcd_order2_0.1.model \
 </code> </code>
 +
 +You can view the trees in ''sample.tmt'' with TrEd by typing
 +
 +<code bash>
 +tmttred sample.tmt
 +</code>
 +
 +Try to click on some nodes to see their parameters (tag, lemma, form, analytical function etc).
 +
 +//Note//: For more information about tree editor TrEd, see [[http://ufal.mff.cuni.cz/~pajas/tred/ar01-toc.html|TrEd User's Manual]].
  
  
Line 291: Line 296:
  
 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)''
 +
 +Some interesting attributes on morphologic layer are ''form'', ''lemma'' and ''tag''. Some interesting attributes on analytical layer are ''afun'' (analytical function) and ''ord'' (surface word order). To reach ''form'', ''lemma'' or ''tag'' from analytical layer, that is, when calling this attribute on an ''a-node'', you use ''$a_node->get_attr('m/form')'' and the same way for ''lemma'' and ''tag''. The easiest way to see the node attributes is to click on the node in TrEd:
 +
 +<code bash>
 +tmttred sample.tmt
 +</code>
  
 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 331: Line 343:
 ==== 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.
 +
 +
 +
  
  
Line 379: Line 394:
   * ''my @eff_children = $node<nowiki>-></nowiki>get_eff_children()''   * ''my @eff_children = $node<nowiki>-></nowiki>get_eff_children()''
  
-//Note//: ''get_children()'' returns topological node children in a tree, while ''get_eff_children()'' returns node children in a linguistic sense. Mostly, these do not differ.+//Note//: ''get_children()'' returns topological node children in a tree, while ''get_eff_children()'' returns node children in a linguistic sense. Mostly, these do not differ. If interested, see Figure 1 in [[http://ufal.mff.cuni.cz/pdt2.0/doc/tools/tred/bn-tutorial.html|btred tutorial]]. 
 + 
 +//Hint//: Finite clauses in English usually require grammatical subject to be present.
  
 ==== Advanced version ==== ==== Advanced version ====
Line 469: Line 486:
  
 **Advanced version**: What happens in case of multiword prepositions? For example, ''because of'', ''instead of''. Can you handle it? **Advanced version**: What happens in case of multiword prepositions? For example, ''because of'', ''instead of''. Can you handle it?
 +
 +
  
  
  
 ===== Further information ===== ===== Further information =====
-  * [[http://ufallab2.ms.mff.cuni.cz/~bojar/cruise_control_tmt/last_doc/generated/guide/guidelines.html|TectoMT Developer's Guide]] - obsolete+  * [[http://ufallab2.ms.mff.cuni.cz/~bojar/cruise_control_tmt/last_doc/generated/guide/guidelines.html|TectoMT Developer's Guide]]
   * Questions? Ask ''kravalova'' at ''ufal.mff.cuni.cz''   * Questions? Ask ''kravalova'' at ''ufal.mff.cuni.cz''
   * Solutions to this tutorial tasks are in ''libs/blocks/Tutorial/*solution*.pm''.   * Solutions to this tutorial tasks are in ''libs/blocks/Tutorial/*solution*.pm''.
-  * [[http://ufal.mff.cuni.cz/~pajas/tred/|TrEd]] - tree editor +  * [[http://ufal.mff.cuni.cz/~pajas/tred/|TrEd]], [[http://ufal.mff.cuni.cz/~pajas/tred/ar01-toc.html|TrEd User's Manual]] - tree editor
- +
  
  

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