Treex::Block::Util::Eval - Special block for evaluating code given by parameters.
version 2.20151210
# on the command line treex Util::Eval document='print $document->full_filename' -- *.treex treex Util::Eval language=en anode='print $anode->lemma."\n"' -- *.treex # The same two commands even shorter treex Util::Eval doc='print $.full_filename' -- *.treex treex -Len Util::Eval anode='say $.lemma' -- *.treex # other examples of parameters language=en,cs zone='say $.language, "\t", $.sentence' language=all ttree='say $.language, "\t", scalar $.get_children()'
Evaluate an arbitrary Perl code for each document/bundle/zone/tree/node (according to which parameter is given). The corresponding object is accessible through a variable of the same name or $this.
$this
More shortcuts: You can use doc= instead of document=. You can use "$." instead of "$this->" where $this is the current doc/bundle/zone/tree/node.
Martin Popel <popel@ufal.mff.cuni.cz>
Copyright © 2011-2012 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.