Alternate graph code:

Now can specify an alternate path in the config file for experiment.perl
All you need to do is change the line: decoding-steps
Every : you add will mean that the next steps are in an alternate graph
Ie. 
	decoding-steps = " t0 , g1 , t1 "
will produce a single graph but
	decoding-steps = " t0 , g1 : t1 "
will produce two alternate graphs

The only change it actually makes is to the create configuration file.

This is also a bugfix!
There was no ability to have multiple factors in the target
for the two filering scripts. They just ignored those lines
as if they were not valid table descriptions.




git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1322 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
lexi_birch 2007-03-22 12:42:23 +00:00
parent 02bb5540cb
commit d20ae825f8
3 changed files with 15 additions and 13 deletions

View File

@ -60,7 +60,7 @@ while(<INI>) {
if (/ttable-file\]/) {
while(1) {
my $table_spec = <INI>;
if ($table_spec !~ /^([\d\,\-]+) ([\d\-]+) (\d+) (\S+)$/) {
if ($table_spec !~ /^([\d\,\-]+) ([\d\,\-]+) (\d+) (\S+)$/) {
print INI_OUT $table_spec;
last;
}

View File

@ -59,7 +59,7 @@ while(<INI>) {
if (/ttable-file\]/) {
while(1) {
my $table_spec = <INI>;
if ($table_spec !~ /^([\d\-]+) ([\d\-]+) (\d+) (\S+)$/) {
if ($table_spec !~ /^([\d\,\-]+) ([\d\,\-]+) (\d+) (\S+)$/) {
print INI_OUT $table_spec;
last;
}
@ -80,7 +80,7 @@ while(<INI>) {
elsif (/distortion-file/) {
while(1) {
my $table_spec = <INI>;
if ($table_spec !~ /^([\d\-]+) (\S+) (\d+) (\S+)$/) {
if ($table_spec !~ /^([\d\,\-]+) (\S+) (\d+) (\S+)$/) {
print INI_OUT $table_spec;
last;
}

View File

@ -1,7 +1,5 @@
#!/usr/bin/perl -w
# $Id$
use strict;
use Getopt::Long "GetOptions";
@ -263,8 +261,8 @@ die("format for generation factors is \"0-1\" or \"0-1+0-2\" or \"0-1+0,1-1,2\",
my $___DECODING_STEPS = "t0";
$___DECODING_STEPS = $_DECODING_STEPS if defined($_DECODING_STEPS);
die("format for decoding steps is \"t0,g0,t1,g1\", you provided $___DECODING_STEPS\n")
if defined $_DECODING_STEPS && $_DECODING_STEPS !~ /^[tg]\d+(,[tg]\d+)*$/;
die("format for decoding steps is \"t0,g0,t1,g1:t2\", you provided $___DECODING_STEPS\n")
if defined $_DECODING_STEPS && $_DECODING_STEPS !~ /^[tg]\d+(,[tg]\d+)*(:[tg]\d+(,[tg]\d+)*)*$/;
my ($factor,$factor_e,$factor_f);
@ -1346,12 +1344,16 @@ sub create_ini {
my %stepsused;
print INI "\n# mapping steps
[mapping]\n";
foreach (split(/,/,$___DECODING_STEPS)) {
s/t/T /g;
s/g/G /g;
my ($type, $num) = split /\s+/;
$stepsused{$type} = $num+1 if !defined $stepsused{$type} || $stepsused{$type} < $num+1;
print INI $_."\n";
my $steplist = 0;
foreach my $list (split(/:/,$___DECODING_STEPS)) {
foreach (split(/,/,$list)) {
s/t/T /g;
s/g/G /g;
my ($type, $num) = split /\s+/;
$stepsused{$type} = $num+1 if !defined $stepsused{$type} || $stepsused{$type} < $num+1;
print INI $steplist," ",$_,"\n";
}
$steplist++;
}
print INI "\n# translation tables: source-factors, target-factors, number of scores, file
[ttable-file]\n";