mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-05 02:22:21 +03:00
Merge pull request #155 from ypeels/master
avoid name collisions when filtering multiple reordering tables
This commit is contained in:
commit
7f6ce67bac
@ -264,7 +264,6 @@ Parameter::Parameter()
|
||||
AddParam(misc_opts,"references", "Reference file(s) - used for bleu score feature");
|
||||
AddParam(misc_opts,"recover-input-path", "r", "(conf net/word lattice only) - recover input path corresponding to the best translation");
|
||||
AddParam(misc_opts,"link-param-count", "Number of parameters on word links when using confusion networks or lattices (default = 1)");
|
||||
AddParam(misc_opts,"description", "Source language, target language, description");
|
||||
AddParam(misc_opts,"feature-name-overwrite", "Override feature name (NOT arguments). Eg. SRILM-->KENLM, PhraseDictionaryMemory-->PhraseDictionaryScope3");
|
||||
|
||||
AddParam(misc_opts,"feature", "All the feature functions should be here");
|
||||
|
@ -224,6 +224,7 @@ while(my $line = <INI>) {
|
||||
elsif ($line =~ /LexicalReordering /) {
|
||||
print STDERR "ro:$line\n";
|
||||
my ($source_factor, $t, $w, $file); # = ($1,$2,$3,$4);
|
||||
my $dest_factor;
|
||||
|
||||
for (my $i = 1; $i < scalar(@toks); ++$i) {
|
||||
my @args = split(/=/, $toks[$i]);
|
||||
@ -238,6 +239,7 @@ while(my $line = <INI>) {
|
||||
}
|
||||
elsif ($args[0] eq "output-factor") {
|
||||
#$t = chomp($args[1]);
|
||||
$dest_factor = $args[1];
|
||||
}
|
||||
elsif ($args[0] eq "type") {
|
||||
$t = $args[1];
|
||||
@ -255,6 +257,13 @@ while(my $line = <INI>) {
|
||||
my $new_name = "$dir/$file";
|
||||
$new_name =~ s/\.gz//;
|
||||
|
||||
# avoid name collisions for multiple reordering tables; using phrase-table numbering scheme (except for TABLE_NUMBER)
|
||||
$new_name .= ".$source_factor-$dest_factor";
|
||||
my $cnt = 1;
|
||||
$cnt ++ while (defined $new_name_used{"$new_name.$cnt"});
|
||||
$new_name .= ".$cnt";
|
||||
$new_name_used{$new_name} = 1;
|
||||
|
||||
#print INI_OUT "$source_factor $t $w $new_name\n";
|
||||
@toks = set_value(\@toks, "path", "$new_name");
|
||||
print INI_OUT join_array(\@toks)."\n";
|
||||
|
Loading…
Reference in New Issue
Block a user