phrase table type deduced in experiment.perl. Passed to train-model.perl

This commit is contained in:
Hieu Hoang 2012-06-07 15:46:58 +01:00
parent 0b59bee21c
commit 05fc5ffce3
2 changed files with 40 additions and 16 deletions

View File

@ -1768,20 +1768,36 @@ sub define_training_build_custom_generation {
sub define_training_create_config {
my ($step_id) = @_;
my ($config,
$reordering_table,$phrase_translation_table,$generation_table,@LM)
= &get_output_and_input($step_id);
my ($config,$reordering_table,$phrase_translation_table,$generation_table,@LM)
= &get_output_and_input($step_id);
my $cmd = &get_training_setting(9);
# get model, and whether suffix array is used. Determines the pt implementation.
my $hierarchical = &get("TRAINING:hierarchical-rule-set");
my $sa_exec_dir = &get("TRAINING:suffix-array");
my $ptImpl;
if ($hierarchical) {
if ($sa_exec_dir) {
$ptImpl = 10; # suffix array
}
else {
$ptImpl = 6; # in-mem SCFG
}
}
else {
$ptImpl = 0; # phrase-based
}
# additional settings for factored models
$cmd .= &get_table_name_settings("translation-factors","phrase-translation-table",$phrase_translation_table);
$cmd .= &get_table_name_settings("reordering-factors","reordering-table",$reordering_table)
if $reordering_table;
$cmd .= &get_table_name_settings("generation-factors","generation-table",$generation_table)
if $generation_table;
$cmd .= &get_table_name_settings("translation-factors","phrase-translation-table","$phrase_translation_table:$ptImpl");
$cmd .= &get_table_name_settings("reordering-factors","reordering-table",$reordering_table) if $reordering_table;
$cmd .= &get_table_name_settings("generation-factors","generation-table",$generation_table) if $generation_table;
$cmd .= "-config $config ";
print STDERR "HIEU: $hierarchical \n $sa_exec_dir \n $cmd \n";
my $decoding_graph_backoff = &get("TRAINING:decoding-graph-backoff");
if ($decoding_graph_backoff) {
$cmd .= "-decoding-graph-backoff \"$decoding_graph_backoff\" ";
@ -2204,7 +2220,7 @@ sub define_tuningevaluation_filter {
$cmd .= "-config $config\n";
# filter command
my $sa_exec_dir = &check_and_get("TRAINING:suffix-array");
my $sa_exec_dir = &get("TRAINING:suffix-array");
if ($sa_exec_dir eq "") {
# normal phrase table
$cmd .= "$scripts/training/filter-model-given-input.pl";

View File

@ -1839,13 +1839,21 @@ sub create_ini {
$basic_weight_count++ if defined($_SCORE_OPTIONS) && $_SCORE_OPTIONS =~ /LowCountFeature/; # low count feature
$basic_weight_count++ if $_PCFG;
foreach my $f (split(/\+/,$___TRANSLATION_FACTORS)) {
$num_of_ttables++;
my $ff = $f;
$ff =~ s/\-/ /;
my $file = "$___MODEL_DIR/".($_HIERARCHICAL?"rule-table":"phrase-table").($___NOT_FACTORED ? "" : ".$f").".gz";
$file = shift @SPECIFIED_TABLE if scalar(@SPECIFIED_TABLE);
my $phrase_table_impl = ($_HIERARCHICAL ? 6 : 0);
print INI "$phrase_table_impl $ff $basic_weight_count $file\n";
$num_of_ttables++;
my $ff = $f;
$ff =~ s/\-/ /;
my $file = "$___MODEL_DIR/".($_HIERARCHICAL?"rule-table":"phrase-table").($___NOT_FACTORED ? "" : ".$f").".gz";
print STDERR "HIEU:".$SPECIFIED_TABLE[0] ."\n";
my $phrase_table_impl;
if (scalar(@SPECIFIED_TABLE)) {
$file = shift @SPECIFIED_TABLE;
my @toks = split(/:/,$file);
$file = $toks[0];
$phrase_table_impl = $toks[1];
}
print INI "$phrase_table_impl $ff $basic_weight_count $file\n";
}
if ($_GLUE_GRAMMAR) {
&full_path(\$___GLUE_GRAMMAR_FILE);