Skip to content

Commit

Permalink
Add check for absolute filename in language model
Browse files Browse the repository at this point in the history
The issue is that the mert-moses script requires an absolute
path, but that the train-factored-phrase-model script was
happy to write a relative one to the moses.ini file.  This
blocks that behaviour from the very beginning.
  • Loading branch information
Eric Kow committed Nov 20, 2008
1 parent b7563e2 commit 1b6adad
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/training/train-factored-phrase-model.perl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use strict;
use Getopt::Long "GetOptions";
use FindBin qw($Bin);
use File::Spec::Functions;
use File::Basename;

# Train Factored Phrase Model
Expand Down Expand Up @@ -215,6 +216,8 @@
($f, $order, $filename, $type) = split /:/, $lm, 4;
die "ERROR: Wrong format of --lm. Expected: --lm factor:order:filename"
if $f !~ /^[0-9]+$/ || $order !~ /^[0-9]+$/ || !defined $filename;
die "ERROR: Filename is not absolute: $filename"
unless file_name_is_absolute $filename;
die "ERROR: Language model file not found or empty: $filename"
if ! -s $filename;
push @___LM, [ $f, $order, $filename, $type ];
Expand Down

0 comments on commit 1b6adad

Please sign in to comment.