Dear moses-support,

I have a couple of very minor patches to the scripts (hereby attached)
that I would like to submit.  Is there a place in particular that I
should send them to?

Thanks!

Eric

Note: git users may want be interested in this import of the SVN tree
        http://github.com/kowey/moses/tree/master
      which is bidirectional in principle (via git-svn)

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
diff --git a/scripts/training/mert-moses.pl b/scripts/training/mert-moses.pl
index af87670..e85638c 100755
--- a/scripts/training/mert-moses.pl
+++ b/scripts/training/mert-moses.pl
@@ -37,9 +37,17 @@
 # Original version by Philipp Koehn
 
 use FindBin qw($Bin);
+use File::Basename;
 my $SCRIPTS_ROOTDIR = $Bin;
+if ($SCRIPTS_ROOTDIR eq '') {
+  $SCRIPTS_ROOTDIR = dirname(__FILE__);
+}
 $SCRIPTS_ROOTDIR =~ s/\/training$//;
-$SCRIPTS_ROOTDIR = $ENV{"SCRIPTS_ROOTDIR"} if defined($ENV{"SCRIPTS_ROOTDIR"});
+if (defined($ENV{"SCRIPTS_ROOTDIR"})) {
+  $SCRIPTS_ROOTDIR = $ENV{"SCRIPTS_ROOTDIR"};
+} else {
+  $ENV{"SCRIPTS_ROOTDIR"} = $SCRIPTS_ROOTDIR;
+}
 
 # for each _d_istortion, _l_anguage _m_odel, _t_ranslation _m_odel and _w_ord penalty, there is a list
 # of [ default value, lower bound, upper bound ]-triples. In most cases, only one triple is used,
diff --git a/scripts/training/train-factored-phrase-model.perl b/scripts/training/train-factored-phrase-model.perl
index a5ff585..e36c2df 100755
--- a/scripts/training/train-factored-phrase-model.perl
+++ b/scripts/training/train-factored-phrase-model.perl
@@ -3,6 +3,7 @@
 use strict;
 use Getopt::Long "GetOptions";
 use FindBin qw($Bin);
+use File::Basename;
 
 # Train Factored Phrase Model
 # (c) 2006-2008 Philipp Koehn
@@ -11,6 +12,9 @@ use FindBin qw($Bin);
 # -----------------------------------------------------
 $ENV{"LC_ALL"} = "C";
 my $SCRIPTS_ROOTDIR = $Bin;
+if ($SCRIPTS_ROOTDIR eq '') {
+  $SCRIPTS_ROOTDIR = dirname(__FILE__);
+}
 $SCRIPTS_ROOTDIR =~ s/\/training$//;
 $SCRIPTS_ROOTDIR = $ENV{"SCRIPTS_ROOTDIR"} if defined($ENV{"SCRIPTS_ROOTDIR"});
 

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Moses-support mailing list
[email protected]
http://mailman.mit.edu/mailman/listinfo/moses-support

Reply via email to