Tuesday, June 28, 2011

Bug of MERT script of Moses when tuning on lattice

I am using some new version of Moses to decode lattice, but when I use the MERT script (mert-moses.pl) to tune on lattice input. I got some errors as follows:
Can't use an undefined value as an ARRAY reference at mert-moses.pl line 684.

After investigating for a while, I realized that the mert-moses.pl has not recognized that the input lattice weight ([weight-i]) is a weight to be tuned. Thus, I have read through the script and changed the procedure named scan_config: after the line "die "$inishortname: File was empty!" if !$nr;" I have added the following code:
################################################
# wangpd
foreach my $k (keys %$config_weights)
{
if (!defined $used_triples{$k})
{
my @triplets = @{$additional_triples->{$k}};
my $needlambdas = scalar(@{$config_weights->{$k}});
for(my $lambda=0; $lambda<$needlambdas; $lambda++)
{
my $triplet = $lambda;
$triplet %= scalar(@triplets)
if $additional_tripes_loop->{$k};
my ($start, $min, $max)
= @{$triplets[$triplet]};
push @{$used_triples{$k}}, [$start, $min, $max];
}
}
}
#################################################

No comments: