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:
authorTetsuo Kiso <tetsuo-s@is.naist.jp>2011-12-08 21:10:40 +0400
committerTetsuo Kiso <tetsuo-s@is.naist.jp>2011-12-08 21:10:40 +0400
commit108cd429151f2ff7c6e0c094864bc325e9679144 (patch)
tree862ce2ef0939b3fbf92c8d1ac3872b19e0973bd4 /scripts
parent95653828f992f0695a6e8ea2611e544e1c3d79e2 (diff)
Fix bug on MERT Perl script when working directory is not specified.
If you set a working directory from the command line option, the script works fine. However, if you don't, the script will crash when calling a function `create_extractor_script()' which creates shell script for the following MERT iterations due to the inconsistency between path to default working directory and Perl interpreter's current directory. So, We assume that the default working directory used in the script will be set to "`pwd`/mert-work".
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/training/mert-moses.pl9
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/training/mert-moses.pl b/scripts/training/mert-moses.pl
index b472daf46..438c0e634 100755
--- a/scripts/training/mert-moses.pl
+++ b/scripts/training/mert-moses.pl
@@ -47,9 +47,13 @@
# 13 Oct 2004 Use alternative decoders (DWC)
# Original version by Philipp Koehn
+use strict;
use FindBin qw($Bin);
use File::Basename;
use File::Path;
+use File::Spec;
+use Cwd;
+
my $SCRIPTS_ROOTDIR = $Bin;
$SCRIPTS_ROOTDIR =~ s/\/training$//;
$SCRIPTS_ROOTDIR = $ENV{"SCRIPTS_ROOTDIR"} if defined($ENV{"SCRIPTS_ROOTDIR"});
@@ -82,7 +86,10 @@ my $minimum_required_change_in_weights = 0.00001;
my $verbose = 0;
my $usage = 0; # request for --help
-my $___WORKING_DIR = "mert-work";
+
+# We assume that if you don't specify working directory,
+# we set the default is set to `pwd`/mert-work
+my $___WORKING_DIR = File::Spec->catfile(Cwd::getcwd(), "mert-work");
my $___DEV_F = undef; # required, input text to decode
my $___DEV_E = undef; # required, basename of files with references
my $___DECODER = undef; # required, pathname to the decoder executable