diff options
Diffstat (limited to 'regression-testing')
-rwxr-xr-x | regression-testing/run-test-extract-rules.perl | 89 | ||||
-rwxr-xr-x | regression-testing/run-test-suite.perl | 7 |
2 files changed, 6 insertions, 90 deletions
diff --git a/regression-testing/run-test-extract-rules.perl b/regression-testing/run-test-extract-rules.perl deleted file mode 100755 index c53e6247d..000000000 --- a/regression-testing/run-test-extract-rules.perl +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -BEGIN { -use Cwd qw/ abs_path /; -use File::Basename; -my $script_dir = dirname(abs_path($0)); -print STDERR "script_dir=$script_dir\n"; -push @INC, $script_dir; -} - -use FindBin qw($Bin); -use MosesRegressionTesting; -use Getopt::Long; -use File::Temp qw ( tempfile ); -use POSIX qw ( strftime ); - -my $extractorExe; -my $test_name; -my $data_dir; -my $test_dir; -my $results_dir; - -GetOptions("extractor=s" => \$extractorExe, - "test=s" => \$test_name, - "data-dir=s"=> \$data_dir, - "test-dir=s"=> \$test_dir, - "results-dir=s"=> \$results_dir, - ) or exit 1; - -# output dir -unless (defined $results_dir) -{ - my $ts = get_timestamp($extractorExe); - $results_dir = "$data_dir/results/$test_name/$ts"; -} - -`mkdir -p $results_dir`; - -my $outPath = "$results_dir"; - -my $extractorArgs = `cat $test_dir/$test_name/args.txt`; -$_ = $extractorArgs; -s/(\$\w+)/$1/eeg; -$extractorArgs = $_; - -my $cmdMain = "$extractorExe $extractorArgs \n"; -`$cmdMain`; - -my $truthPath = "$test_dir/$test_name/truth/"; - - -if (-e $outPath) -{ - my $cmd = "diff --exclude=.DS_Store $outPath/ $truthPath/ | wc -l"; - my $numDiff = `$cmd`; - - if ($numDiff == 0) - { - # print STDERR "FAILURE. Ran $cmdMain\n"; - print STDERR "SUCCESS\n"; - exit 0; - } - else - { - print STDERR "FAILURE. Ran $cmdMain\n"; - exit 1; - } -} -else -{ - print STDERR "FAILURE. Output does not exists. Ran $cmdMain\n"; - exit 1; -} - -################################### -sub get_timestamp { - my ($file) = @_; - my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, - $atime,$mtime,$ctime,$blksize,$blocks) - = stat($file); - my $timestamp = strftime("%Y%m%d-%H%M%S", gmtime $mtime); - my $timestamp2 = strftime("%Y%m%d-%H%M%S", gmtime); - my $username = `whoami`; chomp $username; - return "moses.v$timestamp-$username-at-$timestamp2"; -} - - diff --git a/regression-testing/run-test-suite.perl b/regression-testing/run-test-suite.perl index 3e5348882..c9c03080b 100755 --- a/regression-testing/run-test-suite.perl +++ b/regression-testing/run-test-suite.perl @@ -10,6 +10,7 @@ use Getopt::Long; ############################################################ my @tests = qw ( + extract-rules.hierarchical extract.phrase-based score.phrase-based score.phrase-based-inv @@ -63,7 +64,7 @@ my $decoderPhrase = "$Bin/../moses-cmd/src/moses"; my $decoderChart = "$Bin/../moses-chart-cmd/src/moses_chart"; my $scoreExe = "$Bin/../scripts/training/phrase-extract/score"; my $extractorExe = "$Bin/../scripts/training/phrase-extract/extract"; -my $extractorSyntaxExe = "$Bin/../scripts/training/phrase-extract/extract-rules"; +my $extractorRulesExe = "$Bin/../scripts/training/phrase-extract/extract-rules"; my $kenlmBinarizer = "$Bin/../kenlm/build_binary"; my $test_dir; my $BIN_TEST = $script_dir; @@ -117,6 +118,10 @@ foreach my $test (@tests) { $cmd .= "$BIN_TEST/run-test-extract.perl $test_run --extractor=$extractorExe"; } + elsif ($model_type eq 'extract-rules') + { + $cmd .= "$BIN_TEST/run-test-extract.perl $test_run --extractor=$extractorRulesExe"; + } elsif ($model_type eq "mert") { $cmd .= "$BIN_TEST/run-test-mert.perl $test_run"; |