Hi,
I'm totally like you and don't want to require installing GIZA++ since
MGIZA can create all needed binaries. The bash wrapper is a good solution.
Here's another solution by changing the perl script (train-model.perl).
Line 195 :
my$SNT2COOC = "$BINDIR/snt2cooc.out";
change it to :
my$SNT2COOC;
if (-x"$BINDIR/snt2cooc.out") {
$SNT2COOC = "$BINDIR/snt2cooc.out";
} elsif(-x"$BINDIR/snt2cooc") {
$SNT2COOC = "$BINDIR/snt2cooc";
}
Line 219 -> 223 :
# 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++,& snt2cooc.out in$BINDIR.\nDid you install
this script using 'make release'?") unless((!$STEPS[2]) ||
(-x$GIZA && -x $SNT2COOC && -x
$MKCLS));
change it to :
# 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));
And finally, 1039 -> 1045 :
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");
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");
}
change it to
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") {
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 {
print"$SNT2COOC $dir/$f-$e.cooc $vcb_e $vcb_f $train\n";
safesystem("$SNT2COOC $dir/$f-$e.cooc $vcb_e $vcb_f $train") or
die("ERROR");
}
}
Tell me if i miss something.
Best Regards.
Marwen
Le 27/12/2011 06:38, Tom Hoar a écrit :
Marwen,
Be careful with mgiza. If you only install mgiza without giza++, you
won't be able to run train-model.perl. Train-model.perl looks for the
binary snt2cooc.out, but mgiza creates a binary snt2cooc with a
different command line syntax.
Always installing giza++ is one solutions. If you're like us and don't
want to require giza++, you can use this bash wrapper. Just name it
snt2cooc.out and put it in your bin folder with the mgiza snt2cooc file.
#! /bin/bash
${0%/*}/snt2cooc /dev/stdout $1 $2 $3
Of course, the best solution would be to update train-model.perl logic
to execute the right binary with the appropriate syntax. Regrettably,
we lack the Perl skills. So, maybe you or someone else can make the edits?
Tom
On Tue, 27 Dec 2011 12:10:28 +0700, Hieu Hoang
<[email protected]> wrote:
hi marwen
you're quite right, i've change the git code
https://github.com/moses-smt/mosesdecoder/commit/94b4ab16c7e0519f1483a3a5a67a3ec51a3d0043
On Tue, Dec 27, 2011 at 7:10 AM, Marwen Azouzi
<[email protected] <mailto:[email protected]>> wrote:
Hello Moses,
FILE train-model.perl LINE 187 :
$GIZA = "$BINDIR/mgizapp";
This line shouldn't be $GIZA = "$BINDIR/mgiza"; since the the
MGIZA binary file's default name is "mgiza" ? (I use the latest
version of Moses from Git)
Anyways, changing it will enable the multi-threading training.
Cheers
Marwen.
_______________________________________________
Moses-support mailing list
[email protected] <mailto:[email protected]>
http://mailman.mit.edu/mailman/listinfo/moses-support
_______________________________________________
Moses-support mailing list
[email protected]
http://mailman.mit.edu/mailman/listinfo/moses-support