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:
authorHieu Hoang <fishandfrolick@gmail.com>2012-05-31 19:52:37 +0400
committerHieu Hoang <fishandfrolick@gmail.com>2012-05-31 19:52:37 +0400
commit220ee4cd3643e0f111c8f4e15d07c3d391e5340f (patch)
treed273f4eeae4faa6510c3ac3ef6cec4674dbed4ce /scripts
parentc80ac7d7e40d2b9e2e735fda0787785f8bee38a8 (diff)
add -external-bin-dir for giza++/mgiza directory. Ignore -bin-dir and -script-root-dir
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ems/experiment.perl3
-rwxr-xr-xscripts/training/train-model.perl.missing_bin_dir50
2 files changed, 28 insertions, 25 deletions
diff --git a/scripts/ems/experiment.perl b/scripts/ems/experiment.perl
index cb4518dde..b0e71c969 100755
--- a/scripts/ems/experiment.perl
+++ b/scripts/ems/experiment.perl
@@ -1994,6 +1994,7 @@ sub get_training_setting {
my ($step) = @_;
my $dir = &check_and_get("GENERAL:working-dir");
my $training_script = &check_and_get("TRAINING:script");
+ my $external_bin_dir = &check_backoff_and_get("TRAINING:external-bin-dir");
my $scripts = &check_backoff_and_get("TUNING:moses-script-dir");
my $reordering = &get("TRAINING:lexicalized-reordering");
my $input_extension = &check_backoff_and_get("TRAINING:input-extension");
@@ -2016,7 +2017,7 @@ sub get_training_setting {
$cmd .= "-dont-zip ";
$cmd .= "-first-step $step " if $step>1;
$cmd .= "-last-step $step " if $step<9;
- $cmd .= "-scripts-root-dir $scripts ";
+ $cmd .= "-external-bin-dir $external_bin_dir " if defined($external_bin_dir);
$cmd .= "-f $input_extension -e $output_extension ";
$cmd .= "-alignment $alignment ";
$cmd .= "-max-phrase-length $phrase_length " if $phrase_length;
diff --git a/scripts/training/train-model.perl.missing_bin_dir b/scripts/training/train-model.perl.missing_bin_dir
index 48911a891..b0cb26275 100755
--- a/scripts/training/train-model.perl.missing_bin_dir
+++ b/scripts/training/train-model.perl.missing_bin_dir
@@ -17,9 +17,9 @@ if ($SCRIPTS_ROOTDIR eq '') {
$SCRIPTS_ROOTDIR = dirname(__FILE__);
}
$SCRIPTS_ROOTDIR =~ s/\/training$//;
-$SCRIPTS_ROOTDIR = $ENV{"SCRIPTS_ROOTDIR"} if defined($ENV{"SCRIPTS_ROOTDIR"});
+#$SCRIPTS_ROOTDIR = $ENV{"SCRIPTS_ROOTDIR"} if defined($ENV{"SCRIPTS_ROOTDIR"});
-my($_ROOT_DIR, $_CORPUS_DIR, $_GIZA_E2F, $_GIZA_F2E, $_MODEL_DIR, $_TEMP_DIR, $_SORT_BUFFER_SIZE, $_SORT_BATCH_SIZE, $_SORT_COMPRESS, $_SORT_PARALLEL, $_CORPUS,
+my($_EXTERNAL_BINDIR, $_ROOT_DIR, $_CORPUS_DIR, $_GIZA_E2F, $_GIZA_F2E, $_MODEL_DIR, $_TEMP_DIR, $_SORT_BUFFER_SIZE, $_SORT_BATCH_SIZE, $_SORT_COMPRESS, $_SORT_PARALLEL, $_CORPUS,
$_CORPUS_COMPRESSION, $_FIRST_STEP, $_LAST_STEP, $_F, $_E, $_MAX_PHRASE_LENGTH,
$_LEXICAL_FILE, $_NO_LEXICAL_WEIGHTING, $_VERBOSE, $_ALIGNMENT,
$_ALIGNMENT_FILE, $_ALIGNMENT_STEM, @_LM, $_EXTRACT_FILE, $_GIZA_OPTION, $_HELP, $_PARTS,
@@ -36,17 +36,14 @@ my($_ROOT_DIR, $_CORPUS_DIR, $_GIZA_E2F, $_GIZA_F2E, $_MODEL_DIR, $_TEMP_DIR, $_
$_MEMSCORE, $_FINAL_ALIGNMENT_MODEL,
$_CONTINUE,$_MAX_LEXICAL_REORDERING,$_DO_STEPS,
$_ADDITIONAL_INI,
- $_DICTIONARY, $_EPPEX);
+ $_DICTIONARY, $_EPPEX, $IGNORE);
my $_CORES = 1;
my $debug = 0; # debug this script, do not delete any files in debug mode
-# the following line is set installation time by 'make release'. BEWARE!
-my $BINDIR="/Users/hieuhoang/workspace/bin/training-tools/";
-
$_HELP = 1
unless &GetOptions('root-dir=s' => \$_ROOT_DIR,
- 'bin-dir=s' => \$BINDIR, # allow to override default bindir path
+ 'external-bin-dir=s' => \$_EXTERNAL_BINDIR,
'corpus-dir=s' => \$_CORPUS_DIR,
'corpus=s' => \$_CORPUS,
'f=s' => \$_F,
@@ -93,7 +90,8 @@ $_HELP = 1
'generation-factors=s' => \$_GENERATION_FACTORS,
'decoding-steps=s' => \$_DECODING_STEPS,
'decoding-graph-backoff=s' => \$_DECODING_GRAPH_BACKOFF,
- 'scripts-root-dir=s' => \$SCRIPTS_ROOTDIR,
+ 'bin-dir=s' => \$IGNORE,
+ 'scripts-root-dir=s' => \$IGNORE,
'factor-delimiter=s' => \$_FACTOR_DELIMITER,
'phrase-translation-table=s' => \@_PHRASE_TABLE,
'generation-corpus=s' => \$_GENERATION_CORPUS,
@@ -144,6 +142,10 @@ For more, please check manual or contact koehn\@inf.ed.ac.uk\n";
exit(1);
}
+if (defined($IGNORE)) {
+ print STDERR "WARNING: Do not specify -bin-dir or -scripts-root-dir anymore. These variable are ignored and will be deleted soon";
+}
+
$_HIERARCHICAL = 1 if $_SOURCE_SYNTAX || $_TARGET_SYNTAX;
$_XML = 1 if $_SOURCE_SYNTAX || $_TARGET_SYNTAX;
my $___FACTOR_DELIMITER = $_FACTOR_DELIMITER;
@@ -187,24 +189,24 @@ foreach my $step (@step_conf) {
# supporting binaries from other packages
-my $MGIZA_MERGE_ALIGN = "$BINDIR/merge_alignment.py";
+my $MGIZA_MERGE_ALIGN = "$_EXTERNAL_BINDIR/merge_alignment.py";
my $GIZA;
my $SNT2COOC;
if(!defined $_MGIZA ){
- $GIZA = "$BINDIR/GIZA++";
- if (-x "$BINDIR/snt2cooc.out") {
- $SNT2COOC = "$BINDIR/snt2cooc.out";
- } elsif (-x "$BINDIR/snt2cooc") { # Since "snt2cooc.out" and "snt2cooc" work the same
- $SNT2COOC = "$BINDIR/snt2cooc";
+ $GIZA = "$_EXTERNAL_BINDIR/GIZA++";
+ if (-x "$_EXTERNAL_BINDIR/snt2cooc.out") {
+ $SNT2COOC = "$_EXTERNAL_BINDIR/snt2cooc.out";
+ } elsif (-x "$_EXTERNAL_BINDIR/snt2cooc") { # Since "snt2cooc.out" and "snt2cooc" work the same
+ $SNT2COOC = "$_EXTERNAL_BINDIR/snt2cooc";
}
print STDERR "Using single-thread GIZA\n";
} else {
- $GIZA = "$BINDIR/mgiza";
- if (-x "$BINDIR/snt2cooc") {
- $SNT2COOC = "$BINDIR/snt2cooc";
- } elsif (-x "$BINDIR/snt2cooc.out") { # Important for users that use MGIZA and copy only the "mgiza" file to $BINDIR
- $SNT2COOC = "$BINDIR/snt2cooc.out";
+ $GIZA = "$_EXTERNAL_BINDIR/mgiza";
+ if (-x "$_EXTERNAL_BINDIR/snt2cooc") {
+ $SNT2COOC = "$_EXTERNAL_BINDIR/snt2cooc";
+ } elsif (-x "$_EXTERNAL_BINDIR/snt2cooc.out") { # Important for users that use MGIZA and copy only the "mgiza" file to $_EXTERNAL_BINDIR
+ $SNT2COOC = "$_EXTERNAL_BINDIR/snt2cooc.out";
}
print STDERR "Using multi-thread GIZA\n";
if (!defined($_MGIZA_CPUS)) {
@@ -214,9 +216,9 @@ if(!defined $_MGIZA ){
}
# override
-$SNT2COOC = "$BINDIR/$_SNT2COOC" if defined($_SNT2COOC);
+$SNT2COOC = "$_EXTERNAL_BINDIR/$_SNT2COOC" if defined($_SNT2COOC);
-my $MKCLS = "$BINDIR/mkcls";
+my $MKCLS = "$_EXTERNAL_BINDIR/mkcls";
# parallel extract
my $SPLIT_EXEC = `gsplit --help 2>/dev/null`;
@@ -278,8 +280,8 @@ my $BZCAT = "bzcat";
# do a sanity check to make sure we can find the necessary binaries since
# these are not installed by default
# not needed if we start after step 2
-die("ERROR: Cannot find mkcls, GIZA++/mgiza, & snt2cooc.out/snt2cooc in $BINDIR.\nDid you install this script using 'make release'?") unless ((!$STEPS[2]) ||
- (-x $GIZA && defined($SNT2COOC) && -x $MKCLS));
+die("ERROR: Cannot find mkcls, GIZA++/mgiza, & snt2cooc.out/snt2cooc in $_EXTERNAL_BINDIR.\nYou MUST specify the parameter -external-bin-dir") unless ((!$STEPS[2]) ||
+ (defined($_EXTERNAL_BINDIR) && -x $GIZA && defined($SNT2COOC) && -x $MKCLS));
# set varibles to defaults or from options
my $___ROOT_DIR = ".";
@@ -1099,7 +1101,7 @@ sub run_single_snt2cooc {
my($dir,$e,$f,$vcb_e,$vcb_f,$train) = @_;
print STDERR "(2.1a) running snt2cooc $f-$e @ ".`date`."\n";
safesystem("mkdir -p $dir") or die("ERROR");
- if ($SNT2COOC eq "$BINDIR/snt2cooc.out") {
+ if ($SNT2COOC eq "$_EXTERNAL_BINDIR/snt2cooc.out") {
print "$SNT2COOC $vcb_e $vcb_f $train > $dir/$f-$e.cooc\n";
safesystem("$SNT2COOC $vcb_e $vcb_f $train > $dir/$f-$e.cooc") or die("ERROR");
} else {