Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2013-05-17 19:13:24 +0400
committerHieu Hoang <hieuhoang@gmail.com>2013-05-17 19:13:24 +0400
commit11632e298e16c6a374f3424f626c06f367ba6fa8 (patch)
tree84aa82555cba9bb015a64c70d540bd1f5cb9d141 /scripts/ems
parent42c292765abe2c4127c95aa709a45ef5e32ba8f5 (diff)
add substitute-filtered-tables-and-weights.perl for applying filter for evaluation step
Diffstat (limited to 'scripts/ems')
-rw-r--r--scripts/ems/experiment.meta4
-rwxr-xr-x[-rw-r--r--]scripts/ems/support/substitute-filtered-tables-and-weights.perl25
2 files changed, 27 insertions, 2 deletions
diff --git a/scripts/ems/experiment.meta b/scripts/ems/experiment.meta
index d10bf2dbe..0731e2480 100644
--- a/scripts/ems/experiment.meta
+++ b/scripts/ems/experiment.meta
@@ -950,12 +950,12 @@ filter
ignore-if: use-hiero
error: already exists. Please delete
apply-filter
- in: TUNING:config-with-reused-weights filtered-dir
+ in: filtered-dir TRAINING:config TUNING:config-with-reused-weights
out: filtered-config
default-name: evaluation/filtered.ini
pass-if: TRAINING:binarize-all
ignore-if: use-hiero
- template: $moses-script-dir/ems/support/substitute-weights.perl IN1/moses.ini < IN > OUT
+ template: $moses-script-dir/ems/support/substitute-filtered-tables-and-weights.perl IN/moses.ini IN1 IN2 OUT
decode
in: filtered-config input
out: system-output
diff --git a/scripts/ems/support/substitute-filtered-tables-and-weights.perl b/scripts/ems/support/substitute-filtered-tables-and-weights.perl
index ff8afaca6..a914248cf 100644..100755
--- a/scripts/ems/support/substitute-filtered-tables-and-weights.perl
+++ b/scripts/ems/support/substitute-filtered-tables-and-weights.perl
@@ -4,4 +4,29 @@ use strict;
use Getopt::Long "GetOptions";
use FindBin qw($RealBin);
+if (scalar @ARGV != 4) {
+ die("ERROR: wrong args");
+}
+
+my $filteredPath = $ARGV[0];
+my $origPath = $ARGV[1];
+my $tunedPath = $ARGV[2];
+my $outPath = $ARGV[3];
+
+my $tempPath = "/tmp/moses.ini.$$";
+
+print STDERR "filteredPath=$filteredPath \n";
+print STDERR "origPath=$origPath \n";
+print STDERR "tunedPath=$tunedPath \n";
+print STDERR "outPath=$outPath \n";
+print STDERR "tempPath=$tempPath \n";
+
+my $cmd;
+$cmd = "$RealBin/substitute-filtered-tables.perl $filteredPath < $origPath > $tempPath ";
+print STDERR "cmd=$cmd \n";
+system($cmd);
+
+$cmd = "$RealBin/substitute-weights.perl $tempPath < $tunedPath > $outPath ";
+print STDERR "cmd=$cmd \n";
+system($cmd);