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:
authorlexi_birch <lexi_birch@1f5c12ca-751b-0410-a591-d2e778427230>2006-12-29 16:45:21 +0300
committerlexi_birch <lexi_birch@1f5c12ca-751b-0410-a591-d2e778427230>2006-12-29 16:45:21 +0300
commit93937b529d4a907bce7b32e2e8c0b7641e414630 (patch)
treeeda0aca0117e5c6ef2314991765a6dddb0375c7d /scripts
parent239e57c16c9efc1b8335f839538333974690d009 (diff)
Making remaining scripts os independent re pawd/pwd
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1103 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'scripts')
-rw-r--r--scripts/analysis/show-phrases-used.pl4
-rwxr-xr-xscripts/tests/full-train-mert-decode.test15
-rwxr-xr-xscripts/training/filter-model-given-input.pl5
-rwxr-xr-xscripts/training/mert-moses.pl9
-rwxr-xr-xscripts/training/train-factored-phrase-model.perl5
5 files changed, 28 insertions, 10 deletions
diff --git a/scripts/analysis/show-phrases-used.pl b/scripts/analysis/show-phrases-used.pl
index a3774d784..32885e752 100644
--- a/scripts/analysis/show-phrases-used.pl
+++ b/scripts/analysis/show-phrases-used.pl
@@ -7,7 +7,9 @@
use strict;
BEGIN
{
- my $wd = `pawd`; chop $wd;
+ my $wd= `pawd 2>/dev/null`;
+ if (!$wd) {$wd = `pwd`;}
+ chomp $wd;
push @INC, "$wd/perllib/sun4-solaris"; #for GD; if not an absolute path, Polygon.pm throws a fit
}
use lib "perllib/sun4-solaris/auto/GD";
diff --git a/scripts/tests/full-train-mert-decode.test b/scripts/tests/full-train-mert-decode.test
index ce76c4d05..00f51d938 100755
--- a/scripts/tests/full-train-mert-decode.test
+++ b/scripts/tests/full-train-mert-decode.test
@@ -4,6 +4,11 @@ function die() {
echo "$@"
exit 1
}
+RUNDIR=`pwd 2> /dev/null`
+if [ -z $RUNDIR ]; then
+ RUNDIR=`pwd`
+fi;
+
[ -d $WORKSPACE ] || die "Missing $WORKSPACE"
echo "Workspace: $WORKSPACE"
@@ -15,7 +20,7 @@ MOSES=$WORKSPACE/moses-cmd/src/moses
export SCRIPTS_ROOTDIR=$WORKSPACE/scripts
-cp -r ../cs-en-sample ./corpus || die "Missing "`pawd`"/../cs-en-sample"
+cp -r ../cs-en-sample ./corpus || die "Missing $RUNDIR/../cs-en-sample"
echo "Copied cs-en-sample files"
mv corpus/test.* ./ || die "Missing corpus/test.*"
@@ -39,17 +44,17 @@ $SCRIPTS_ROOTDIR/training/train-factored-phrase-model.perl \
--corpus corpus/train \
--root . \
--parallel \
- --lm 0:3:`pawd`/corpus/lm.en.gz \
+ --lm 0:3:$RUNDIR/corpus/lm.en.gz \
|| die "Failed to train the model"
echo "Finished moses.ini, merting."
$SCRIPTS_ROOTDIR/training/mert-moses.pl \
--working-dir=mert-tuning \
- `pawd`/dev.src \
- `pawd`/dev.ref \
+ $RUNDIR/dev.src \
+ $RUNDIR/dev.ref \
$MOSES \
- `pawd`/model/moses.ini \
+ $RUNDIR/model/moses.ini \
--decoder-flags="-dl 6 " \
|| die "Merting failed"
diff --git a/scripts/training/filter-model-given-input.pl b/scripts/training/filter-model-given-input.pl
index 3a17db664..b2faa4006 100755
--- a/scripts/training/filter-model-given-input.pl
+++ b/scripts/training/filter-model-given-input.pl
@@ -194,7 +194,10 @@ sub safesystem {
sub ensure_full_path {
my $PATH = shift;
return $PATH if $PATH =~ /^\//;
- $PATH = `pawd`."/".$PATH;
+ my $dir = `pawd 2>/dev/null`;
+ if (!$dir) {$dir = `pwd`;}
+ chomp $dir;
+ $PATH = $dir."/".$PATH;
$PATH =~ s/[\r\n]//g;
$PATH =~ s/\/\.\//\//g;
$PATH =~ s/\/+/\//g;
diff --git a/scripts/training/mert-moses.pl b/scripts/training/mert-moses.pl
index a795ceb04..3f55e56a8 100755
--- a/scripts/training/mert-moses.pl
+++ b/scripts/training/mert-moses.pl
@@ -396,7 +396,9 @@ my @order_of_lambdas_from_decoder = ();
#store current directory and create the working directory (if needed)
-my $cwd = `pawd`; chop($cwd);
+my $cwd = `pawd 2>/dev/null`;
+if(!$cwd){$cwd = `pwd`;}
+chomp($cwd);
safesystem("mkdir -p $___WORKING_DIR") or die "Can't mkdir $___WORKING_DIR";
{
@@ -908,7 +910,10 @@ sub safesystem {
sub ensure_full_path {
my $PATH = shift;
return $PATH if $PATH =~ /^\//;
- $PATH = `pawd`."/".$PATH;
+ my $dir = `pawd 2>/dev/null`;
+ if(!$dir){$dir = `pwd`;}
+ chomp($dir);
+ $PATH = $dir."/".$PATH;
$PATH =~ s/[\r\n]//g;
$PATH =~ s/\/\.\//\//g;
$PATH =~ s/\/+/\//g;
diff --git a/scripts/training/train-factored-phrase-model.perl b/scripts/training/train-factored-phrase-model.perl
index 09a1bb17b..a23c2d6d3 100755
--- a/scripts/training/train-factored-phrase-model.perl
+++ b/scripts/training/train-factored-phrase-model.perl
@@ -1418,7 +1418,10 @@ print INI "\n# word penalty
sub full_path {
my ($PATH) = @_;
return if $$PATH =~ /^\//;
- $$PATH = `pawd`."/".$$PATH;
+ my $dir = `pawd 2>/dev/null`;
+ if(!$dir){$dir = `pwd`;}
+ chomp $dir;
+ $$PATH = $dir."/".$$PATH;
$$PATH =~ s/[\r\n]//g;
$$PATH =~ s/\/\.\//\//g;
$$PATH =~ s/\/+/\//g;