MSTperl/samples/train_tsv.pl untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod n/a totaltotal 0.0% 0 / 38 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 use utf8;
5  
6 binmode STDIN, ':encoding(utf8)';
7 binmode STDOUT, ':encoding(utf8)';
8 binmode STDERR, ':encoding(utf8)';
9  
10 use Treex::Tool::Parser::MSTperl::Config;
11 use Treex::Tool::Parser::MSTperl::Reader;
12 use Treex::Tool::Parser::MSTperl::TrainerUnlabelled;
13  
14 my ( $train_file, $model_file, $config_file, $save_tsv ) = @ARGV;
15  
16 my $config = Treex::Tool::Parser::MSTperl::Config->new(
17 config_file => $config_file
18 );
19  
20 my $reader = Treex::Tool::Parser::MSTperl::Reader->new(
21 config => $config
22 );
23  
24 my $training_data = $reader->read_tsv($train_file);
25  
26 my $trainer = Treex::Tool::Parser::MSTperl::TrainerUnlabelled->new(
27 config => $config
28 );
29  
30 $trainer->train($training_data);
31 $trainer->parser->model->store($model_file);
32 if ($save_tsv) {
33 $trainer->parser->model->store_tsv( $model_file . '.tsv' );
34 }