Merge ../mosesdecoder into perf_moses2

This commit is contained in:
Hieu Hoang 2016-07-03 15:21:30 -04:00
commit 3629fe97db
3 changed files with 11 additions and 3 deletions

View File

@ -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");

View File

@ -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";

View File

@ -1814,7 +1814,7 @@ sub score_phrase_phrase_extract {
$cmd .= " --LogProb" if $LOG_PROB;
$cmd .= " --NegLogProb" if $NEG_LOG_PROB;
$cmd .= " --OnlyDirect" if $ONLY_DIRECT;
$cmd .= " --NoPhraseCount" unless $PHRASE_COUNT;
$cmd .= " --PhraseCount" if $PHRASE_COUNT;
$cmd .= " --LowCountFeature" if $LOW_COUNT;
$cmd .= " --CountBinFeature $COUNT_BIN" if $COUNT_BIN;
$cmd .= " --SparseCountBinFeature $SPARSE_COUNT_BIN" if $SPARSE_COUNT_BIN;
@ -2099,7 +2099,7 @@ sub create_ini {
$basic_weight_count+=2 if defined($_SCORE_OPTIONS) && $_SCORE_OPTIONS =~ /UnalignedPenalty/; # word ins/del
$basic_weight_count+=2 if defined($_SCORE_OPTIONS) && $_SCORE_OPTIONS =~ /UnalignedFunctionWordPenalty/;
$basic_weight_count /= 2 if defined($_SCORE_OPTIONS) && $_SCORE_OPTIONS =~ /OnlyDirect/;
$basic_weight_count++ if defined($_SCORE_OPTIONS) && $_SCORE_OPTIONS =~ /PhraseCount/; # phrase count feature
$basic_weight_count++ if !defined($_SCORE_OPTIONS) || $_SCORE_OPTIONS !~ /NoPhraseCount/; # phrase count feature
$basic_weight_count++ if defined($_SCORE_OPTIONS) && $_SCORE_OPTIONS =~ /LowCountFeature/; # low count feature
if (defined($_SCORE_OPTIONS) && $_SCORE_OPTIONS =~ /(\-CountBinFeature [\s\d]*\d)/) {
$basic_weight_count += scalar split(/\s+/,$1);