From 7facc1f34bcf2fdd328d0ce39d21c5cf7f1896da Mon Sep 17 00:00:00 2001 From: Eva Schlinger Date: Fri, 7 Jun 2013 13:20:15 -0400 Subject: python script to run mira --- training/utils/decode-and-evaluate.pl | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'training/utils') diff --git a/training/utils/decode-and-evaluate.pl b/training/utils/decode-and-evaluate.pl index 1a332c08..c69e77dc 100755 --- a/training/utils/decode-and-evaluate.pl +++ b/training/utils/decode-and-evaluate.pl @@ -39,6 +39,7 @@ my $weights; my $use_make = 1; my $useqsub; my $cpbin=1; +my $base_dir; # Process command-line options if (GetOptions( "jobs=i" => \$jobs, @@ -47,6 +48,7 @@ if (GetOptions( "input=s" => \$test_set, "config=s" => \$config, "weights=s" => \$weights, + "dir=s" => \$base_dir, ) == 0 || @ARGV!=0 || $help) { print_help(); exit; @@ -68,7 +70,9 @@ my @tf = localtime(time); my $tname = basename($test_set); $tname =~ s/\.(sgm|sgml|xml)$//i; my $dir = "eval.$tname." . sprintf('%d%02d%02d-%02d%02d%02d', 1900+$tf[5], $tf[4], $tf[3], $tf[2], $tf[1], $tf[0]); - +if ($base_dir) { + $dir = $base_dir.'/'.$dir +} my $time = unchecked_output("date"); check_call("mkdir -p $dir"); @@ -103,11 +107,12 @@ print STDERR "\nOUTPUT: $test_trans\n\n"; my $bleu = check_output("cat $test_trans | $SCORER $refs -m ibm_bleu"); chomp $bleu; print STDERR "BLEU: $bleu\n"; +print STDOUT "BLEU: $bleu\n"; my $ter = check_output("cat $test_trans | $SCORER $refs -m ter"); chomp $ter; print STDERR " TER: $ter\n"; open TR, ">$dir/test.scores" or die "Can't write $dir/test.scores: $!"; -print TR < - Directory for intermediate and output files. + Base directory where directory with evaluation results + will be located. Job control options: -- cgit v1.2.3