| 1 | package Treex::Block::Util::SetGlobal; | ||||||||||
| 2 | 3 | $Treex::Block::Util::SetGlobal::VERSION = '2.20151210'; | |||||||||
| 3 | 3 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use Treex::Core::Common; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | extends 'Treex::Core::Block'; | |||||||||
| 6 | |||||||||||
| 7 | sub BUILD { | ||||||||||
| 8 | 8 | ▶ | my ( $self, $arg_ref ) = @_; | ||||||||
|
Subroutine
BUILD: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 9 | 8 | ▶ | my $scenario = $arg_ref->{scenario} or log_fatal "no scenario given"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 10 | 8 | ▶ | while ( my ( $name, $value ) = each %{$arg_ref} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | 17 | ▶ | if ( $name ne 'scenario' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | 9 | $scenario->set_global_param( $name, $value ); | |||||||||
| 13 | } | ||||||||||
| 14 | } | ||||||||||
| 15 | 8 | return; | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | sub process_document { | ||||||||||
| 19 | 1 | ▶ | return 1; | ||||||||
|
Subroutine
process_document: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 3 | 1; | |||||||||
| 23 | |||||||||||
| 24 | __END__ | ||||||||||
| 25 | |||||||||||
| 26 | =pod | ||||||||||
| 27 | |||||||||||
| 28 | =encoding utf-8 | ||||||||||
| 29 | |||||||||||
| 30 | =head1 NAME | ||||||||||
| 31 | |||||||||||
| 32 | Treex::Block::Util::SetGlobal | ||||||||||
| 33 | |||||||||||
| 34 | =head1 VERSION | ||||||||||
| 35 | |||||||||||
| 36 | version 2.20151210 | ||||||||||
| 37 | |||||||||||
| 38 | =head1 DESCRIPTION | ||||||||||
| 39 | |||||||||||
| 40 | Special block for setting global parameters in scenarios. E.g., instead of: | ||||||||||
| 41 | |||||||||||
| 42 | Read::PlainText language=en from=file.txt | ||||||||||
| 43 | W2A::Tokenize language=en | ||||||||||
| 44 | W2A::Tag language=en | ||||||||||
| 45 | ... | ||||||||||
| 46 | |||||||||||
| 47 | you can write: | ||||||||||
| 48 | |||||||||||
| 49 | Util::SetGlobal language=en | ||||||||||
| 50 | Read::PlainText from=file.txt | ||||||||||
| 51 | W2A::Tokenize | ||||||||||
| 52 | W2A::Tag | ||||||||||
| 53 | ... | ||||||||||
| 54 | |||||||||||
| 55 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 56 | |||||||||||
| 57 | Copyright © 2011 by Institute of Formal and Applied Linguistics, Charles University in Prague | ||||||||||
| 58 | |||||||||||
| 59 | This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||||||||||