diff options
author | Jehan <jehan@mygengo.com> | 2011-11-27 14:14:39 +0400 |
---|---|---|
committer | Jehan <jehan@mygengo.com> | 2011-11-27 14:14:39 +0400 |
commit | f0806897b896accd4bc4e67c377b0b0d4dc802ab (patch) | |
tree | 56f8592b4acfcdf5aea744b4336954933b18155d /scripts | |
parent | ac89019597111625531770c00deee30ee513378f (diff) |
- Bug fix: when --help set, errors on absence of --corpus or --dir must not be displayed.
- Unset variables must not be set as 0.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/recaser/train-recaser.perl | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/scripts/recaser/train-recaser.perl b/scripts/recaser/train-recaser.perl index 5d1ef0b4a..a5a707554 100755 --- a/scripts/recaser/train-recaser.perl +++ b/scripts/recaser/train-recaser.perl @@ -8,7 +8,7 @@ binmode(STDIN, ":utf8"); binmode(STDOUT, ":utf8"); # apply switches -my ($DIR,$CORPUS,$SCRIPTS_ROOT_DIR,$CONFIG); +my ($DIR,$CORPUS,$SCRIPTS_ROOT_DIR,$CONFIG,$HELP,$ERROR); my $LM = "SRILM"; # SRILM is default. my $BUILD_LM = "build-lm.sh"; my $NGRAM_COUNT = "ngram-count"; @@ -16,8 +16,6 @@ my $TRAIN_SCRIPT = "train-factored-phrase-model.perl"; my $MAX_LEN = 1; my $FIRST_STEP = 1; my $LAST_STEP = 11; -my $HELP = 0; -my $ERROR = 0; $ERROR = "training Aborted." unless &GetOptions('first-step=i' => \$FIRST_STEP, 'last-step=i' => \$LAST_STEP, @@ -33,8 +31,8 @@ $ERROR = "training Aborted." 'help' => \$HELP); # check and set default to unset parameters -$ERROR = "please specify working dir --dir" unless defined($DIR); -$ERROR = "please specify --corpus" if !defined($CORPUS) +$ERROR = "please specify working dir --dir" unless defined($DIR) || defined($HELP); +$ERROR = "please specify --corpus" if !defined($CORPUS) && !defined($HELP) && $FIRST_STEP <= 2 && $LAST_STEP >= 1; if ($HELP || $ERROR) { |