sparse feature specification bug fix

This commit is contained in:
phikoehn 2013-06-08 13:39:15 +01:00
parent a974bbafac
commit 730da7edec
2 changed files with 7 additions and 7 deletions

View File

@ -576,7 +576,7 @@ build-sparse
out: sparse
ignore-unless: sparse-features
rerun-on-change: sparse-features
default-name: model/most-frequent-words
default-name: model/sparse-features
template: $moses-script-dir/ems/support/build-sparse-features.perl IN $input-extension $output-extension OUT "$sparse-features"
create-config
in: sigtest-filter-reordering-table sigtest-filter-phrase-translation-table generation-table sparse corpus-mml-prefilter=OR=corpus-mml-postfilter=OR=domains INTERPOLATED-LM:binlm LM:binlm

View File

@ -46,20 +46,20 @@ foreach my $feature_spec (split(/,\s*/,$specification)) {
$ini .= "\n";
}
elsif ($SPEC[0] eq 'word-translation') {
$ini .= "WordTranslationFeature input-factor=0 output-factor=0 simple=1 source-context=0 target-context=0";
my $extra_ini = "";
if ($SPEC[1] eq 'top' && $SPEC[2] =~ /^\d+$/ && $SPEC[3] =~ /^\d+$/) {
my $file_in = &create_top_words($input_extension, $SPEC[2]);
my $file_out = &create_top_words($output_extension, $SPEC[3]);
$ini .= " source-path=$file_in target-path=$file_out"
$extra_ini .= " source-path=$file_in target-path=$file_out"
}
elsif ($SPEC[1] eq 'all') {
# nothing to specify
}
else {
die("ERROR: Unknown parameter specification in '$feature_spec'\n");
die("ERROR: Unknown parameter specification in '$SPEC[1]'\n");
}
$ini .= "\n";
my ($input_factor,$output_factor) = split(/\-/,$factor);
$ini .= "WordTranslationFeature input-factor=$input_factor output-factor=$output_factor simple=1 source-context=0 target-context=0$extra_ini\n";
}
elsif ($SPEC[0] eq 'phrase-length') {
$ini .= "PhraseLengthFeature\n";