mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-10-26 19:37:58 +03:00
bug fixes
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1917 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
8a4c6a2c63
commit
bfbbefd710
@ -491,6 +491,7 @@ my $PARAMETERS;
|
||||
$PARAMETERS = $___DECODER_FLAGS;
|
||||
|
||||
my $devbleu = undef;
|
||||
my $startbleu = undef;
|
||||
my $bestpoint = undef;
|
||||
my $run=$start_run-1;
|
||||
|
||||
@ -506,7 +507,7 @@ while(1) {
|
||||
print "run $run start at ".`date`;
|
||||
|
||||
# In case something dies later, we might wish to have a copy
|
||||
create_config($___CONFIG, "./run$run.moses.ini", \%used_triples, $run, (defined$devbleu?$devbleu:"--not-estimated--"));
|
||||
create_config($___CONFIG, "./run$run.moses.ini", \%used_triples, $run, (defined$startbleu?$startbleu:"not-est."), (defined$devbleu?$devbleu:"not-est."));
|
||||
|
||||
|
||||
# skip if the user wanted
|
||||
@ -724,6 +725,7 @@ while(1) {
|
||||
|
||||
$bestpoint = undef;
|
||||
$devbleu = undef;
|
||||
$startbleu = undef;
|
||||
open(IN,"cmert.log") or die "Can't open cmert.log";
|
||||
while (<IN>) {
|
||||
if (/Best point:\s*([\s\d\.\-]+?)\s*=> ([\d\.]+)/) {
|
||||
@ -731,6 +733,9 @@ while(1) {
|
||||
$devbleu = $2;
|
||||
last;
|
||||
}
|
||||
elsif((! $startbleu) && /^starting.+=> ([\d\.]+)/) {
|
||||
$startbleu = $1;
|
||||
}
|
||||
}
|
||||
close IN;
|
||||
die "Failed to parse cmert.log, missed Best point there."
|
||||
@ -771,7 +776,7 @@ if (defined $allsorted){ safesystem ("\\rm -f $allsorted") or die; };
|
||||
safesystem("\\cp -f init.opt run$run.init.opt") or die;
|
||||
safesystem("\\cp -f cmert.log run$run.cmert.log") or die;
|
||||
|
||||
create_config($___CONFIG_BAK, "./moses.ini", \%used_triples, $run, $devbleu);
|
||||
create_config($___CONFIG_BAK, "./moses.ini", \%used_triples, $run, $startbleu, $devbleu);
|
||||
|
||||
# just to be sure that we have the really last finished step marked
|
||||
open F, "> finished_step.txt" or die "Can't mark finished step";
|
||||
@ -910,6 +915,7 @@ sub create_config {
|
||||
my $outfn = shift; # where to save the config
|
||||
my $triples = shift; # the lambdas we should write
|
||||
my $iteration = shift; # just for verbosity
|
||||
my $bleu_started = shift; # just for verbosity
|
||||
my $bleu_achieved = shift; # just for verbosity
|
||||
|
||||
my %P; # the hash of all parameters we wish to override
|
||||
@ -953,7 +959,7 @@ sub create_config {
|
||||
open(OUT,"> $outfn") or die "Can't write $outfn";
|
||||
print OUT "# MERT optimized configuration\n";
|
||||
print OUT "# decoder $___DECODER\n";
|
||||
print OUT "# BLEU $bleu_achieved on dev $___DEV_F\n";
|
||||
print OUT "# BLEU $bleu_started -> $bleu_achieved on dev $___DEV_F\n";
|
||||
print OUT "# We were before running iteration $iteration\n";
|
||||
print OUT "# finished ".`date`;
|
||||
my $line = <INI>;
|
||||
|
@ -1126,7 +1126,8 @@ sub get_reordering_factored {
|
||||
my %FILE;
|
||||
foreach my $type (@TYPE) {
|
||||
if (defined($REORDERING_MODEL{$type})) {
|
||||
my $file = "reordering-table.$type.$___REORDERING_SMOOTH";
|
||||
my $file = "$___MODEL_DIR/reordering-table";
|
||||
$file .= ".$type" if (scalar keys %REORDERING_MODEL) > 2;
|
||||
$file = shift @SPECIFIED_TABLE if scalar(@SPECIFIED_TABLE);
|
||||
$FILE{$type} = $file;
|
||||
}
|
||||
@ -1140,7 +1141,8 @@ sub get_reordering_factored {
|
||||
my %FILE;
|
||||
foreach my $type (@TYPE) {
|
||||
if (defined($REORDERING_MODEL{$type})) {
|
||||
my $file = "reordering-table.$type.$___REORDERING_SMOOTH.$factor";
|
||||
my $file = "$___MODEL_DIR/reordering-table.$factor";
|
||||
$file .= ".$type" if (scalar keys %REORDERING_MODEL) > 2;
|
||||
$file = shift @SPECIFIED_TABLE if scalar(@SPECIFIED_TABLE);
|
||||
$FILE{$type} = $file;
|
||||
}
|
||||
@ -1526,6 +1528,7 @@ print INI "\n# language models: type(srilm/irstlm), factors, order, file
|
||||
my $path = `pwd`; chop($path);
|
||||
$fn = $path."/".$fn;
|
||||
}
|
||||
$type = 0 unless $type;
|
||||
print INI "$type $f $o $fn\n";
|
||||
}
|
||||
|
||||
@ -1545,22 +1548,20 @@ print INI "\n\n\# limit on how many phrase translations e for each phrase f are
|
||||
|
||||
my @SPECIFIED_TABLE = @_REORDERING_TABLE;
|
||||
foreach my $factor (split(/\+/,$___REORDERING_FACTORS)) {
|
||||
foreach my $r (keys %REORDERING_MODEL) {
|
||||
next if $r eq "fe" || $r eq "f";
|
||||
next if $r eq "distance";
|
||||
my $type = $r;
|
||||
$r =~ s/-bidirectional/.bi/;
|
||||
$r =~ s/-f/.f/;
|
||||
$r =~ s/msd/msd-table.$factor/;
|
||||
$r =~ s/monotonicity/monotonicity-table.$factor/;
|
||||
|
||||
foreach my $type (keys %REORDERING_MODEL) {
|
||||
next if $type eq "fe" || $type eq "f";
|
||||
next if $type eq "distance";
|
||||
my $w;
|
||||
if ($r =~ /msd/) { $w = 3; } else { $w = 1; }
|
||||
if ($r =~ /bi/) { $w *= 2; }
|
||||
if ($type =~ /msd/) { $w = 3; } else { $w = 1; }
|
||||
if ($type =~ /bi/) { $w *= 2; }
|
||||
$weight_d_count += $w;
|
||||
|
||||
my $table_file = "$___MODEL_DIR/$r.$___REORDERING_SMOOTH.gz";
|
||||
my $table_file = "$___MODEL_DIR/reordering-table";
|
||||
$table_file .= ".$factor" unless $___NOT_FACTORED;
|
||||
$table_file .= ".$type" if (scalar keys %REORDERING_MODEL) > 2;
|
||||
$table_file .= ".gz";
|
||||
$table_file = shift @SPECIFIED_TABLE if scalar(@SPECIFIED_TABLE);
|
||||
$type =~ s/\-f/\-unidirectional\-f/ unless $type =~ /\-bi/;
|
||||
$file .= "$factor $type $w $table_file\n";
|
||||
}
|
||||
$factor_i++;
|
||||
|
Loading…
Reference in New Issue
Block a user