summaryrefslogtreecommitdiff
path: root/rampion/rampion.pl
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-05-29 21:39:22 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2012-05-29 21:39:22 -0400
commit317d650f6cb1e24ac6f3be6f7bf9d4246a59e0e5 (patch)
tree02a8217d6910453049d5a2b96d3214baf19737c5 /rampion/rampion.pl
parent6b7f7ae44228221b3de158035d190940ff677de1 (diff)
add support to rampion for accumulating k-best lists
Diffstat (limited to 'rampion/rampion.pl')
-rwxr-xr-xrampion/rampion.pl16
1 files changed, 13 insertions, 3 deletions
diff --git a/rampion/rampion.pl b/rampion/rampion.pl
index 9884f453..55f7b3f1 100755
--- a/rampion/rampion.pl
+++ b/rampion/rampion.pl
@@ -65,12 +65,14 @@ my $cpbin=1;
my $tune_regularizer = 0;
my $reg = 500;
my $reg_previous = 5000;
+my $dont_accum = 0;
# Process command-line options
Getopt::Long::Configure("no_auto_abbrev");
if (GetOptions(
"jobs=i" => \$jobs,
"dont-clean" => \$disable_clean,
+ "dont-accumulate" => \$dont_accum,
"pass-suffix=s" => \$pass_suffix,
"qsub" => \$useqsub,
"dry-run" => \$dryrun,
@@ -163,8 +165,6 @@ my $decoderBase = check_output("basename $decoder"); chomp $decoderBase;
my $newIniFile = "$dir/$decoderBase.ini";
my $inputFileName = "$dir/input";
my $user = $ENV{"USER"};
-
-
# process ini file
-e $iniFile || die "Error: could not open $iniFile for reading\n";
open(INI, $iniFile);
@@ -229,6 +229,13 @@ close F;
unless($best_weights){ $best_weights = $weights; }
unless($projected_score){ $projected_score = 0.0; }
$seen_weights{$weights} = 1;
+my $kbest = "$dir/kbest";
+if ($dont_accum) {
+ $kbest = '';
+} else {
+ check_call("mkdir -p $kbest");
+ $kbest = "--kbest_repository $kbest";
+}
my $random_seed = int(time / 1000);
my $lastWeightsFile;
@@ -305,7 +312,7 @@ while (1){
$cmd="$MAPINPUT $dir/hgs > $dir/agenda.$im1";
print STDERR "COMMAND:\n$cmd\n";
check_call($cmd);
- $cmd="$MAPPER $refs_comma_sep -m $metric -i $dir/agenda.$im1 -w $inweights > $outweights";
+ $cmd="$MAPPER $refs_comma_sep -m $metric -i $dir/agenda.$im1 $kbest -w $inweights > $outweights";
check_call($cmd);
$lastWeightsFile = $outweights;
$iteration++;
@@ -445,6 +452,9 @@ General options:
--help
Print this message and exit.
+ --dont-accumulate
+ Don't accumulate k-best lists from multiple iterations.
+
--max-iterations <M>
Maximum number of iterations to run. If not specified, defaults
to $default_max_iter.