Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <fishandfrolick@gmail.com>2012-06-07 18:46:58 +0400
committerHieu Hoang <fishandfrolick@gmail.com>2012-06-07 18:46:58 +0400
commit05fc5ffce36dd1ccf1a00ab247953743544683c0 (patch)
tree571d4d5dee2bb4fda890cc931edcee761926dfa3 /scripts
parent0b59bee21ca284c5225149c46f43430fccb4d854 (diff)
phrase table type deduced in experiment.perl. Passed to train-model.perl
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ems/experiment.perl34
-rwxr-xr-xscripts/training/train-model.perl22
2 files changed, 40 insertions, 16 deletions
diff --git a/scripts/ems/experiment.perl b/scripts/ems/experiment.perl
index 7774a8010..bd4bcd219 100755
--- a/scripts/ems/experiment.perl
+++ b/scripts/ems/experiment.perl
@@ -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";
diff --git a/scripts/training/train-model.perl b/scripts/training/train-model.perl
index 971cdbe06..77569256d 100755
--- a/scripts/training/train-model.perl
+++ b/scripts/training/train-model.perl
@@ -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);