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:
Diffstat (limited to 'scripts/training/cmert-0.5/makeinitopt')
-rwxr-xr-xscripts/training/cmert-0.5/makeinitopt27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/training/cmert-0.5/makeinitopt b/scripts/training/cmert-0.5/makeinitopt
new file mode 100755
index 000000000..5714b2482
--- /dev/null
+++ b/scripts/training/cmert-0.5/makeinitopt
@@ -0,0 +1,27 @@
+#!/usr/bin/perl -w
+
+if ($#ARGV != 2) {
+ die "usage: makeinitopt <ranges> <weightfile> <rangefile>"
+}
+$s = $ARGV[0];
+$woutput = $ARGV[1];
+$routput = $ARGV[2];
+open WOUT, ">$woutput" || die "couldn't open $woutput";
+open ROUT, ">$routput" || die "couldn't open $routput";
+
+@w = ();
+@lo = ();
+@hi = ();
+foreach $x (split(/;/, $s)) {
+ if ($x =~ /(.*),(-?[\d.]+)-(-?[\d.]+)/) {
+ push(@w, $1);
+ push(@lo, $2);
+ push(@hi, $3);
+ } else {
+ print STDERR "bad weight range: $x\n";
+ }
+}
+
+print WOUT join(" ", @w), "\n";
+print ROUT join(" ", @lo), "\n";
+print ROUT join(" ", @hi), "\n";