regression

git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@3206 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
hieuhoang1972 2010-04-26 16:21:19 +00:00
parent d5a0eb2423
commit 87c3becbf6

View File

@ -8,20 +8,20 @@ use Getopt::Long;
############################################################
my @tests = qw (
basic-surface-only
ptable-filtering
multi-factor
multi-factor-drop
confusionNet-surface-only
confusionNet-multi-factor
basic-surface-binptable
multi-factor-binptable
nbest-multi-factor
lattice-surface
lattice-distortion
lexicalized-reordering
lexicalized-reordering-cn
consensus-decoding-surface
phrase.basic-surface-only
phrase.ptable-filtering
phrase.multi-factor
phrase.multi-factor-drop
phrase.confusionNet-surface-only
phrase.confusionNet-multi-factor
phrase.basic-surface-binptable
phrase.multi-factor-binptable
phrase.nbest-multi-factor
phrase.lattice-surface
phrase.lattice-distortion
phrase.lexicalized-reordering
phrase.lexicalized-reordering-cn
phrase.consensus-decoding-surface
);
# xml-markup
@ -30,13 +30,15 @@ use MosesRegressionTesting;
use File::Temp qw ( tempfile );
use POSIX qw ( strftime );
my $decoder;
my $decoderPhrase;
my $decoderChart;
my $test_dir;
my $BIN_TEST = $script_dir;
my $data_dir;
GetOptions("decoder=s" => \$decoder,
"data-dir=s" => \$data_dir,
GetOptions( "decoder-phrase=s" => \$decoderPhrase,
"decoder-chart=s" => \$decoderChart,
"data-dir=s" => \$data_dir,
) or exit 1;
$data_dir = MosesRegressionTesting::find_data_directory($BIN_TEST, $data_dir);
@ -47,11 +49,9 @@ $test_run .= " --test-dir=$test_dir" if $test_dir;
print "Data directory: $data_dir\n";
die "Please specify a decoder to test with --decoder\n" unless $decoder;
die "Please specify the phrase-base & chart decoder to test with --decoder-phrase=[path] --decoder-chart=[path] \n" unless ($decoderPhrase and $decoderChart);
die "Cannot locate executable called $decoder\n" unless (-x $decoder);
$test_run .= " --decoder=$decoder";
die "Cannot locate executable called $decoderPhrase\n" unless (-x $decoderPhrase);
print "Running tests: @tests\n\n";
@ -61,8 +61,25 @@ print $lb;
my $fail = 0;
my @failed;
foreach my $test (@tests) {
my $cmd = "$test_run --test=$test";
foreach my $test (@tests)
{
my $cmd;
my $model_type = substr($test, $[, 6);
if ($model_type eq 'phrase')
{
$cmd .= "$test_run --decoder=$decoderPhrase";
}
elsif ($model_type eq 'chart.')
{
$cmd .= "$test_run --decoder=$decoderChart";
}
else
{
print "FAIL";
}
$cmd .= " --test=$test";
my ($res, $output, $results_path) = do_test($cmd);
format STDOUT =
@<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<