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:
authorskyload <skyload@1f5c12ca-751b-0410-a591-d2e778427230>2010-04-21 15:58:06 +0400
committerskyload <skyload@1f5c12ca-751b-0410-a591-d2e778427230>2010-04-21 15:58:06 +0400
commiteaba67e70ee3b970a20136710f1e6b99152617a0 (patch)
treebee21e74d25bef60c4731812d292ce966578353f
parent96dd3ecb50b509dd2f4d5373d3c956cfc0ab8480 (diff)
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/branches/DPR_MOSES@3161 1f5c12ca-751b-0410-a591-d2e778427230
-rw-r--r--regression-testing/.project11
-rw-r--r--regression-testing/MosesRegressionTesting.pm96
-rw-r--r--regression-testing/compare-results.pl84
-rw-r--r--regression-testing/run-single-test.pl160
-rw-r--r--regression-testing/run-test-suite.pl102
-rw-r--r--regression-testing/tests/basic-surface-binptable/filter-stderr.pl22
-rw-r--r--regression-testing/tests/basic-surface-binptable/filter-stdout.pl7
-rw-r--r--regression-testing/tests/basic-surface-binptable/moses.ini56
-rw-r--r--regression-testing/tests/basic-surface-binptable/to-translate.txt5
-rw-r--r--regression-testing/tests/basic-surface-binptable/truth/results.txt13
-rw-r--r--regression-testing/tests/basic-surface-only/filter-stderr.pl22
-rw-r--r--regression-testing/tests/basic-surface-only/filter-stdout.pl7
-rw-r--r--regression-testing/tests/basic-surface-only/moses.ini49
-rw-r--r--regression-testing/tests/basic-surface-only/to-translate.txt5
-rw-r--r--regression-testing/tests/basic-surface-only/truth/results.txt13
-rw-r--r--regression-testing/tests/confusionNet-multi-factor/filter-stderr.pl22
-rw-r--r--regression-testing/tests/confusionNet-multi-factor/filter-stdout.pl7
-rw-r--r--regression-testing/tests/confusionNet-multi-factor/moses.ini71
-rw-r--r--regression-testing/tests/confusionNet-multi-factor/to-translate.txt15
-rw-r--r--regression-testing/tests/confusionNet-multi-factor/truth/results.txt9
-rw-r--r--regression-testing/tests/confusionNet-surface-only/filter-stderr.pl22
-rw-r--r--regression-testing/tests/confusionNet-surface-only/filter-stdout.pl7
-rw-r--r--regression-testing/tests/confusionNet-surface-only/moses.ini60
-rw-r--r--regression-testing/tests/confusionNet-surface-only/to-translate.txt15
-rw-r--r--regression-testing/tests/confusionNet-surface-only/truth/results.txt9
-rw-r--r--regression-testing/tests/lattice-distortion/CMD1
-rw-r--r--regression-testing/tests/lattice-distortion/filter-nbest.pl12
-rw-r--r--regression-testing/tests/lattice-distortion/filter-stderr.pl22
-rw-r--r--regression-testing/tests/lattice-distortion/filter-stdout.pl7
-rw-r--r--regression-testing/tests/lattice-distortion/moses.ini64
-rw-r--r--regression-testing/tests/lattice-distortion/phrase-table8
-rw-r--r--regression-testing/tests/lattice-distortion/phrase-table.binphr.idxbin0 -> 68 bytes
-rw-r--r--regression-testing/tests/lattice-distortion/phrase-table.binphr.srctreebin0 -> 224 bytes
-rw-r--r--regression-testing/tests/lattice-distortion/phrase-table.binphr.srcvoc8
-rw-r--r--regression-testing/tests/lattice-distortion/phrase-table.binphr.tgtdatabin0 -> 192 bytes
-rw-r--r--regression-testing/tests/lattice-distortion/phrase-table.binphr.tgtvoc8
-rw-r--r--regression-testing/tests/lattice-distortion/small.lm86
-rw-r--r--regression-testing/tests/lattice-distortion/to-translate.txt7
-rw-r--r--regression-testing/tests/lattice-distortion/truth/results.txt53
-rw-r--r--regression-testing/tests/lattice-surface/filter-stderr.pl22
-rw-r--r--regression-testing/tests/lattice-surface/filter-stdout.pl7
-rw-r--r--regression-testing/tests/lattice-surface/moses.ini60
-rw-r--r--regression-testing/tests/lattice-surface/to-translate.txt4
-rw-r--r--regression-testing/tests/lattice-surface/truth/results.txt11
-rw-r--r--regression-testing/tests/lexicalized-reordering-cn/filter-stderr.pl22
-rw-r--r--regression-testing/tests/lexicalized-reordering-cn/filter-stdout.pl7
-rw-r--r--regression-testing/tests/lexicalized-reordering-cn/moses.ini69
-rw-r--r--regression-testing/tests/lexicalized-reordering-cn/to-translate.txt89
-rw-r--r--regression-testing/tests/lexicalized-reordering-cn/truth/results.txt9
-rw-r--r--regression-testing/tests/lexicalized-reordering/filter-stderr.pl22
-rw-r--r--regression-testing/tests/lexicalized-reordering/filter-stdout.pl7
-rw-r--r--regression-testing/tests/lexicalized-reordering/moses.ini63
-rw-r--r--regression-testing/tests/lexicalized-reordering/to-translate.txt5
-rw-r--r--regression-testing/tests/lexicalized-reordering/truth/results.txt13
-rw-r--r--regression-testing/tests/multi-factor-binptable/filter-stderr.pl22
-rw-r--r--regression-testing/tests/multi-factor-binptable/filter-stdout.pl7
-rw-r--r--regression-testing/tests/multi-factor-binptable/moses.ini68
-rw-r--r--regression-testing/tests/multi-factor-binptable/to-translate.txt1
-rw-r--r--regression-testing/tests/multi-factor-binptable/truth/results.txt5
-rw-r--r--regression-testing/tests/multi-factor-drop/dropize_phrase_table.pl29
-rw-r--r--regression-testing/tests/multi-factor-drop/filter-stderr.pl22
-rw-r--r--regression-testing/tests/multi-factor-drop/filter-stdout.pl7
-rw-r--r--regression-testing/tests/multi-factor-drop/moses.ini75
-rw-r--r--regression-testing/tests/multi-factor-drop/to-translate.txt1
-rw-r--r--regression-testing/tests/multi-factor-drop/truth/results.txt5
-rw-r--r--regression-testing/tests/multi-factor/filter-stderr.pl22
-rw-r--r--regression-testing/tests/multi-factor/filter-stdout.pl7
-rw-r--r--regression-testing/tests/multi-factor/moses.ini71
-rw-r--r--regression-testing/tests/multi-factor/to-translate.txt1
-rw-r--r--regression-testing/tests/multi-factor/truth/results.txt5
-rw-r--r--regression-testing/tests/nbest-multi-factor/filter-nbest.pl12
-rw-r--r--regression-testing/tests/nbest-multi-factor/filter-stderr.pl22
-rw-r--r--regression-testing/tests/nbest-multi-factor/filter-stdout.pl7
-rw-r--r--regression-testing/tests/nbest-multi-factor/moses.ini75
-rw-r--r--regression-testing/tests/nbest-multi-factor/to-translate.txt1
-rw-r--r--regression-testing/tests/nbest-multi-factor/truth/results.txt7
-rw-r--r--regression-testing/tests/perllib/RegTestUtils.pm31
-rw-r--r--regression-testing/tests/ptable-filtering/filter-stderr.pl29
-rw-r--r--regression-testing/tests/ptable-filtering/filter-stdout.pl2
-rw-r--r--regression-testing/tests/ptable-filtering/moses.ini59
-rw-r--r--regression-testing/tests/ptable-filtering/to-translate.txt1
-rw-r--r--regression-testing/tests/ptable-filtering/truth/results.txt22
-rw-r--r--regression-testing/tests/xml-markup/filter-nbest.pl12
-rw-r--r--regression-testing/tests/xml-markup/filter-stderr.pl22
-rw-r--r--regression-testing/tests/xml-markup/filter-stdout.pl7
-rw-r--r--regression-testing/tests/xml-markup/moses.ini57
-rw-r--r--regression-testing/tests/xml-markup/phrase-table22
-rw-r--r--regression-testing/tests/xml-markup/phrase-table.binphr.idxbin0 -> 100 bytes
-rw-r--r--regression-testing/tests/xml-markup/phrase-table.binphr.srctreebin0 -> 476 bytes
-rw-r--r--regression-testing/tests/xml-markup/phrase-table.binphr.srcvoc12
-rw-r--r--regression-testing/tests/xml-markup/phrase-table.binphr.tgtdatabin0 -> 428 bytes
-rw-r--r--regression-testing/tests/xml-markup/phrase-table.binphr.tgtvoc13
-rw-r--r--regression-testing/tests/xml-markup/to-translate.txt6
-rw-r--r--regression-testing/tests/xml-markup/truth/results.txt75
94 files changed, 2417 insertions, 0 deletions
diff --git a/regression-testing/.project b/regression-testing/.project
new file mode 100644
index 000000000..e7c3a7c3c
--- /dev/null
+++ b/regression-testing/.project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>regression-testing</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
diff --git a/regression-testing/MosesRegressionTesting.pm b/regression-testing/MosesRegressionTesting.pm
new file mode 100644
index 000000000..f80f23599
--- /dev/null
+++ b/regression-testing/MosesRegressionTesting.pm
@@ -0,0 +1,96 @@
+package MosesRegressionTesting;
+
+use strict;
+
+# if your tests need a new version of the test data, increment this
+# and make sure that a moses-regression-tests-vX.Y is available for
+# download from statmt.org (redpony AT umd dot edu for more info)
+use constant TESTING_DATA_VERSION => '2';
+
+# find the data directory in a few likely locations and make sure
+# that it is the correct version
+sub find_data_directory
+{
+ my ($test_script_root, $data_dir) = @_;
+ my $data_version = TESTING_DATA_VERSION;
+ my @ds = ();
+ my $mrtp = "moses-reg-test-data-$data_version";
+ push @ds, $data_dir if defined $data_dir;
+ push @ds, "$test_script_root/$mrtp";
+ push @ds, "/export/ws06osmt/regression-testing/$mrtp";
+ push @ds, "/tmp/$mrtp";
+ push @ds, "/var/tmp/$mrtp";
+ foreach my $d (@ds) {
+ next unless (-d $d);
+ if (!-d "$d/models") {
+ print STDERR "Found $d but it is malformed: missing subdir models/\n";
+ next;
+ }
+ if (!-d "$d/lm") {
+ print STDERR "Found $d but it is malformed: missing subdir lm/\n";
+ next;
+ }
+ return $d;
+ }
+ print STDERR<<EOT;
+
+You do not appear to have the regression testing data installed. You may
+either specify a non-standard location when running the test suite with
+the --data-dir option, or, you may install it in any one of the following
+standard locations: $test_script_root, /tmp, or /var/tmp with these
+commands:
+
+ cd <DESIRED_INSTALLATION_DIRECTORY>
+ wget http://www.statmt.org/moses/reg-testing/moses-reg-test-data-$data_version.tgz
+ tar xzf moses-reg-test-data-$data_version.tgz
+ rm moses-reg-test-data-$data_version.tgz
+
+EOT
+ exit 1;
+}
+
+
+sub get_localized_moses_ini
+{
+ use File::Temp;
+ my ($moses_ini, $data_dir) = @_;
+ my $LM_PATH = "$data_dir/lm";
+ my $MODEL_PATH = "$data_dir/models";
+ use Cwd qw/ abs_path /; use File::Basename; my $TEST_PATH = dirname(abs_path($moses_ini));
+ my $local_moses_ini = new File::Temp( UNLINK => 0, SUFFIX => '.ini' );
+
+ open MI, "<$moses_ini" or die "Couldn't read $moses_ini";
+ open MO, ">$local_moses_ini" or die "Couldn't open $local_moses_ini for writing";
+ while (my $l = <MI>) {
+ $l =~ s/\$\{LM_PATH\}/$LM_PATH/g;
+ $l =~ s/\$\{MODEL_PATH\}/$MODEL_PATH/g;
+ $l =~ s/\$\{TEST_PATH\}/$TEST_PATH/g;
+ print $local_moses_ini $l;
+ }
+ close MO;
+ close MI;
+
+ return $local_moses_ini->filename;
+}
+
+sub get_nbestlist
+{
+ my ($moses_ini) = @_;
+ my $nbestfile = undef;
+ my $nbestsize = undef;
+
+ open MI, "<$moses_ini" or die "Couldn't read $moses_ini";
+ while (my $l = <MI>) {
+ if ($l =~ /\[n-best-list\]/i){
+ chomp($nbestfile = <MI>);
+ chomp($nbestsize = <MI>);
+ }
+ }
+ close MI;
+
+ return ($nbestfile,$nbestsize);
+}
+
+
+1;
+
diff --git a/regression-testing/compare-results.pl b/regression-testing/compare-results.pl
new file mode 100644
index 000000000..eed5e45a5
--- /dev/null
+++ b/regression-testing/compare-results.pl
@@ -0,0 +1,84 @@
+#!/usr/bin/perl -w
+
+# $Id: compare-results.pl 1344 2007-04-06 17:07:54Z hieuhoang1972 $
+
+use strict;
+my ($results, $truth) = @ARGV;
+
+my ($report, $pass, $fail) = compare_results("$results/results.txt", "$truth/results.txt");
+open OUT, ">$results/Summary";
+print OUT $report;
+print $report;
+close OUT;
+
+if ($fail > 0) {
+ print <<EOT;
+
+There were failures in this test run. Please analyze the results carefully.
+
+EOT
+ exit 1;
+}
+exit 0;
+
+sub compare_results {
+ my ($testf, $truthf) = @_;
+ my $test = read_results($testf);
+ my $truth = read_results($truthf);
+ my $ct1 = delete $truth->{'COMPARISON_TYPE'};
+ my $ct2 = delete $test->{'COMPARISON_TYPE'};
+ my $pass = 0;
+ my $fail = 0;
+ my $report = '';
+ foreach my $k (sort keys %$truth) {
+ $report .= "test-name=$k\tresult=";
+ if (!exists $test->{$k}) {
+ $report .= "missing from test results\n";
+ $fail++;
+ next;
+ }
+ my $truthv = $truth->{$k} || '';
+ my $testv = delete $test->{$k} || '';
+ if ($ct1->{$k} eq '=') {
+ if ($truthv eq $testv) {
+ $report .= "pass\n";
+ $pass++;
+ } else {
+ $report .= "fail\n\tTRUTH=$truthv\n\t TEST=$testv\n";
+ $fail++;
+ }
+ } else { # numeric difference
+ my $diff = $testv - $truthv;
+ if ($diff == 0) { $report .= "identical\n"; next; }
+ $report .= "BASELINE=$truthv, TEST=$testv\t DELTA=$diff";
+ if ($truthv != 0) {
+ my $pct = $diff/$truthv;
+ my $t = sprintf "\t PCT CHANGE=%4.2f", $pct*100;
+ $report .= $t;
+ }
+ $report .= "\n";
+ }
+ }
+ foreach my $k (sort keys %$test) {
+ $fail++;
+ $report .= "test-name=$k\tfound in TEST but not in TRUTH.\n";
+ }
+ $report .= "\nTESTS PASSED=$pass\nTESTS FAILED=$fail\n";
+ return $report, $pass, $fail;
+}
+
+sub read_results {
+ my ($file) = @_;
+ open IN, "<$file" or die "Could not open $file!";
+ my %res;
+ while (my $l = <IN>) {
+ if ($l =~ /^([A-Za-z0-9_]+)\s*([=~])\s*(.+)$/) {
+ my ($key, $comparison_type, $value) = ($1, $2, $3);
+ $res{$key} = $value;
+ $res{'COMPARISON_TYPE'}->{$key}=$comparison_type;
+ }
+ }
+ close IN;
+ return \%res;
+}
+
diff --git a/regression-testing/run-single-test.pl b/regression-testing/run-single-test.pl
new file mode 100644
index 000000000..cf5008164
--- /dev/null
+++ b/regression-testing/run-single-test.pl
@@ -0,0 +1,160 @@
+#!/usr/bin/perl -w
+
+# $Id: run-single-test.pl 1344 2007-04-06 17:07:54Z hieuhoang1972 $
+
+use strict;
+my $script_dir; BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, $script_dir; }
+use MosesRegressionTesting;
+use Getopt::Long;
+use File::Temp qw ( tempfile );
+use POSIX qw ( strftime );
+my @SIGS = qw ( SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP SIGABRT SIGIOT SIGBUS SIGFPE SIGKILL SIGUSR1 SIGSEGV SIGUSR2 SIGPIPE SIGALRM SIGTERM SIGSTKFLT SIGCHLD SIGCONT SIGSTOP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGXCPU SIGXFSZ SIGVTALRM SIGPROF SIGWINCH SIGIO SIGPWR SIGSYS SIGUNUSED SIGRTMIN );
+my ($decoder, $test_name);
+
+my $test_dir = "$script_dir/tests";
+my $data_dir;
+my $BIN_TEST = $script_dir;
+my $results_dir;
+my $NBEST = 0;
+
+GetOptions("decoder=s" => \$decoder,
+ "test=s" => \$test_name,
+ "data-dir=s"=> \$data_dir,
+ "test-dir=s"=> \$test_dir,
+ "results-dir=s"=> \$results_dir,
+ ) or exit 1;
+
+die "Please specify a decoder with --decoder\n" unless $decoder;
+die "Please specify a test to run with --test\n" unless $test_name;
+
+die "Please specify the location of the data directory with --data-dir\n" unless $data_dir;
+
+die "Cannot locate test dir at $test_dir" unless (-d $test_dir);
+
+$test_dir .= "/$test_name";
+die "Cannot locate test dir at $test_dir" unless (-d $test_dir);
+
+#### get place to put results
+unless (defined $results_dir) { $results_dir = "$data_dir/results"; }
+if (!-d $results_dir) {
+ print STDERR "[WARNING] Results directory not found.\n";
+ mkdir ($results_dir) || die "Failed to create $results_dir";
+}
+$results_dir .= "/$test_name";
+if (!-d $results_dir) {
+ print STDERR "[WARNING] Results directory for test=$test_name could not be found.\n";
+ mkdir ($results_dir) || die "Failed to create $results_dir";
+}
+##########
+
+my $conf = "$test_dir/moses.ini";
+my $input = "$test_dir/to-translate.txt";
+
+die "Cannot locate executable called $decoder\n" unless (-x $decoder);
+die "Cannot find $conf\n" unless (-f $conf);
+die "Cannot locate input at $input" unless (-f $input);
+
+my $local_moses_ini = MosesRegressionTesting::get_localized_moses_ini($conf, $data_dir);
+my ($nbestfile,$nbestsize) = MosesRegressionTesting::get_nbestlist($conf);
+
+if (defined($nbestsize) && $nbestsize > 0){
+ $NBEST=$nbestsize;
+}
+
+my $ts = get_timestamp($decoder);
+my $results = "$results_dir/$ts";
+mkdir($results) || die "Failed to create results directory: $results\n";
+
+my $truth = "$test_dir/truth";
+if (!-d $truth) {
+ die "Could not find truth/ in $test_dir!\n";
+}
+
+print "RESULTS AVAILABLE IN: $results\n\n";
+
+my ($o, $elapsed, $ec, $sig) = exec_moses($decoder, $local_moses_ini, $input, $results);
+my $error = ($sig || $ec > 0);
+if ($error) {
+ open OUT, ">$results/Summary";
+ print STDERR "MOSES CRASHED.\n\texit_code=$ec\n\tsignal=$sig\n";
+ print OUT "MOSES CRASHED.\n\texit_code=$ec\n\tsignal=$sig\n";
+ print STDERR "FAILURE, for debugging, local moses.ini=$local_moses_ini\n";
+ print OUT "FAILURE, for debugging, local moses.ini=$local_moses_ini\n";
+ close OUT;
+ exit 2 if $sig;
+ exit 3;
+}
+
+($o, $ec, $sig) = run_command("$test_dir/filter-stdout.pl $results/run.stdout > $results/results.txt");
+warn "filter-stdout failed!" if ($ec > 0 || $sig);
+($o, $ec, $sig) = run_command("$test_dir/filter-stderr.pl $results/run.stderr >> $results/results.txt");
+warn "filter-stderr failed!" if ($ec > 0 || $sig);
+
+if($NBEST > 0){
+ ($o, $ec, $sig) = run_command("$test_dir/filter-nbest.pl $results/run.nbest >> $results/results.txt");
+ warn "filter-nbest failed!" if ($ec > 0 || $sig);
+}
+
+open OUT, ">>$results/results.txt";
+print OUT "TOTAL_WALLTIME ~ $elapsed\n";
+close OUT;
+
+run_command("gzip $results/run.stdout");
+run_command("gzip $results/run.stderr");
+if($NBEST > 0){
+ run_command("gzip $results/run.nbest");
+}
+
+($o, $ec, $sig) = run_command("$BIN_TEST/compare-results.pl $results $truth");
+print $o;
+if ($ec) {
+ print STDERR "FAILURE, for debugging, local moses.ini=$local_moses_ini\n";
+ exit 1;
+}
+
+unlink $local_moses_ini or warn "Couldn't remove $local_moses_ini\n";
+exit 0;
+
+sub exec_moses {
+ my ($decoder, $conf, $input, $results) = @_;
+ my $start_time = time;
+ my ($o, $ec, $sig);
+ if ($NBEST > 0){
+ print STDERR "Nbest output file is $results/run.nbest\n";
+ print STDERR "Nbest size is $NBEST\n";
+ ($o, $ec, $sig) = run_command("$decoder -f $conf -i $input -n-best-list $results/run.nbest $NBEST 1> $results/run.stdout 2> $results/run.stderr");
+ }
+ else{
+ ($o, $ec, $sig) = run_command("$decoder -f $conf -i $input 1> $results/run.stdout 2> $results/run.stderr");
+ }
+ my $elapsed = time - $start_time;
+ return ($o, $elapsed, $ec, $sig);
+}
+
+sub run_command {
+ my ($cmd) = @_;
+ my $o = `$cmd`;
+ my $exit_code = $? >> 8;
+
+ my $signal = $? & 127;
+ my $core_dumped = $? & 128;
+ if ($signal) { $signal = sig_name($signal); }
+ return $o, $exit_code, $signal;
+}
+
+sub sig_name {
+ my $sig = shift;
+ return $SIGS[$sig];
+}
+
+sub get_timestamp {
+ my ($file) = @_;
+ my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
+ $atime,$mtime,$ctime,$blksize,$blocks)
+ = stat($file);
+ my $timestamp = strftime("%Y%m%d-%H%M%S", gmtime $mtime);
+ my $timestamp2 = strftime("%Y%m%d-%H%M%S", gmtime);
+ my $username = `whoami`; chomp $username;
+ return "moses.v$timestamp-$username-at-$timestamp2";
+}
+
diff --git a/regression-testing/run-test-suite.pl b/regression-testing/run-test-suite.pl
new file mode 100644
index 000000000..becde393d
--- /dev/null
+++ b/regression-testing/run-test-suite.pl
@@ -0,0 +1,102 @@
+#!/usr/bin/perl -w
+
+# $Id: run-test-suite.pl 2236 2009-03-12 16:52:27Z redpony $
+
+use strict;
+my $script_dir; BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, $script_dir; }
+use Getopt::Long;
+
+############################################################
+my @tests = qw (
+ basic-surface-only
+ ptable-filtering
+ multi-factor
+ multi-factor-drop
+ confusionNet-surface-only
+ confusionNet-multi-factor
+ basic-surface-binptable
+ multi-factor-binptable
+ nbest-multi-factor
+ lattice-surface
+ lattice-distortion
+ lexicalized-reordering
+ lexicalized-reordering-cn
+);
+# xml-markup
+
+############################################################
+use MosesRegressionTesting;
+use File::Temp qw ( tempfile );
+use POSIX qw ( strftime );
+
+my $decoder;
+my $test_dir;
+my $BIN_TEST = $script_dir;
+my $data_dir;
+
+GetOptions("decoder=s" => \$decoder,
+ "data-dir=s" => \$data_dir,
+ ) or exit 1;
+
+$data_dir = MosesRegressionTesting::find_data_directory($BIN_TEST, $data_dir);
+
+my $test_run = "$BIN_TEST/run-single-test.pl --data-dir=$data_dir";
+$test_dir = $script_dir . "/tests";
+$test_run .= " --test-dir=$test_dir" if $test_dir;
+
+print "Data directory: $data_dir\n";
+
+die "Please specify a decoder to test with --decoder\n" unless $decoder;
+
+die "Cannot locate executable called $decoder\n" unless (-x $decoder);
+
+$test_run .= " --decoder=$decoder";
+
+print "Running tests: @tests\n\n";
+
+print "TEST NAME STATUS PATH TO RESULTS\n";
+my $lb = "---------------------------------------------------------------------------------------------------------\n";
+print $lb;
+
+my $fail = 0;
+my @failed;
+foreach my $test (@tests) {
+ my $cmd = "$test_run --test=$test";
+ my ($res, $output, $results_path) = do_test($cmd);
+ format STDOUT =
+@<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+$test, $res, $results_path
+.
+ write;
+ if ($res eq 'FAIL') {
+ print "$lb$output$lb";
+ $fail++;
+ push @failed, $test;
+ } else {
+# TOTAL_WALLTIME result=BASELINE=11, TEST=12 DELTA=1 PCT CHANGE=9.09
+ if ($output =~ /TOTAL_WALLTIME\s+result\s*=\s*([^\n]+)/o) {
+ print "\t\tTiming statistics: $1\n";
+ }
+ }
+}
+
+my $total = scalar @tests;
+my $fail_percentage = int(100 * $fail / $total);
+my $pass_percentage = int(100 * ($total-$fail) / $total);
+print "\n$pass_percentage% of the tests passed.\n";
+print "$fail_percentage% of the tests failed.\n";
+if ($fail_percentage>0) { print "\nPLEASE INVESTIAGE THESE FAILED TESTS: @failed\n"; }
+
+sub do_test {
+ my ($test) = @_;
+ my $o = `$test 2>&1`;
+ my $res = 'PASS';
+ $res = 'FAIL' if ($? > 0);
+ my $od = '';
+ if ($o =~ /RESULTS AVAILABLE IN: (.*)$/m) {
+ $od = $1;
+ $o =~ s/^RESULTS AVAIL.*$//mo;
+ }
+ return ($res, $o, $od);
+}
+
diff --git a/regression-testing/tests/basic-surface-binptable/filter-stderr.pl b/regression-testing/tests/basic-surface-binptable/filter-stderr.pl
new file mode 100644
index 000000000..d8df4b2c7
--- /dev/null
+++ b/regression-testing/tests/basic-surface-binptable/filter-stderr.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, "$script_dir/../perllib"; }
+use RegTestUtils;
+
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^Finished loading LanguageModels/) {
+ my $time = RegTestUtils::readTime($_);
+ print "LMLOAD_TIME ~ $time\n";
+ }
+ if (/^Finished loading phrase tables/) {
+ my $time = RegTestUtils::readTime($_);
+ print "PTLOAD_TIME ~ $time\n";
+ }
+ next unless /^BEST TRANSLATION:/;
+ my $pscore = RegTestUtils::readHypoScore($_);
+ $x++;
+ print "SCORE_$x = $pscore\n";
+}
diff --git a/regression-testing/tests/basic-surface-binptable/filter-stdout.pl b/regression-testing/tests/basic-surface-binptable/filter-stdout.pl
new file mode 100644
index 000000000..ab6c47077
--- /dev/null
+++ b/regression-testing/tests/basic-surface-binptable/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ $x++;
+ print "TRANSLATION_$x=$_\n";
+}
diff --git a/regression-testing/tests/basic-surface-binptable/moses.ini b/regression-testing/tests/basic-surface-binptable/moses.ini
new file mode 100644
index 000000000..9b5bf9ba3
--- /dev/null
+++ b/regression-testing/tests/basic-surface-binptable/moses.ini
@@ -0,0 +1,56 @@
+# Moses configuration file
+# automatic exodus from pharaoh.ini Wed Jul 12 18:24:14 EDT 2006
+
+###########################
+### PHARAOH CONFIG FILE ###
+###########################
+
+# phrase table f, n, p(n|f)
+[ttable-file]
+0 0 5 ${MODEL_PATH}/basic-surface-binptable/phrase-table.gz
+
+# language model
+[lmodel-file]
+0 0 3 ${LM_PATH}/europarl.en.srilm.gz
+
+# limit on how many phrase translations e for each phrase f are loaded
+[ttable-limit]
+#ttable element load limit 0 = all elements loaded
+20
+
+# distortion (reordering) weight
+[weight-d]
+0.141806519223522
+
+# language model weight
+[weight-l]
+0.142658800199951
+
+# translation model weight (phrase translation, lexical weighting)
+[weight-t]
+0.00402447059454402
+0.0685647475075862
+0.294089113124688
+0.0328320356515851
+-0.0426081987467227
+
+# word penalty
+[weight-w]
+-0.273416114951401
+
+[distortion-limit]
+4
+
+[beam-threshold]
+0.03
+
+[input-factors]
+0
+
+[mapping]
+T 0
+
+
+[verbose]
+2
+
diff --git a/regression-testing/tests/basic-surface-binptable/to-translate.txt b/regression-testing/tests/basic-surface-binptable/to-translate.txt
new file mode 100644
index 000000000..806490837
--- /dev/null
+++ b/regression-testing/tests/basic-surface-binptable/to-translate.txt
@@ -0,0 +1,5 @@
+ich frage sie also , herr prsident : stellen die unterschiedlichen arbeitskosten somit nicht auch eine beschrnkung des freien wettbewerbs in der europischen union dar ?
+schaut man sich die flligkeitsplne der ausfhrung des haushalts fr die rubriken 2 , 3 , 4 und 7 an , stellt man fest , dass nur durchschnittlich 8 % aller verpflichtungen durch zahlungen gedeckt sind .
+vor drei jahren haben wir mit unserer beschftigungsinitiative begonnen , indem wir kleinen und mittleren unternehmen halfen , chancenkapital zu bekommen .
+das parlament will das auf zweierlei weise tun .
+nur dann werden die europischen institutionen auch ihrem auftrag gerecht .
diff --git a/regression-testing/tests/basic-surface-binptable/truth/results.txt b/regression-testing/tests/basic-surface-binptable/truth/results.txt
new file mode 100644
index 000000000..569a399ae
--- /dev/null
+++ b/regression-testing/tests/basic-surface-binptable/truth/results.txt
@@ -0,0 +1,13 @@
+TRANSLATION_1=i ask you , therefore , mr president , the different labour costs are therefore not a restriction of free competition in the european union ?
+TRANSLATION_2=if we look at the flligkeitsplne the implementation of the budget for the categories 2 , 3 , 4 and 7 to , we see that only an average of 8 % of commitments by payments are met .
+TRANSLATION_3=three years ago our employment strategy , we started by small and medium-sized enterprises halfen , chancenkapital to obtain .
+TRANSLATION_4=parliament wants the in two ways .
+TRANSLATION_5=only then will the european institutions to its mandate .
+LMLOAD_TIME ~ 10.00
+PTLOAD_TIME ~ 10.00
+SCORE_1 = -14.843
+SCORE_2 = -133.757
+SCORE_3 = -240.241
+SCORE_4 = -5.995
+SCORE_5 = -7.015
+TOTAL_WALLTIME ~ 23
diff --git a/regression-testing/tests/basic-surface-only/filter-stderr.pl b/regression-testing/tests/basic-surface-only/filter-stderr.pl
new file mode 100644
index 000000000..d8df4b2c7
--- /dev/null
+++ b/regression-testing/tests/basic-surface-only/filter-stderr.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, "$script_dir/../perllib"; }
+use RegTestUtils;
+
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^Finished loading LanguageModels/) {
+ my $time = RegTestUtils::readTime($_);
+ print "LMLOAD_TIME ~ $time\n";
+ }
+ if (/^Finished loading phrase tables/) {
+ my $time = RegTestUtils::readTime($_);
+ print "PTLOAD_TIME ~ $time\n";
+ }
+ next unless /^BEST TRANSLATION:/;
+ my $pscore = RegTestUtils::readHypoScore($_);
+ $x++;
+ print "SCORE_$x = $pscore\n";
+}
diff --git a/regression-testing/tests/basic-surface-only/filter-stdout.pl b/regression-testing/tests/basic-surface-only/filter-stdout.pl
new file mode 100644
index 000000000..ab6c47077
--- /dev/null
+++ b/regression-testing/tests/basic-surface-only/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ $x++;
+ print "TRANSLATION_$x=$_\n";
+}
diff --git a/regression-testing/tests/basic-surface-only/moses.ini b/regression-testing/tests/basic-surface-only/moses.ini
new file mode 100644
index 000000000..be5080b84
--- /dev/null
+++ b/regression-testing/tests/basic-surface-only/moses.ini
@@ -0,0 +1,49 @@
+# moses.ini for regression test
+
+[ttable-file]
+0 0 5 ${MODEL_PATH}/basic-surface-only/phrase-table.gz
+
+# language model
+[lmodel-file]
+0 0 3 ${LM_PATH}/europarl.en.srilm.gz
+# limit on how many phrase translations e for each phrase f are loaded
+[ttable-limit]
+#ttable element load limit 0 = all elements loaded
+20
+
+# distortion (reordering) weight
+[weight-d]
+0.141806519223522
+
+# language model weight
+[weight-l]
+0.142658800199951
+
+# translation model weight (phrase translation, lexical weighting)
+[weight-t]
+0.00402447059454402
+0.0685647475075862
+0.294089113124688
+0.0328320356515851
+-0.0426081987467227
+
+# word penalty
+[weight-w]
+-0.273416114951401
+
+[distortion-limit]
+4
+
+[beam-threshold]
+0.03
+
+[input-factors]
+0
+
+[mapping]
+T 0
+
+
+[verbose]
+2
+
diff --git a/regression-testing/tests/basic-surface-only/to-translate.txt b/regression-testing/tests/basic-surface-only/to-translate.txt
new file mode 100644
index 000000000..806490837
--- /dev/null
+++ b/regression-testing/tests/basic-surface-only/to-translate.txt
@@ -0,0 +1,5 @@
+ich frage sie also , herr prsident : stellen die unterschiedlichen arbeitskosten somit nicht auch eine beschrnkung des freien wettbewerbs in der europischen union dar ?
+schaut man sich die flligkeitsplne der ausfhrung des haushalts fr die rubriken 2 , 3 , 4 und 7 an , stellt man fest , dass nur durchschnittlich 8 % aller verpflichtungen durch zahlungen gedeckt sind .
+vor drei jahren haben wir mit unserer beschftigungsinitiative begonnen , indem wir kleinen und mittleren unternehmen halfen , chancenkapital zu bekommen .
+das parlament will das auf zweierlei weise tun .
+nur dann werden die europischen institutionen auch ihrem auftrag gerecht .
diff --git a/regression-testing/tests/basic-surface-only/truth/results.txt b/regression-testing/tests/basic-surface-only/truth/results.txt
new file mode 100644
index 000000000..04d07b063
--- /dev/null
+++ b/regression-testing/tests/basic-surface-only/truth/results.txt
@@ -0,0 +1,13 @@
+TRANSLATION_1=i ask you , therefore , mr president , the different labour costs are therefore not a restriction of free competition in the european union ?
+TRANSLATION_2=if we look at the flligkeitsplne the implementation of the budget for the categories 2 , 3 , 4 and 7 to , we see that only an average of 8 % of commitments by payments are met .
+TRANSLATION_3=three years ago our employment strategy , we started by small and medium-sized enterprises halfen , chancenkapital to obtain .
+TRANSLATION_4=parliament wants the in two ways .
+TRANSLATION_5=only then will the european institutions to its mandate .
+LMLOAD_TIME ~ 8.00
+PTLOAD_TIME ~ 9.00
+SCORE_1 = -14.843
+SCORE_2 = -133.757
+SCORE_3 = -240.241
+SCORE_4 = -5.995
+SCORE_5 = -7.015
+TOTAL_WALLTIME ~ 28
diff --git a/regression-testing/tests/confusionNet-multi-factor/filter-stderr.pl b/regression-testing/tests/confusionNet-multi-factor/filter-stderr.pl
new file mode 100644
index 000000000..2f6e17607
--- /dev/null
+++ b/regression-testing/tests/confusionNet-multi-factor/filter-stderr.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, "$script_dir/../perllib"; }
+use RegTestUtils;
+
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^Finished loading LanguageModels/) {
+ my $time = RegTestUtils::readTime($_);
+ print "LMLOAD_TIME ~ $time\n";
+ }
+ if (/^Finished loading phrase tables/) {
+ my $time = RegTestUtils::readTime($_);
+ print "PTLOAD_TIME ~ $time\n";
+ }
+ next unless /^BEST TRANSLATION:/;
+ my $pscore = RegTestUtils::readHypoScore($_);
+ $x++;
+ print "SCORE_$x = $pscore\n";
+}
diff --git a/regression-testing/tests/confusionNet-multi-factor/filter-stdout.pl b/regression-testing/tests/confusionNet-multi-factor/filter-stdout.pl
new file mode 100644
index 000000000..476ddf6e9
--- /dev/null
+++ b/regression-testing/tests/confusionNet-multi-factor/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ $x++;
+ print "TRANSLATION_$x=$_\n";
+}
diff --git a/regression-testing/tests/confusionNet-multi-factor/moses.ini b/regression-testing/tests/confusionNet-multi-factor/moses.ini
new file mode 100644
index 000000000..3c056f6f3
--- /dev/null
+++ b/regression-testing/tests/confusionNet-multi-factor/moses.ini
@@ -0,0 +1,71 @@
+[input-factors]
+0
+1
+
+[mapping]
+T 0
+G 0
+T 1
+
+[inputtype]
+1
+
+[lmodel-file]
+0 0 3 ${LM_PATH}/europarl.en.srilm.gz
+
+[ttable-file]
+0 0 5 ${MODEL_PATH}/multi-factor-binptable/phrase-table.0-0.gz
+1 1 5 ${MODEL_PATH}/multi-factor-binptable/phrase-table.1-1.gz
+
+# generation models: source-factors, target-factors, number-of-weights, filename
+[generation-file]
+0 1 2 ${MODEL_PATH}/multi-factor-binptable/generation.0-1.gz
+
+[weight-i]
+1.0
+-1.0
+
+[weight-w]
+1.0
+
+[weight-l]
+1.0
+
+[weight-t]
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+1.0
+
+[weight-d]
+1.0
+
+[weight-generation]
+1.0
+1.0
+
+[ttable-limit]
+20
+0
+
+[beam-threshold]
+0.0003
+
+[distortion-limit]
+10
+
+[stack]
+1000
+
+[ttable-threshold]
+5e-07
+
+[verbose]
+2
+
diff --git a/regression-testing/tests/confusionNet-multi-factor/to-translate.txt b/regression-testing/tests/confusionNet-multi-factor/to-translate.txt
new file mode 100644
index 000000000..d08755644
--- /dev/null
+++ b/regression-testing/tests/confusionNet-multi-factor/to-translate.txt
@@ -0,0 +1,15 @@
+damit|PROADV 1.0
+ist|VSFIN 1.0 war|VSFIN 1.0 sei|VSFIN 1.0
+der|ART 1.0 die|ART 1.0 das|ART 1.0
+arbeitsplan|NN 1.0
+
+damit|PROADV 1.0 dies|PROADV 1.0
+ist|VSFIN 1.0 war|VSFIN 1.0 sei|VSFIN 1.0 ist|VVFIN 1.0 war|VVFIN 1.0 sei|VVFIN 1.0
+der|ART 1.0 die|ART 1.0 das|ART 1.0 der|DT 1.0 die|DT 1.0 das|DT 1.0
+arbeitsplan|NN 1.0
+
+damit|PROADV 1.0 dies|PROADV 0.0
+ist|VSFIN 1.0 war|VSFIN 1.0 sei|VSFIN 1.0 dies|PROADV 0.0 das|DT 0.0
+der|ART 1.0 die|ART 1.0 das|ART 1.0 dies|PROADV 0.0
+arbeitsplan|NN 1.0 dies|PROADV 0.0
+
diff --git a/regression-testing/tests/confusionNet-multi-factor/truth/results.txt b/regression-testing/tests/confusionNet-multi-factor/truth/results.txt
new file mode 100644
index 000000000..49cbe55be
--- /dev/null
+++ b/regression-testing/tests/confusionNet-multi-factor/truth/results.txt
@@ -0,0 +1,9 @@
+TRANSLATION_1=that is the order of business
+TRANSLATION_2=this is the order of business
+TRANSLATION_3=that is the order of business
+LMLOAD_TIME ~ 10.00
+PTLOAD_TIME ~ 10.00
+SCORE_1 = -93.671
+SCORE_2 = -85.300
+SCORE_3 = -93.671
+TOTAL_WALLTIME ~ 11
diff --git a/regression-testing/tests/confusionNet-surface-only/filter-stderr.pl b/regression-testing/tests/confusionNet-surface-only/filter-stderr.pl
new file mode 100644
index 000000000..d8df4b2c7
--- /dev/null
+++ b/regression-testing/tests/confusionNet-surface-only/filter-stderr.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, "$script_dir/../perllib"; }
+use RegTestUtils;
+
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^Finished loading LanguageModels/) {
+ my $time = RegTestUtils::readTime($_);
+ print "LMLOAD_TIME ~ $time\n";
+ }
+ if (/^Finished loading phrase tables/) {
+ my $time = RegTestUtils::readTime($_);
+ print "PTLOAD_TIME ~ $time\n";
+ }
+ next unless /^BEST TRANSLATION:/;
+ my $pscore = RegTestUtils::readHypoScore($_);
+ $x++;
+ print "SCORE_$x = $pscore\n";
+}
diff --git a/regression-testing/tests/confusionNet-surface-only/filter-stdout.pl b/regression-testing/tests/confusionNet-surface-only/filter-stdout.pl
new file mode 100644
index 000000000..ab6c47077
--- /dev/null
+++ b/regression-testing/tests/confusionNet-surface-only/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ $x++;
+ print "TRANSLATION_$x=$_\n";
+}
diff --git a/regression-testing/tests/confusionNet-surface-only/moses.ini b/regression-testing/tests/confusionNet-surface-only/moses.ini
new file mode 100644
index 000000000..fffe068af
--- /dev/null
+++ b/regression-testing/tests/confusionNet-surface-only/moses.ini
@@ -0,0 +1,60 @@
+# Moses configuration file
+# automatic exodus from pharaoh.ini Wed Jul 12 18:24:14 EDT 2006
+
+###########################
+### PHARAOH CONFIG FILE ###
+###########################
+
+# phrase table f, n, p(n|f)
+[ttable-file]
+0 0 5 ${MODEL_PATH}/confusionNet-surface-only/phrase-table.0-0
+
+# language model
+[lmodel-file]
+0 0 3 ${LM_PATH}/europarl.en.srilm.gz
+# limit on how many phrase translations e for each phrase f are loaded
+[ttable-limit]
+#ttable element load limit 0 = all elements loaded
+20
+
+# distortion (reordering) weight
+[weight-d]
+0.141806519223522
+
+# language model weight
+[weight-l]
+0.142658800199951
+
+# translation model weight (phrase translation, lexical weighting)
+[weight-t]
+0.00402447059454402
+0.0685647475075862
+0.294089113124688
+0.0328320356515851
+-0.0426081987467227
+
+# word penalty
+[weight-w]
+-0.273416114951401
+
+[distortion-limit]
+4
+
+[beam-threshold]
+0.03
+
+[input-factors]
+0
+
+[mapping]
+T 0
+
+[inputtype]
+1
+
+[weight-i]
+1.0
+
+[verbose]
+2
+
diff --git a/regression-testing/tests/confusionNet-surface-only/to-translate.txt b/regression-testing/tests/confusionNet-surface-only/to-translate.txt
new file mode 100644
index 000000000..f611e1c55
--- /dev/null
+++ b/regression-testing/tests/confusionNet-surface-only/to-translate.txt
@@ -0,0 +1,15 @@
+damit|PROADV 1.0
+ist|VSFIN 1.0 war|VSFIN 1.0 sei|VSFIN 1.0
+der|ART 1.0 die|ART 1.0 das|ART 1.0
+arbeitsplan|NN 1.0
+
+damit|PROADV 1.0 dies|PROADV 1.0
+ist|VSFIN 1.0 war|VSFIN 1.0 sei|VSFIN 1.0 ist|VVFIN 1.0 war|VVFIN 1.0 sei|VVFIN 1.0
+der|ART 1.0 die|ART 1.0 das|ART 1.0 der|DT 1.0 die|DT 1.0 das|DT 1.0
+arbeitsplan|NN 1.0
+
+damit|PROADV 1.0 dies|PROADV 0.0
+ist|VSFIN 1.0 war|VSFIN 1.0 sei|VSFIN 1.0 dies|PROADV 0.0 das|DT 0.0
+der|ART 1.0 die|ART 1.0 das|ART 1.0 dies|PROADV 0.0
+arbeitsplan|NN 1.0 dies|PROADV 0.0
+
diff --git a/regression-testing/tests/confusionNet-surface-only/truth/results.txt b/regression-testing/tests/confusionNet-surface-only/truth/results.txt
new file mode 100644
index 000000000..fa8bd3cdd
--- /dev/null
+++ b/regression-testing/tests/confusionNet-surface-only/truth/results.txt
@@ -0,0 +1,9 @@
+TRANSLATION_1=that is the order of business
+TRANSLATION_2=this is the order of business
+TRANSLATION_3=that is the order of business
+LMLOAD_TIME ~ 10.00
+PTLOAD_TIME ~ 10.00
+SCORE_1 = -2.966
+SCORE_2 = -2.565
+SCORE_3 = -2.966
+TOTAL_WALLTIME ~ 11
diff --git a/regression-testing/tests/lattice-distortion/CMD b/regression-testing/tests/lattice-distortion/CMD
new file mode 100644
index 000000000..7dcf26c8c
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/CMD
@@ -0,0 +1 @@
+cat phrase-table | ~/moses/mosesdecoder-lattice/misc/processPhraseTable -ttable 0 0 - -nscores 2 -out phrase-table
diff --git a/regression-testing/tests/lattice-distortion/filter-nbest.pl b/regression-testing/tests/lattice-distortion/filter-nbest.pl
new file mode 100644
index 000000000..705fceea1
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/filter-nbest.pl
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+$x=0;
+$oldcode = "";
+while (<>) {
+ chomp;
+ ($code,$trans,$featscores,$globscores) = split(/[\s]*\|\|\|[\s]*/,$_);
+ $x = 0 if $oldcode ne $code;
+ $x++;
+ chomp($code);
+ print "TRANSLATION_${code}_NBEST_${x}=$trans ||| $featscores\n";
+ $oldcode = $code;
+}
diff --git a/regression-testing/tests/lattice-distortion/filter-stderr.pl b/regression-testing/tests/lattice-distortion/filter-stderr.pl
new file mode 100644
index 000000000..2f6e17607
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/filter-stderr.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, "$script_dir/../perllib"; }
+use RegTestUtils;
+
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^Finished loading LanguageModels/) {
+ my $time = RegTestUtils::readTime($_);
+ print "LMLOAD_TIME ~ $time\n";
+ }
+ if (/^Finished loading phrase tables/) {
+ my $time = RegTestUtils::readTime($_);
+ print "PTLOAD_TIME ~ $time\n";
+ }
+ next unless /^BEST TRANSLATION:/;
+ my $pscore = RegTestUtils::readHypoScore($_);
+ $x++;
+ print "SCORE_$x = $pscore\n";
+}
diff --git a/regression-testing/tests/lattice-distortion/filter-stdout.pl b/regression-testing/tests/lattice-distortion/filter-stdout.pl
new file mode 100644
index 000000000..476ddf6e9
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ $x++;
+ print "TRANSLATION_$x=$_\n";
+}
diff --git a/regression-testing/tests/lattice-distortion/moses.ini b/regression-testing/tests/lattice-distortion/moses.ini
new file mode 100644
index 000000000..1a565d4e3
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/moses.ini
@@ -0,0 +1,64 @@
+# Moses configuration file
+# automatic exodus from pharaoh.ini Wed Jul 12 18:24:14 EDT 2006
+
+###########################
+### PHARAOH CONFIG FILE ###
+###########################
+
+# phrase table f, n, p(n|f)
+[ttable-file]
+0 0 2 ${TEST_PATH}/phrase-table
+
+# language model
+[lmodel-file]
+0 0 3 ${TEST_PATH}/small.lm
+# limit on how many phrase translations e for each phrase f are loaded
+[ttable-limit]
+#ttable element load limit 0 = all elements loaded
+0
+
+# distortion (reordering) weight
+[weight-d]
+1.0
+
+# language model weight
+[weight-l]
+1.0
+
+# translation model weight (phrase translation, lexical weighting)
+[weight-t]
+0.5
+0.5
+
+# word penalty
+[weight-w]
+-5.0
+
+[distortion-limit]
+25
+
+[beam-threshold]
+0.0001
+
+[input-factors]
+0
+
+[mapping]
+T 0
+
+[inputtype]
+2
+
+[weight-i]
+1.0
+
+[verbose]
+2
+
+[recover-input-path]
+1
+
+[n-best-list]
+nbest
+10
+
diff --git a/regression-testing/tests/lattice-distortion/phrase-table b/regression-testing/tests/lattice-distortion/phrase-table
new file mode 100644
index 000000000..48f6a1551
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/phrase-table
@@ -0,0 +1,8 @@
+A ||| 1 ||| 0.1 0.1
+B ||| 2 ||| 0.1 0.1
+C ||| 3 ||| 0.1 0.1
+D ||| 4 ||| 0.1 0.1
+E ||| 5 ||| 0.1 0.1
+X ||| 1234 ||| 0.1 0.1
+Y ||| 123 ||| 0.1 0.1
+Z ||| 12 ||| 0.1 0.1
diff --git a/regression-testing/tests/lattice-distortion/phrase-table.binphr.idx b/regression-testing/tests/lattice-distortion/phrase-table.binphr.idx
new file mode 100644
index 000000000..7eded7e5d
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/phrase-table.binphr.idx
Binary files differ
diff --git a/regression-testing/tests/lattice-distortion/phrase-table.binphr.srctree b/regression-testing/tests/lattice-distortion/phrase-table.binphr.srctree
new file mode 100644
index 000000000..93de16d2b
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/phrase-table.binphr.srctree
Binary files differ
diff --git a/regression-testing/tests/lattice-distortion/phrase-table.binphr.srcvoc b/regression-testing/tests/lattice-distortion/phrase-table.binphr.srcvoc
new file mode 100644
index 000000000..d096e7f09
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/phrase-table.binphr.srcvoc
@@ -0,0 +1,8 @@
+7 Z
+6 Y
+5 X
+4 E
+3 D
+2 C
+1 B
+0 A
diff --git a/regression-testing/tests/lattice-distortion/phrase-table.binphr.tgtdata b/regression-testing/tests/lattice-distortion/phrase-table.binphr.tgtdata
new file mode 100644
index 000000000..0306f7108
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/phrase-table.binphr.tgtdata
Binary files differ
diff --git a/regression-testing/tests/lattice-distortion/phrase-table.binphr.tgtvoc b/regression-testing/tests/lattice-distortion/phrase-table.binphr.tgtvoc
new file mode 100644
index 000000000..71dec3430
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/phrase-table.binphr.tgtvoc
@@ -0,0 +1,8 @@
+7 12
+6 123
+5 1234
+4 5
+3 4
+2 3
+1 2
+0 1
diff --git a/regression-testing/tests/lattice-distortion/small.lm b/regression-testing/tests/lattice-distortion/small.lm
new file mode 100644
index 000000000..2206a7d57
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/small.lm
@@ -0,0 +1,86 @@
+
+\data\
+ngram 1=21
+ngram 2=42
+ngram 3=10
+
+\1-grams:
+-1.147663 1 -0.05147925
+-1.90823 12 -0.1494838
+-1.321964 123 -0.5169629
+-1.445119 1234 -0.4663778
+-1.147663 2 -0.8132458
+-1.08123 3 0.08509711
+-0.8860567 4 -0.005259842
+-0.8138084 5 -0.5734631
+-1.90823 6 -0.1816884
+-1.90823 7 -0.1816884
+-1.90823 8 -0.08341829
+-0.6729417 </s>
+-99 <s> -0.3836367
+-1.90823 a -0.1816884
+-1.617665 are -0.1709516
+-1.90823 few -0.1816884
+-1.617665 here -0.0699124
+-1.90823 more -0.1712167
+-1.90823 random -0.1712167
+-1.90823 some -0.1816884
+-1.445119 words -0.5470337
+
+\2-grams:
+-0.7569619 1 2 0
+-0.455932 12 3
+-0.39794 123 4
+-0.39794 123 </s>
+-0.1760913 1234 5 -0.1413292
+-0.9330532 1234 </s>
+-0.07918125 2 3 -0.6283889
+-1.234083 2 </s>
+-0.8239087 3 4 -0.7345816
+-1.30103 3 </s>
+-1.497325 4 1
+-0.7403627 4 123 -0.2552725
+-1.020203 4 5 -0.4423592
+-0.7403627 4 </s>
+-1.569875 5 123
+-1.569875 5 1234
+-0.6368221 5 4 -0.3899711
+-1.569875 5 6
+-0.2688453 5 </s>
+-0.455932 6 7
+-0.455932 7 8
+-0.455932 8 </s>
+-0.5563025 <s> 1 -0.6946052
+-1.711204 <s> 12
+-1.711204 <s> 123
+-0.9542425 <s> 1234 0
+-1.711204 <s> 3
+-0.5563025 <s> 5 -0.2839966
+-1.711204 <s> here
+-1.711204 <s> some
+-1.711204 <s> words
+-0.455932 a few
+-0.7569619 are a
+-0.7569619 are here
+-0.455932 few more
+-0.7569619 here </s>
+-0.7569619 here are
+-0.455932 more words
+-0.455932 random words
+-0.455932 some random
+-0.1760913 words </s>
+-0.9330532 words are
+
+\3-grams:
+-0.07918125 <s> 1 2
+-0.1760913 4 123 </s>
+-0.1760913 <s> 1234 5
+-0.07918125 1 2 3
+-0.09691001 2 3 4
+-0.07918125 3 4 5
+-0.1760913 5 4 123
+-0.1760913 1234 5 </s>
+-0.07918125 4 5 </s>
+-0.2218488 <s> 5 4
+
+\end\
diff --git a/regression-testing/tests/lattice-distortion/to-translate.txt b/regression-testing/tests/lattice-distortion/to-translate.txt
new file mode 100644
index 000000000..ed1c0d1bb
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/to-translate.txt
@@ -0,0 +1,7 @@
+((('A',1.0,1),),(('B',1.0,1),),)
+((('A',1.0,1),('Z',1.0,2),),(('B',1.0,1),),(('C',1.0,1),),)
+((('A',1.0,1),('NOT_FOUND',1.0,2),),(('B',1.0,1),),(('C',1.0,1),),)
+((('A',1.0,1),),(('B',1.0,1),('Z',1.0,2),),(('C',1.0,1),),)
+((('A',1.0,5),('B',1.0,2),('C',1.0,3),('D',1.0,1),),(('E',1.0,4),),(('C',1.0,3),),(('D',1.0,1),),(('E',1.0,1),),(('X',1.0,1),),)
+((('A',1.0,1),),)
+((('\'',1.0,1),),)
diff --git a/regression-testing/tests/lattice-distortion/truth/results.txt b/regression-testing/tests/lattice-distortion/truth/results.txt
new file mode 100644
index 000000000..d946fe0f3
--- /dev/null
+++ b/regression-testing/tests/lattice-distortion/truth/results.txt
@@ -0,0 +1,53 @@
+TRANSLATION_1=A B ||| 1 2
+TRANSLATION_2=A B C ||| 1 2 3
+TRANSLATION_3=A B C ||| 1 2 3
+TRANSLATION_4=A B C ||| 1 2 3
+TRANSLATION_5=C D E X ||| 1234 3 4 5
+TRANSLATION_6=A ||| 1
+TRANSLATION_7=' ||| '
+LMLOAD_TIME ~ 0.000
+PTLOAD_TIME ~ 0.000
+SCORE_1 = 1.090
+SCORE_2 = 2.004
+SCORE_3 = 2.004
+SCORE_4 = 2.004
+SCORE_5 = -0.233
+SCORE_6 = -1.851
+SCORE_7 = -196.549
+TRANSLATION_0_NBEST_1=1 2 ||| d: 0 lm: -4.30484 w: -2 I: 0 tm: -4.60517 -4.60517
+TRANSLATION_0_NBEST_2=2 1 ||| d: -3 lm: -9.70915 w: -2 I: 0 tm: -4.60517 -4.60517
+TRANSLATION_1_NBEST_1=1 2 3 ||| d: 0 lm: -6.08823 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_1_NBEST_2=12 3 ||| d: 0 lm: -7.98575 w: -2 I: 0 tm: -4.60517 -4.60517
+TRANSLATION_1_NBEST_3=2 3 1 ||| d: -2 lm: -9.26988 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_1_NBEST_4=1 3 2 ||| d: -3 lm: -10.7767 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_1_NBEST_5=3 1 2 ||| d: -3 lm: -10.9714 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_1_NBEST_6=2 1 3 ||| d: -2 lm: -13.645 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_1_NBEST_7=3 12 ||| d: -3 lm: -10.0318 w: -2 I: 0 tm: -4.60517 -4.60517
+TRANSLATION_1_NBEST_8=3 2 1 ||| d: -4 lm: -12.57 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_2_NBEST_1=1 2 3 ||| d: 0 lm: -6.08823 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_2_NBEST_2=2 3 1 ||| d: -2 lm: -9.26988 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_2_NBEST_3=1 3 2 ||| d: -3 lm: -10.7767 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_2_NBEST_4=3 1 2 ||| d: -3 lm: -10.9714 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_2_NBEST_5=2 1 3 ||| d: -2 lm: -13.645 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_2_NBEST_6=3 2 1 ||| d: -4 lm: -12.57 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_3_NBEST_1=1 2 3 ||| d: 0 lm: -6.08823 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_3_NBEST_2=1 3 2 ||| d: -1 lm: -10.7767 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_3_NBEST_3=1 12 ||| d: 0 lm: -9.28642 w: -2 I: 0 tm: -4.60517 -4.60517
+TRANSLATION_3_NBEST_4=2 3 1 ||| d: -3 lm: -9.26988 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_3_NBEST_5=3 1 2 ||| d: -3 lm: -10.9714 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_3_NBEST_6=12 1 ||| d: -3 lm: -8.59503 w: -2 I: 0 tm: -4.60517 -4.60517
+TRANSLATION_3_NBEST_7=3 2 1 ||| d: -4 lm: -12.57 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_3_NBEST_8=2 1 3 ||| d: -3 lm: -13.645 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_4_NBEST_1=1234 3 4 5 ||| d: -3 lm: -8.02249 w: -4 I: 0 tm: -9.21034 -9.21034
+TRANSLATION_4_NBEST_2=4 1234 5 ||| d: -3 lm: -7.07413 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_4_NBEST_3=3 4 5 1234 ||| d: 0 lm: -12.8014 w: -4 I: 0 tm: -9.21034 -9.21034
+TRANSLATION_4_NBEST_4=5 4 1234 ||| d: -2 lm: -8.17776 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_4_NBEST_5=2 3 1234 ||| d: 0 lm: -10.4352 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_4_NBEST_6=1234 4 5 ||| d: -3 lm: -7.84275 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_4_NBEST_7=1234 5 4 ||| d: -4 lm: -6.99714 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_4_NBEST_8=1 1234 ||| d: 0 lm: -8.4748 w: -2 I: 0 tm: -4.60517 -4.60517
+TRANSLATION_4_NBEST_9=3 4 1234 5 ||| d: -3 lm: -11.6793 w: -4 I: 0 tm: -9.21034 -9.21034
+TRANSLATION_4_NBEST_10=4 5 1234 ||| d: 0 lm: -12.0545 w: -3 I: 0 tm: -6.90776 -6.90776
+TRANSLATION_5_NBEST_1=1 ||| d: 0 lm: -4.54836 w: -1 I: 0 tm: -2.30259 -2.30259
+TRANSLATION_6_NBEST_1=' ||| d: 0 lm: -101.55 w: -1 I: 0 tm: 0 0
+TOTAL_WALLTIME ~ 0
diff --git a/regression-testing/tests/lattice-surface/filter-stderr.pl b/regression-testing/tests/lattice-surface/filter-stderr.pl
new file mode 100644
index 000000000..2f6e17607
--- /dev/null
+++ b/regression-testing/tests/lattice-surface/filter-stderr.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, "$script_dir/../perllib"; }
+use RegTestUtils;
+
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^Finished loading LanguageModels/) {
+ my $time = RegTestUtils::readTime($_);
+ print "LMLOAD_TIME ~ $time\n";
+ }
+ if (/^Finished loading phrase tables/) {
+ my $time = RegTestUtils::readTime($_);
+ print "PTLOAD_TIME ~ $time\n";
+ }
+ next unless /^BEST TRANSLATION:/;
+ my $pscore = RegTestUtils::readHypoScore($_);
+ $x++;
+ print "SCORE_$x = $pscore\n";
+}
diff --git a/regression-testing/tests/lattice-surface/filter-stdout.pl b/regression-testing/tests/lattice-surface/filter-stdout.pl
new file mode 100644
index 000000000..476ddf6e9
--- /dev/null
+++ b/regression-testing/tests/lattice-surface/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ $x++;
+ print "TRANSLATION_$x=$_\n";
+}
diff --git a/regression-testing/tests/lattice-surface/moses.ini b/regression-testing/tests/lattice-surface/moses.ini
new file mode 100644
index 000000000..deb8507be
--- /dev/null
+++ b/regression-testing/tests/lattice-surface/moses.ini
@@ -0,0 +1,60 @@
+# Moses configuration file
+# automatic exodus from pharaoh.ini Wed Jul 12 18:24:14 EDT 2006
+
+###########################
+### PHARAOH CONFIG FILE ###
+###########################
+
+# phrase table f, n, p(n|f)
+[ttable-file]
+0 0 5 ${MODEL_PATH}/confusionNet-surface-only/phrase-table.0-0
+
+# language model
+[lmodel-file]
+0 0 3 ${LM_PATH}/europarl.en.srilm.gz
+# limit on how many phrase translations e for each phrase f are loaded
+[ttable-limit]
+#ttable element load limit 0 = all elements loaded
+20
+
+# distortion (reordering) weight
+[weight-d]
+0.141806519223522
+
+# language model weight
+[weight-l]
+0.142658800199951
+
+# translation model weight (phrase translation, lexical weighting)
+[weight-t]
+0.00402447059454402
+0.0685647475075862
+0.294089113124688
+0.0328320356515851
+-0.0426081987467227
+
+# word penalty
+[weight-w]
+-0.273416114951401
+
+[distortion-limit]
+4
+
+[beam-threshold]
+0.03
+
+[input-factors]
+0
+
+[mapping]
+T 0
+
+[inputtype]
+2
+
+[weight-i]
+1.0
+
+[verbose]
+2
+
diff --git a/regression-testing/tests/lattice-surface/to-translate.txt b/regression-testing/tests/lattice-surface/to-translate.txt
new file mode 100644
index 000000000..fd475df5e
--- /dev/null
+++ b/regression-testing/tests/lattice-surface/to-translate.txt
@@ -0,0 +1,4 @@
+((('damit|PROADV',1.0,1),),(('ist|VSFIN',1.0,1),('war|VSFIN',1.0,1),('sei|VSFIN',1.0,1),),(('der|ART',1.0,1),('die|ART',1.0,1),('das|ART',1.0,1),),(('arbeitsplan|NN',1.0,1),),)
+((('damit|PROADV',1.0,1),('dies|PROADV',1.0,1),),(('ist|VSFIN',1.0,1),('war|VSFIN',1.0,1),('sei|VSFIN',1.0,1),('ist|VVFIN',1.0,1),('war|VVFIN',1.0,1),('sei|VVFIN',1.0,1),),(('der|ART',1.0,1),('die|ART',1.0,1),('das|ART',1.0,1),('der|DT',1.0,1),('die|DT',1.0,1),('das|DT',1.0,1),),(('arbeitsplan|NN',1.0,1),),)
+((('damit|PROADV',1.0,1),('dies|PROADV',0.0,1),),(('ist|VSFIN',1.0,1),('war|VSFIN',1.0,1),('sei|VSFIN',1.0,1),('dies|PROADV',0.0,1),('das|DT',0.0,1),),(('der|ART',1.0,1),('die|ART',1.0,1),('das|ART',1.0,1),('dies|PROADV',0.0,1),),(('arbeitsplan|NN',1.0,1),('dies|PROADV',0.0,1),),)
+((('damit|PROADV',0.5,2),('das|DT',0.5,1),),(('war|FSFIN',1.0,1),),(('der|ART',1.0,1),),(('arbeitsplan|NN',1.0,1),),)
diff --git a/regression-testing/tests/lattice-surface/truth/results.txt b/regression-testing/tests/lattice-surface/truth/results.txt
new file mode 100644
index 000000000..7a7dd5304
--- /dev/null
+++ b/regression-testing/tests/lattice-surface/truth/results.txt
@@ -0,0 +1,11 @@
+TRANSLATION_1=that is the order of business
+TRANSLATION_2=this is the order of business
+TRANSLATION_3=that is the order of business
+TRANSLATION_4=this was the order of business
+LMLOAD_TIME ~ 8.000
+PTLOAD_TIME ~ 8.000
+SCORE_1 = -2.966
+SCORE_2 = -2.565
+SCORE_3 = -2.966
+SCORE_4 = -4.126
+TOTAL_WALLTIME ~ 8
diff --git a/regression-testing/tests/lexicalized-reordering-cn/filter-stderr.pl b/regression-testing/tests/lexicalized-reordering-cn/filter-stderr.pl
new file mode 100644
index 000000000..2f6e17607
--- /dev/null
+++ b/regression-testing/tests/lexicalized-reordering-cn/filter-stderr.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, "$script_dir/../perllib"; }
+use RegTestUtils;
+
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^Finished loading LanguageModels/) {
+ my $time = RegTestUtils::readTime($_);
+ print "LMLOAD_TIME ~ $time\n";
+ }
+ if (/^Finished loading phrase tables/) {
+ my $time = RegTestUtils::readTime($_);
+ print "PTLOAD_TIME ~ $time\n";
+ }
+ next unless /^BEST TRANSLATION:/;
+ my $pscore = RegTestUtils::readHypoScore($_);
+ $x++;
+ print "SCORE_$x = $pscore\n";
+}
diff --git a/regression-testing/tests/lexicalized-reordering-cn/filter-stdout.pl b/regression-testing/tests/lexicalized-reordering-cn/filter-stdout.pl
new file mode 100644
index 000000000..476ddf6e9
--- /dev/null
+++ b/regression-testing/tests/lexicalized-reordering-cn/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ $x++;
+ print "TRANSLATION_$x=$_\n";
+}
diff --git a/regression-testing/tests/lexicalized-reordering-cn/moses.ini b/regression-testing/tests/lexicalized-reordering-cn/moses.ini
new file mode 100644
index 000000000..b00c0925d
--- /dev/null
+++ b/regression-testing/tests/lexicalized-reordering-cn/moses.ini
@@ -0,0 +1,69 @@
+#########################
+### MOSES CONFIG FILE ###
+#########################
+
+# input factors
+[input-factors]
+0
+
+# mapping steps
+[mapping]
+T 0
+
+# translation tables: source-factors, target-factors, number of scores, file
+[ttable-file]
+0 0 5 ${MODEL_PATH}/lexicalized-reordering-cn/fr-en
+
+# no generation models, no generation-file section
+
+# language models: type(srilm/irstlm), factors, order, file
+[lmodel-file]
+0 0 5 ${MODEL_PATH}/lexicalized-reordering/europarl.lm
+
+
+# limit on how many phrase translations e for each phrase f are loaded
+# 0 = all elements loaded
+[ttable-limit]
+20
+0
+# distortion (reordering) files
+[distortion-file]
+0-0 msd-bidirectional-fe 6 ${MODEL_PATH}/lexicalized-reordering/reordering-table.msd-bidirectional-fe.0.5.0-0.gz
+
+# distortion (reordering) weight
+[weight-d]
+0.5
+0.3
+0.3
+0.3
+0.3
+0.3
+0.3
+
+# language model weights
+[weight-l]
+0.5000
+
+[weight-i]
+1.0
+
+# translation model weights
+[weight-t]
+0.2
+0.2
+0.2
+0.2
+0.2
+
+# no generation models, no weight-generation section
+
+# word penalty
+[weight-w]
+-1
+
+[distortion-limit]
+6
+
+[inputtype]
+1
+
diff --git a/regression-testing/tests/lexicalized-reordering-cn/to-translate.txt b/regression-testing/tests/lexicalized-reordering-cn/to-translate.txt
new file mode 100644
index 000000000..3e712ee1b
--- /dev/null
+++ b/regression-testing/tests/lexicalized-reordering-cn/to-translate.txt
@@ -0,0 +1,89 @@
+monsieur 1.0
+le 1.0
+président 1.0
+, 1.0
+ce 1.0
+que 1.0
+nous 1.0
+devrons 1.0
+toutefois 1.0
+également 1.0
+faire 1.0
+à 1.0
+biarritz 1.0
+, 1.0
+c' 1.0
+est 1.0
+regarder 1.0
+un 1.0
+peu 1.0
+plus 1.0
+loin 1.0
+. 1.0
+
+les 1.0
+élus 1.0
+que 1.0
+nous 1.0
+sommes 1.0
+avons 1.0
+au 1.0
+moins 1.0
+autant 1.0
+le 1.0
+devoir 1.0
+de 1.0
+l' 1.0
+encourager 1.0
+à 1.0
+progresser 1.0
+, 1.0
+en 1.0
+dépit 1.0
+de 1.0
+l' 1.0
+adversité 1.0
+, 1.0
+que 1.0
+de 1.0
+relayer 1.0
+les 1.0
+messages 1.0
+que 1.0
+nous 1.0
+recevons 1.0
+de 1.0
+l' 1.0
+opinion 1.0
+publique 1.0
+dans 1.0
+chacun 1.0
+de 1.0
+nos 1.0
+pays 1.0
+. 1.0
+
+au 1.0
+regard 1.0
+des 1.0
+événements 1.0
+de 1.0
+ces 1.0
+derniers 1.0
+temps 1.0
+, 1.0
+la 1.0
+question 1.0
+du 1.0
+prix 1.0
+de 1.0
+l' 1.0
+essence 1.0
+me 1.0
+semble 1.0
+elle 1.0
+aussi 1.0
+particulièrement 1.0
+remarquable 1.0
+. 1.0
+
diff --git a/regression-testing/tests/lexicalized-reordering-cn/truth/results.txt b/regression-testing/tests/lexicalized-reordering-cn/truth/results.txt
new file mode 100644
index 000000000..37a4900e4
--- /dev/null
+++ b/regression-testing/tests/lexicalized-reordering-cn/truth/results.txt
@@ -0,0 +1,9 @@
+TRANSLATION_1=mr president , what we devrons but also to to biarritz , this is regarder a little more loin .
+TRANSLATION_2=the élus that we are have the with difference the us of the encourager to progresser , in dépit of the adversité , that of relayer the messages that we recevons of the opinion all in each of our countries .
+TRANSLATION_3=the prerequisites for the événements of these derniers time , the issue of the sufficiently of the essence to it also in remarquable .
+LMLOAD_TIME ~ 1.000
+PTLOAD_TIME ~ 1.000
+SCORE_1 = -621.292
+SCORE_2 = -1402.951
+SCORE_3 = -636.351
+TOTAL_WALLTIME ~ 21
diff --git a/regression-testing/tests/lexicalized-reordering/filter-stderr.pl b/regression-testing/tests/lexicalized-reordering/filter-stderr.pl
new file mode 100644
index 000000000..d8df4b2c7
--- /dev/null
+++ b/regression-testing/tests/lexicalized-reordering/filter-stderr.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, "$script_dir/../perllib"; }
+use RegTestUtils;
+
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^Finished loading LanguageModels/) {
+ my $time = RegTestUtils::readTime($_);
+ print "LMLOAD_TIME ~ $time\n";
+ }
+ if (/^Finished loading phrase tables/) {
+ my $time = RegTestUtils::readTime($_);
+ print "PTLOAD_TIME ~ $time\n";
+ }
+ next unless /^BEST TRANSLATION:/;
+ my $pscore = RegTestUtils::readHypoScore($_);
+ $x++;
+ print "SCORE_$x = $pscore\n";
+}
diff --git a/regression-testing/tests/lexicalized-reordering/filter-stdout.pl b/regression-testing/tests/lexicalized-reordering/filter-stdout.pl
new file mode 100644
index 000000000..ab6c47077
--- /dev/null
+++ b/regression-testing/tests/lexicalized-reordering/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ $x++;
+ print "TRANSLATION_$x=$_\n";
+}
diff --git a/regression-testing/tests/lexicalized-reordering/moses.ini b/regression-testing/tests/lexicalized-reordering/moses.ini
new file mode 100644
index 000000000..05db6d145
--- /dev/null
+++ b/regression-testing/tests/lexicalized-reordering/moses.ini
@@ -0,0 +1,63 @@
+#########################
+### MOSES CONFIG FILE ###
+#########################
+
+# input factors
+[input-factors]
+0
+
+# mapping steps
+[mapping]
+T 0
+
+# translation tables: source-factors, target-factors, number of scores, file
+[ttable-file]
+0 0 5 ${MODEL_PATH}/lexicalized-reordering/phrase-table.0-0.gz
+
+# no generation models, no generation-file section
+
+# language models: type(srilm/irstlm), factors, order, file
+[lmodel-file]
+0 0 5 ${MODEL_PATH}/lexicalized-reordering/europarl.lm
+
+
+# limit on how many phrase translations e for each phrase f are loaded
+# 0 = all elements loaded
+[ttable-limit]
+20
+0
+# distortion (reordering) files
+[distortion-file]
+0-0 msd-bidirectional-fe 6 ${MODEL_PATH}/lexicalized-reordering/reordering-table.msd-bidirectional-fe.0.5.0-0.gz
+
+# distortion (reordering) weight
+[weight-d]
+0.5
+0.3
+0.3
+0.3
+0.3
+0.3
+0.3
+
+# language model weights
+[weight-l]
+0.5000
+
+
+# translation model weights
+[weight-t]
+0.2
+0.2
+0.2
+0.2
+0.2
+
+# no generation models, no weight-generation section
+
+# word penalty
+[weight-w]
+-1
+
+[distortion-limit]
+6
diff --git a/regression-testing/tests/lexicalized-reordering/to-translate.txt b/regression-testing/tests/lexicalized-reordering/to-translate.txt
new file mode 100644
index 000000000..b59f4354d
--- /dev/null
+++ b/regression-testing/tests/lexicalized-reordering/to-translate.txt
@@ -0,0 +1,5 @@
+monsieur le président , ce que nous devrons toutefois également faire à biarritz , c' est regarder un peu plus loin .
+les élus que nous sommes avons au moins autant le devoir de l' encourager à progresser , en dépit de l' adversité , que de relayer les messages que nous recevons de l' opinion publique dans chacun de nos pays .
+au regard des événements de ces derniers temps , la question du prix de l' essence me semble elle aussi particulièrement remarquable .
+à l' heure actuelle , le conseil est en train d' examiner l' inclusion de tels mécanismes dans l' article 7 .
+deuxièmement , dans la transparence pour les citoyens , qui connaissent à présent les droits dont ils disposent vis-à-vis de ceux qui appliquent et élaborent le droit européen , et pour ceux qui , justement , appliquent et élaborent ce droit européen .
diff --git a/regression-testing/tests/lexicalized-reordering/truth/results.txt b/regression-testing/tests/lexicalized-reordering/truth/results.txt
new file mode 100644
index 000000000..a441d2c73
--- /dev/null
+++ b/regression-testing/tests/lexicalized-reordering/truth/results.txt
@@ -0,0 +1,13 @@
+TRANSLATION_1=mr president , what we devrons but also to to biarritz , this is regarder a little more loin .
+TRANSLATION_2=the élus that we are have the with difference the us of the encourager to progresser , in dépit of the adversité , that of relayer the messages that we recevons of the opinion all in each of our countries .
+TRANSLATION_3=the prerequisites for the événements of these derniers time , the issue of the sufficiently of the essence to it also in remarquable .
+TRANSLATION_4=in the , the council , it is train of examiner the inclusion of such mécanismes in article 7 .
+TRANSLATION_5=secondly , in the transparency for the citizens , which are now the droits which they disposent vis-à-vis of those appliquent and élaborent the european law and , to those , precisely appliquent and élaborent this european law .
+LMLOAD_TIME ~ 8.00
+PTLOAD_TIME ~ 9.00
+SCORE_1 = -621.292
+SCORE_2 = -1402.951
+SCORE_3 = -636.351
+SCORE_4 = -631.966
+SCORE_5 = -1110.523
+TOTAL_WALLTIME ~ 16
diff --git a/regression-testing/tests/multi-factor-binptable/filter-stderr.pl b/regression-testing/tests/multi-factor-binptable/filter-stderr.pl
new file mode 100644
index 000000000..d8df4b2c7
--- /dev/null
+++ b/regression-testing/tests/multi-factor-binptable/filter-stderr.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, "$script_dir/../perllib"; }
+use RegTestUtils;
+
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^Finished loading LanguageModels/) {
+ my $time = RegTestUtils::readTime($_);
+ print "LMLOAD_TIME ~ $time\n";
+ }
+ if (/^Finished loading phrase tables/) {
+ my $time = RegTestUtils::readTime($_);
+ print "PTLOAD_TIME ~ $time\n";
+ }
+ next unless /^BEST TRANSLATION:/;
+ my $pscore = RegTestUtils::readHypoScore($_);
+ $x++;
+ print "SCORE_$x = $pscore\n";
+}
diff --git a/regression-testing/tests/multi-factor-binptable/filter-stdout.pl b/regression-testing/tests/multi-factor-binptable/filter-stdout.pl
new file mode 100644
index 000000000..ab6c47077
--- /dev/null
+++ b/regression-testing/tests/multi-factor-binptable/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ $x++;
+ print "TRANSLATION_$x=$_\n";
+}
diff --git a/regression-testing/tests/multi-factor-binptable/moses.ini b/regression-testing/tests/multi-factor-binptable/moses.ini
new file mode 100644
index 000000000..779433472
--- /dev/null
+++ b/regression-testing/tests/multi-factor-binptable/moses.ini
@@ -0,0 +1,68 @@
+#########################
+### MOSES CONFIG FILE ###
+#########################
+
+# input factors
+[input-factors]
+0
+1
+
+# mapping steps
+[mapping]
+T 0
+G 0
+T 1
+
+# translation tables: source-factors, target-factors, number of scores, file
+[ttable-file]
+0 0 5 ${MODEL_PATH}/multi-factor-binptable/phrase-table.0-0.gz
+1 1 5 ${MODEL_PATH}/multi-factor-binptable/phrase-table.1-1.gz
+
+# generation models: source-factors, target-factors
+[generation-file]
+0 1 2 ${MODEL_PATH}/multi-factor-binptable/generation.0-1.gz
+
+# language models: 0, factors, type, file
+[lmodel-file]
+0 0 3 ${LM_PATH}/europarl.en.srilm.gz
+
+# limit on how many phrase translations e for each phrase f are loaded
+# 0 = all elements loaded
+[ttable-limit]
+20
+0
+
+# distortion (reordering) weight
+[weight-d]
+0.6
+
+# language model weights
+[weight-l]
+0.5
+
+# translation model weights
+[weight-t]
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+
+# generation model weights
+[weight-generation]
+0.3
+0
+
+# word penalty
+[weight-w]
+-1
+
+
+[verbose]
+2
+
diff --git a/regression-testing/tests/multi-factor-binptable/to-translate.txt b/regression-testing/tests/multi-factor-binptable/to-translate.txt
new file mode 100644
index 000000000..d65890b48
--- /dev/null
+++ b/regression-testing/tests/multi-factor-binptable/to-translate.txt
@@ -0,0 +1 @@
+es|PPER gibt|VVFIN verschiedene|ADJ andere|ADJ meinungen|NN .|PE
diff --git a/regression-testing/tests/multi-factor-binptable/truth/results.txt b/regression-testing/tests/multi-factor-binptable/truth/results.txt
new file mode 100644
index 000000000..a640050ec
--- /dev/null
+++ b/regression-testing/tests/multi-factor-binptable/truth/results.txt
@@ -0,0 +1,5 @@
+TRANSLATION_1=there are various different opinions .
+LMLOAD_TIME ~ 10.00
+PTLOAD_TIME ~ 10.00
+SCORE_1 = -113.734
+TOTAL_WALLTIME ~ 11
diff --git a/regression-testing/tests/multi-factor-drop/dropize_phrase_table.pl b/regression-testing/tests/multi-factor-drop/dropize_phrase_table.pl
new file mode 100644
index 000000000..d0a27f4d7
--- /dev/null
+++ b/regression-testing/tests/multi-factor-drop/dropize_phrase_table.pl
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+#add_empties_to_phrase_table: go through an old-style pharaoh phrase table (no empty target sources) and add one such line for each single-word source phrase in the table,
+#complete with factors (note the number and type of factors are hardcoded here);
+#also add deletion-cost factors as necessary to all lines
+#Evan Herbst 7 / 11 / 06
+
+#usage: aetpt INPUT_PTABLE OUTPUT_PTABLE
+
+my ($inputFile, $outputFile) = @ARGV;
+my $DELETIONCOST = 2.718; #weight for an individual deletion
+
+open(INFILE, "<$inputFile") or die "couldn't open '$inputFile' for read\n";
+open(OUTFILE, ">$outputFile") or die "couldn't open '$outputFile' for write\n";
+my ($lastSrcPhrase, $srcPhrase);
+while(my $line = <INFILE>)
+{
+ chop($line);
+ $lastSrcPhrase = $srcPhrase;
+ my @tokens = split(/\|\|\|/, $line);
+ $srcPhrase = $tokens[0];
+ if($srcPhrase ne $lastSrcPhrase && $srcPhrase =~ /^\s*\S+\s*$/) #new source phrase of a single word; add deletion line
+ {
+ print OUTFILE "$srcPhrase ||| ||| 1 1 1 1 2.718 $DELETIONCOST\n";
+ }
+ print OUTFILE "$line 1\n";
+}
+close(INFILE);
+close(OUTFILE);
diff --git a/regression-testing/tests/multi-factor-drop/filter-stderr.pl b/regression-testing/tests/multi-factor-drop/filter-stderr.pl
new file mode 100644
index 000000000..d8df4b2c7
--- /dev/null
+++ b/regression-testing/tests/multi-factor-drop/filter-stderr.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, "$script_dir/../perllib"; }
+use RegTestUtils;
+
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^Finished loading LanguageModels/) {
+ my $time = RegTestUtils::readTime($_);
+ print "LMLOAD_TIME ~ $time\n";
+ }
+ if (/^Finished loading phrase tables/) {
+ my $time = RegTestUtils::readTime($_);
+ print "PTLOAD_TIME ~ $time\n";
+ }
+ next unless /^BEST TRANSLATION:/;
+ my $pscore = RegTestUtils::readHypoScore($_);
+ $x++;
+ print "SCORE_$x = $pscore\n";
+}
diff --git a/regression-testing/tests/multi-factor-drop/filter-stdout.pl b/regression-testing/tests/multi-factor-drop/filter-stdout.pl
new file mode 100644
index 000000000..ab6c47077
--- /dev/null
+++ b/regression-testing/tests/multi-factor-drop/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ $x++;
+ print "TRANSLATION_$x=$_\n";
+}
diff --git a/regression-testing/tests/multi-factor-drop/moses.ini b/regression-testing/tests/multi-factor-drop/moses.ini
new file mode 100644
index 000000000..fede53dc2
--- /dev/null
+++ b/regression-testing/tests/multi-factor-drop/moses.ini
@@ -0,0 +1,75 @@
+#########################
+### MOSES CONFIG FILE ###
+#########################
+
+# input factors
+[input-factors]
+0
+1
+
+# mapping steps
+[mapping]
+T 0
+G 0
+T 1
+
+# translation tables: source-factors, target-factors, number of scores, file
+[ttable-file]
+0 0 6 ${MODEL_PATH}/multi-factor-drop/phrase-table.0-0.gz
+1 1 5 ${MODEL_PATH}/multi-factor-drop/phrase-table.1-1.gz
+
+# generation models: source-factors, target-factors
+[generation-file]
+0 1 2 ${MODEL_PATH}/multi-factor-drop/generation.0-1.gz
+
+# language models: 0, factors, type, file
+[lmodel-file]
+0 0 3 ${LM_PATH}/europarl.en.srilm.gz
+
+# limit on how many phrase translations e for each phrase f are loaded
+# 0 = all elements loaded
+[ttable-limit]
+20
+0
+
+# distortion (reordering) weight
+[weight-d]
+0.6
+
+# language model weights
+[weight-l]
+0.5
+
+# translation model weights
+[weight-t]
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+
+# generation model weights
+[weight-generation]
+0.3
+0
+
+# word penalty
+[weight-w]
+-1
+
+[phrase-drop-allowed]
+yes
+
+##word-drop penalty
+#[weight-e]
+#2.718
+
+[verbose]
+2
+
diff --git a/regression-testing/tests/multi-factor-drop/to-translate.txt b/regression-testing/tests/multi-factor-drop/to-translate.txt
new file mode 100644
index 000000000..d65890b48
--- /dev/null
+++ b/regression-testing/tests/multi-factor-drop/to-translate.txt
@@ -0,0 +1 @@
+es|PPER gibt|VVFIN verschiedene|ADJ andere|ADJ meinungen|NN .|PE
diff --git a/regression-testing/tests/multi-factor-drop/truth/results.txt b/regression-testing/tests/multi-factor-drop/truth/results.txt
new file mode 100644
index 000000000..cccc3b4d7
--- /dev/null
+++ b/regression-testing/tests/multi-factor-drop/truth/results.txt
@@ -0,0 +1,5 @@
+TRANSLATION_1=there are different opinions
+LMLOAD_TIME ~ 10.00
+PTLOAD_TIME ~ 11.00
+SCORE_1 = -12.675
+TOTAL_WALLTIME ~ 11
diff --git a/regression-testing/tests/multi-factor/filter-stderr.pl b/regression-testing/tests/multi-factor/filter-stderr.pl
new file mode 100644
index 000000000..d8df4b2c7
--- /dev/null
+++ b/regression-testing/tests/multi-factor/filter-stderr.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, "$script_dir/../perllib"; }
+use RegTestUtils;
+
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^Finished loading LanguageModels/) {
+ my $time = RegTestUtils::readTime($_);
+ print "LMLOAD_TIME ~ $time\n";
+ }
+ if (/^Finished loading phrase tables/) {
+ my $time = RegTestUtils::readTime($_);
+ print "PTLOAD_TIME ~ $time\n";
+ }
+ next unless /^BEST TRANSLATION:/;
+ my $pscore = RegTestUtils::readHypoScore($_);
+ $x++;
+ print "SCORE_$x = $pscore\n";
+}
diff --git a/regression-testing/tests/multi-factor/filter-stdout.pl b/regression-testing/tests/multi-factor/filter-stdout.pl
new file mode 100644
index 000000000..ab6c47077
--- /dev/null
+++ b/regression-testing/tests/multi-factor/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ $x++;
+ print "TRANSLATION_$x=$_\n";
+}
diff --git a/regression-testing/tests/multi-factor/moses.ini b/regression-testing/tests/multi-factor/moses.ini
new file mode 100644
index 000000000..3bc3ae174
--- /dev/null
+++ b/regression-testing/tests/multi-factor/moses.ini
@@ -0,0 +1,71 @@
+#########################
+### MOSES CONFIG FILE ###
+#########################
+
+# input factors
+[input-factors]
+0
+1
+
+# indicates that factors are separated by '++' in the input
+[factor-delimiter]
+++
+
+# mapping steps
+[mapping]
+T 0
+G 0
+T 1
+
+# translation tables: source-factors, target-factors, number of scores, file
+[ttable-file]
+0 0 5 ${MODEL_PATH}/multi-factor/phrase-table.0-0.gz
+1 1 5 ${MODEL_PATH}/multi-factor/phrase-table.1-1.gz
+
+# generation models: source-factors, target-factors
+[generation-file]
+0 1 2 ${MODEL_PATH}/multi-factor/generation.0-1.gz
+
+# language models: 0, factors, type, file
+[lmodel-file]
+0 0 3 ${LM_PATH}/europarl.en.srilm.gz
+
+# limit on how many phrase translations e for each phrase f are loaded
+# 0 = all elements loaded
+[ttable-limit]
+20
+0
+
+# distortion (reordering) weight
+[weight-d]
+0.6
+
+# language model weights
+[weight-l]
+0.5
+
+# translation model weights
+[weight-t]
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+
+# generation model weights
+[weight-generation]
+0.3
+0
+
+# word penalty
+[weight-w]
+-1
+
+[verbose]
+2
+
diff --git a/regression-testing/tests/multi-factor/to-translate.txt b/regression-testing/tests/multi-factor/to-translate.txt
new file mode 100644
index 000000000..ed43c0af0
--- /dev/null
+++ b/regression-testing/tests/multi-factor/to-translate.txt
@@ -0,0 +1 @@
+es++PPER gibt++VVFIN verschiedene++ADJ andere++ADJ meinungen++NN .++PE
diff --git a/regression-testing/tests/multi-factor/truth/results.txt b/regression-testing/tests/multi-factor/truth/results.txt
new file mode 100644
index 000000000..d316f974b
--- /dev/null
+++ b/regression-testing/tests/multi-factor/truth/results.txt
@@ -0,0 +1,5 @@
+TRANSLATION_1=there are various different opinions .
+LMLOAD_TIME ~ 10.00
+PTLOAD_TIME ~ 11.00
+SCORE_1 = -113.734
+TOTAL_WALLTIME ~ 12
diff --git a/regression-testing/tests/nbest-multi-factor/filter-nbest.pl b/regression-testing/tests/nbest-multi-factor/filter-nbest.pl
new file mode 100644
index 000000000..705fceea1
--- /dev/null
+++ b/regression-testing/tests/nbest-multi-factor/filter-nbest.pl
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+$x=0;
+$oldcode = "";
+while (<>) {
+ chomp;
+ ($code,$trans,$featscores,$globscores) = split(/[\s]*\|\|\|[\s]*/,$_);
+ $x = 0 if $oldcode ne $code;
+ $x++;
+ chomp($code);
+ print "TRANSLATION_${code}_NBEST_${x}=$trans ||| $featscores\n";
+ $oldcode = $code;
+}
diff --git a/regression-testing/tests/nbest-multi-factor/filter-stderr.pl b/regression-testing/tests/nbest-multi-factor/filter-stderr.pl
new file mode 100644
index 000000000..a359091ab
--- /dev/null
+++ b/regression-testing/tests/nbest-multi-factor/filter-stderr.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, "$script_dir/../perllib"; }
+use RegTestUtils;
+
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^Finished loading LanguageModels/) {
+ my $time = RegTestUtils::readTime($_);
+ print "LMLOAD_TIME ~ $time\n";
+ }
+ if (/^Finished loading phrase tables/) {
+ my $time = RegTestUtils::readTime($_);
+ print "PTLOAD_TIME ~ $time\n";
+ }
+ next unless /^BEST TRANSLATION:/;
+ my $pscore = RegTestUtils::readHypoScore($_);
+ print "SCORE_$x = $pscore\n";
+ $x++;
+}
diff --git a/regression-testing/tests/nbest-multi-factor/filter-stdout.pl b/regression-testing/tests/nbest-multi-factor/filter-stdout.pl
new file mode 100644
index 000000000..3f2ec4288
--- /dev/null
+++ b/regression-testing/tests/nbest-multi-factor/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ print "TRANSLATION_$x=$_\n";
+ $x++;
+}
diff --git a/regression-testing/tests/nbest-multi-factor/moses.ini b/regression-testing/tests/nbest-multi-factor/moses.ini
new file mode 100644
index 000000000..6ea051fc0
--- /dev/null
+++ b/regression-testing/tests/nbest-multi-factor/moses.ini
@@ -0,0 +1,75 @@
+#########################
+### MOSES CONFIG FILE ###
+#########################
+
+# input factors
+[input-factors]
+0
+1
+
+# indicates that factors are separated by '++' in the input
+[factor-delimiter]
+++
+
+# mapping steps
+[mapping]
+T 0
+G 0
+T 1
+
+# translation tables: source-factors, target-factors, number of scores, file
+[ttable-file]
+0 0 5 ${MODEL_PATH}/multi-factor/phrase-table.0-0.gz
+1 1 5 ${MODEL_PATH}/multi-factor/phrase-table.1-1.gz
+
+# generation models: source-factors, target-factors
+[generation-file]
+0 1 2 ${MODEL_PATH}/multi-factor/generation.0-1.gz
+
+# language models: 0, factors, type, file
+[lmodel-file]
+0 0 3 ${LM_PATH}/europarl.en.srilm.gz
+
+# limit on how many phrase translations e for each phrase f are loaded
+# 0 = all elements loaded
+[ttable-limit]
+20
+0
+
+# distortion (reordering) weight
+[weight-d]
+0.6
+
+# language model weights
+[weight-l]
+0.5
+
+# translation model weights
+[weight-t]
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+0.2
+
+# generation model weights
+[weight-generation]
+0.3
+0
+
+# word penalty
+[weight-w]
+-1
+
+[n-best-list]
+nbest
+2
+
+[verbose]
+2
+
diff --git a/regression-testing/tests/nbest-multi-factor/to-translate.txt b/regression-testing/tests/nbest-multi-factor/to-translate.txt
new file mode 100644
index 000000000..58686860c
--- /dev/null
+++ b/regression-testing/tests/nbest-multi-factor/to-translate.txt
@@ -0,0 +1 @@
+es++PPER gibt++VVFIN verschiedene++ADJ andere++ADJ meinungen++NN .++PE
diff --git a/regression-testing/tests/nbest-multi-factor/truth/results.txt b/regression-testing/tests/nbest-multi-factor/truth/results.txt
new file mode 100644
index 000000000..a595f78e1
--- /dev/null
+++ b/regression-testing/tests/nbest-multi-factor/truth/results.txt
@@ -0,0 +1,7 @@
+TRANSLATION_0=there are various different opinions .
+LMLOAD_TIME ~ 11.00
+PTLOAD_TIME ~ 23.00
+SCORE_0= -113.734
+TRANSLATION_0_NBEST_1=there are various different opinions . ||| d: 0 lm: -21.6664 w: -6 tm: -3.46226 -10.822 -2.82666 -9.32004 2.99969 -2.44147 -4.91188 -6.12017 -10.5033 2.99969 g: -0.0625204 -18.098
+TRANSLATION_0_NBEST_2=there are various other opinions . ||| d: 0 lm: -25.3276 w: -6 tm: -1.94591 -10.3833 -0.693147 -7.77959 1.99979 -0.924822 -4.91188 -3.33314 -10.5033 1.99979 g: -0.149241 -16.9924
+TOTAL_WALLTIME ~ 23
diff --git a/regression-testing/tests/perllib/RegTestUtils.pm b/regression-testing/tests/perllib/RegTestUtils.pm
new file mode 100644
index 000000000..47d49874f
--- /dev/null
+++ b/regression-testing/tests/perllib/RegTestUtils.pm
@@ -0,0 +1,31 @@
+#RegTestUtils.pm: for moses regression testing
+#Evan Herbst, 8 / 11 / 06
+
+use strict;
+
+package RegTestUtils;
+return 1;
+
+###############################################################
+
+#arguments: chomped line of output that gives the best hypo and various scores
+#return: a string to be compared with the correct total hypothesis score;
+# it's formatted as a double if no error, or "FORMAT ERROR" if there is one
+sub readHypoScore
+{
+ my $line = shift;
+ #the 0.12 is hardcoded in Hypothesis.cpp because some parsing scripts still
+ #expect a comma-separated list of scores -- EVH
+ if($line =~ /\[total=\s*(-?\d+\.\d+)\]/) {return $1;}
+ return "FORMAT ERROR";
+}
+
+#arguments: chomped line of output that gives a time in seconds
+#return: a string to be compared with the correct time;
+# it's formatted as a double if no error, or "FORMAT ERROR" if there is one
+sub readTime
+{
+ my $line = shift;
+ if($line =~ /\[(\d+\.\d+)\]\s*seconds$/) {return $1;}
+ return "FORMAT ERROR";
+}
diff --git a/regression-testing/tests/ptable-filtering/filter-stderr.pl b/regression-testing/tests/ptable-filtering/filter-stderr.pl
new file mode 100644
index 000000000..b6eb5836e
--- /dev/null
+++ b/regression-testing/tests/ptable-filtering/filter-stderr.pl
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^\[.* ; 2-2\]$/o) {
+ my @lines;
+ my $done = 0;
+ while (!$done) {
+ $x = <>;
+ if ($x =~ /^\s*$/o) { $done = 1; } else {
+ chomp $x;
+ $x =~ s/^\s+//o;
+ push @lines, $x;
+ }
+ }
+ my $c = 0;
+ foreach my $x (sort @lines) {
+ $c++;
+ print "TRANSLATION_OPTION_$c=$x\n";
+ }
+ }
+
+ next unless /^BEST TRANSLATION:/;
+ s/^BEST TRANSLATION:\s*//;
+ s/\s*\[111+.*$//;
+ $x++;
+ print "TRANSLATION_$x = $_\n";
+}
diff --git a/regression-testing/tests/ptable-filtering/filter-stdout.pl b/regression-testing/tests/ptable-filtering/filter-stdout.pl
new file mode 100644
index 000000000..7bc93b2e7
--- /dev/null
+++ b/regression-testing/tests/ptable-filtering/filter-stdout.pl
@@ -0,0 +1,2 @@
+#!/usr/bin/perl
+$x=0;
diff --git a/regression-testing/tests/ptable-filtering/moses.ini b/regression-testing/tests/ptable-filtering/moses.ini
new file mode 100644
index 000000000..09eb99ca5
--- /dev/null
+++ b/regression-testing/tests/ptable-filtering/moses.ini
@@ -0,0 +1,59 @@
+# reg testing
+
+[ttable-file]
+0 0 6 ${MODEL_PATH}/ptable-filtering/phrase-table.gz
+
+# language model
+[lmodel-file]
+0 0 3 ${LM_PATH}/europarl.en.srilm.gz
+# limit on how many phrase translations e for each phrase f are loaded
+# 0 = all elements loaded
+[ttable-limit]
+20
+
+# distortion (reordering) type
+[distortion-type]
+distance
+
+# distortion (reordering) weight
+[weight-d]
+0.01
+
+# language model weight
+[weight-l]
+0.05
+
+# translation model weight (phrase translation, lexical weighting)
+[weight-t]
+0.019268
+0.025749
+0.018038
+0.008511
+0.013410
+-0.624610
+
+# word penalty
+[weight-w]
+-0.108496
+
+[distortion-limit]
+6
+
+[stack]
+100
+
+[lmodel-floor]
+-50
+
+[beam-threshold]
+0.03
+
+[input-factors]
+0
+
+[mapping]
+T 0
+
+[verbose]
+3
+
diff --git a/regression-testing/tests/ptable-filtering/to-translate.txt b/regression-testing/tests/ptable-filtering/to-translate.txt
new file mode 100644
index 000000000..cc08be05c
--- /dev/null
+++ b/regression-testing/tests/ptable-filtering/to-translate.txt
@@ -0,0 +1 @@
+西 联 汇款 .
diff --git a/regression-testing/tests/ptable-filtering/truth/results.txt b/regression-testing/tests/ptable-filtering/truth/results.txt
new file mode 100644
index 000000000..511d885cb
--- /dev/null
+++ b/regression-testing/tests/ptable-filtering/truth/results.txt
@@ -0,0 +1,22 @@
+TRANSLATION_OPTION_1=form of , pC=-0.571, c=-0.815
+TRANSLATION_OPTION_2=from , pC=-0.604, c=-0.783
+TRANSLATION_OPTION_3=money , pC=-0.380, c=-0.680
+TRANSLATION_OPTION_4=money transfers , pC=-0.291, c=-0.797
+TRANSLATION_OPTION_5=of transfers , pC=-0.323, c=-0.805
+TRANSLATION_OPTION_6=payments , pC=-0.493, c=-0.816
+TRANSLATION_OPTION_7=providing , pC=-0.536, c=-0.866
+TRANSLATION_OPTION_8=remittance , pC=-0.059, c=-0.627
+TRANSLATION_OPTION_9=remittance of , pC=-0.154, c=-0.726
+TRANSLATION_OPTION_10=remittances , , pC=-0.202, c=-0.793
+TRANSLATION_OPTION_11=remittances , pC=-0.043, c=-0.611
+TRANSLATION_OPTION_12=remittances , to , pC=-0.161, c=-0.864
+TRANSLATION_OPTION_13=remittances from , pC=-0.154, c=-0.753
+TRANSLATION_OPTION_14=represents , pC=-0.551, c=-0.852
+TRANSLATION_OPTION_15=sending money , pC=-0.333, c=-0.835
+TRANSLATION_OPTION_16=sent , pC=-0.491, c=-0.833
+TRANSLATION_OPTION_17=transfer , pC=-0.374, c=-0.717
+TRANSLATION_OPTION_18=transfer of money , pC=-0.352, c=-0.801
+TRANSLATION_OPTION_19=transfers , pC=-0.333, c=-0.692
+TRANSLATION_OPTION_20=transfers from , pC=-0.359, c=-0.759
+TRANSLATION_1 = from the west .
+TOTAL_WALLTIME ~ 14
diff --git a/regression-testing/tests/xml-markup/filter-nbest.pl b/regression-testing/tests/xml-markup/filter-nbest.pl
new file mode 100644
index 000000000..705fceea1
--- /dev/null
+++ b/regression-testing/tests/xml-markup/filter-nbest.pl
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+$x=0;
+$oldcode = "";
+while (<>) {
+ chomp;
+ ($code,$trans,$featscores,$globscores) = split(/[\s]*\|\|\|[\s]*/,$_);
+ $x = 0 if $oldcode ne $code;
+ $x++;
+ chomp($code);
+ print "TRANSLATION_${code}_NBEST_${x}=$trans ||| $featscores\n";
+ $oldcode = $code;
+}
diff --git a/regression-testing/tests/xml-markup/filter-stderr.pl b/regression-testing/tests/xml-markup/filter-stderr.pl
new file mode 100644
index 000000000..a359091ab
--- /dev/null
+++ b/regression-testing/tests/xml-markup/filter-stderr.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+BEGIN { use Cwd qw/ abs_path /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, "$script_dir/../perllib"; }
+use RegTestUtils;
+
+$x=0;
+while (<>) {
+ chomp;
+
+ if (/^Finished loading LanguageModels/) {
+ my $time = RegTestUtils::readTime($_);
+ print "LMLOAD_TIME ~ $time\n";
+ }
+ if (/^Finished loading phrase tables/) {
+ my $time = RegTestUtils::readTime($_);
+ print "PTLOAD_TIME ~ $time\n";
+ }
+ next unless /^BEST TRANSLATION:/;
+ my $pscore = RegTestUtils::readHypoScore($_);
+ print "SCORE_$x = $pscore\n";
+ $x++;
+}
diff --git a/regression-testing/tests/xml-markup/filter-stdout.pl b/regression-testing/tests/xml-markup/filter-stdout.pl
new file mode 100644
index 000000000..3f2ec4288
--- /dev/null
+++ b/regression-testing/tests/xml-markup/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ print "TRANSLATION_$x=$_\n";
+ $x++;
+}
diff --git a/regression-testing/tests/xml-markup/moses.ini b/regression-testing/tests/xml-markup/moses.ini
new file mode 100644
index 000000000..fca7e057c
--- /dev/null
+++ b/regression-testing/tests/xml-markup/moses.ini
@@ -0,0 +1,57 @@
+# Moses configuration file
+# automatic exodus from pharaoh.ini Wed Jul 12 18:24:14 EDT 2006
+
+###########################
+### PHARAOH CONFIG FILE ###
+###########################
+
+# phrase table f, n, p(n|f)
+[ttable-file]
+0 0 1 ${TEST_PATH}/phrase-table
+
+# language model
+[lmodel-file]
+0 0 3 ${LM_PATH}/europarl.en.srilm.gz
+# limit on how many phrase translations e for each phrase f are loaded
+[ttable-limit]
+#ttable element load limit 0 = all elements loaded
+0
+
+# distortion (reordering) weight
+[weight-d]
+1.0
+
+# language model weight
+[weight-l]
+1.0
+
+# translation model weight (phrase translation, lexical weighting)
+[weight-t]
+1.0
+
+# word penalty
+[weight-w]
+-5.0
+
+[distortion-limit]
+25
+
+[beam-threshold]
+0.0001
+
+[input-factors]
+0
+
+[mapping]
+T 0
+
+[verbose]
+2
+
+[n-best-list]
+nbest
+10
+
+[xml-input]
+inclusive
+
diff --git a/regression-testing/tests/xml-markup/phrase-table b/regression-testing/tests/xml-markup/phrase-table
new file mode 100644
index 000000000..fc67473c7
--- /dev/null
+++ b/regression-testing/tests/xml-markup/phrase-table
@@ -0,0 +1,22 @@
+der ||| the ||| 0.3
+das ||| the ||| 0.4
+das ||| it ||| 0.1
+das ||| this ||| 0.1
+die ||| the ||| 0.3
+ist ||| is ||| 1.0
+ist ||| 's ||| 1.0
+das ist ||| it is ||| 0.2
+das ist ||| this is ||| 0.8
+es ist ||| it is ||| 0.8
+es ist ||| this is ||| 0.2
+ein ||| a ||| 1.0
+ein ||| an ||| 1.0
+klein ||| small ||| 0.8
+klein ||| little ||| 0.8
+kleines ||| small ||| 0.2
+kleines ||| little ||| 0.2
+haus ||| house ||| 1.0
+alt ||| old ||| 0.8
+altes ||| old ||| 0.2
+gibt ||| gives ||| 1.0
+es gibt ||| there is ||| 1.0
diff --git a/regression-testing/tests/xml-markup/phrase-table.binphr.idx b/regression-testing/tests/xml-markup/phrase-table.binphr.idx
new file mode 100644
index 000000000..a18ceafd3
--- /dev/null
+++ b/regression-testing/tests/xml-markup/phrase-table.binphr.idx
Binary files differ
diff --git a/regression-testing/tests/xml-markup/phrase-table.binphr.srctree b/regression-testing/tests/xml-markup/phrase-table.binphr.srctree
new file mode 100644
index 000000000..9335395bf
--- /dev/null
+++ b/regression-testing/tests/xml-markup/phrase-table.binphr.srctree
Binary files differ
diff --git a/regression-testing/tests/xml-markup/phrase-table.binphr.srcvoc b/regression-testing/tests/xml-markup/phrase-table.binphr.srcvoc
new file mode 100644
index 000000000..cc94a13dc
--- /dev/null
+++ b/regression-testing/tests/xml-markup/phrase-table.binphr.srcvoc
@@ -0,0 +1,12 @@
+11 gibt
+10 altes
+9 alt
+8 haus
+7 kleines
+6 klein
+5 ein
+4 es
+3 ist
+2 die
+1 das
+0 der
diff --git a/regression-testing/tests/xml-markup/phrase-table.binphr.tgtdata b/regression-testing/tests/xml-markup/phrase-table.binphr.tgtdata
new file mode 100644
index 000000000..1af05d728
--- /dev/null
+++ b/regression-testing/tests/xml-markup/phrase-table.binphr.tgtdata
Binary files differ
diff --git a/regression-testing/tests/xml-markup/phrase-table.binphr.tgtvoc b/regression-testing/tests/xml-markup/phrase-table.binphr.tgtvoc
new file mode 100644
index 000000000..a00b16fb1
--- /dev/null
+++ b/regression-testing/tests/xml-markup/phrase-table.binphr.tgtvoc
@@ -0,0 +1,13 @@
+12 there
+11 gives
+10 old
+9 house
+8 little
+7 small
+6 an
+5 a
+4 's
+3 is
+2 this
+1 it
+0 the
diff --git a/regression-testing/tests/xml-markup/to-translate.txt b/regression-testing/tests/xml-markup/to-translate.txt
new file mode 100644
index 000000000..d508c128e
--- /dev/null
+++ b/regression-testing/tests/xml-markup/to-translate.txt
@@ -0,0 +1,6 @@
+das ist ein kleines <n english="dwelling" prob="0.8">haus</n> .
+das ist ein kleines <n english="dwelling||building" prob="0.6||0.4">haus</n> .
+das ist ein kleines <n english="dwelling||building" prob="0.6||100.0">haus</n> .
+<n english="dwelling||building" prob="10.6||0.4" span="4,4" />das ist ein kleines haus .
+<n english="dwelling" prob="10.6" span="4,4" />das ist ein kleines haus .
+<n english="nice place" prob="4.0" span="3,4" /><n english="dwelling" prob="10.6" span="4,4" />das ist ein kleines haus .
diff --git a/regression-testing/tests/xml-markup/truth/results.txt b/regression-testing/tests/xml-markup/truth/results.txt
new file mode 100644
index 000000000..620c99ee8
--- /dev/null
+++ b/regression-testing/tests/xml-markup/truth/results.txt
@@ -0,0 +1,75 @@
+TRANSLATION_0=this is a small house .
+TRANSLATION_1=this is a small house .
+TRANSLATION_2=this is a little building .
+TRANSLATION_3=this is a small house .
+TRANSLATION_4=this is a small house .
+TRANSLATION_5=this is a nice place .
+LMLOAD_TIME ~ 8.000
+PTLOAD_TIME ~ 8.000
+SCORE_0 = -94.029
+SCORE_1 = -94.029
+SCORE_2 = -92.554
+SCORE_3 = -94.029
+SCORE_4 = -94.029
+SCORE_5 = -93.875
+TRANSLATION_0_NBEST_1=this is a small house . ||| d: 0 lm: -22.1968 tm: -1.83258 w: -6
+TRANSLATION_0_NBEST_2=it is a small house . ||| d: 0 lm: -22.2422 tm: -3.21888 w: -6
+TRANSLATION_0_NBEST_3=this is a little house . ||| d: 0 lm: -26.517 tm: -1.83258 w: -6
+TRANSLATION_0_NBEST_4=it is a little house . ||| d: 0 lm: -26.5625 tm: -3.21888 w: -6
+TRANSLATION_0_NBEST_5=this is a little dwelling . ||| d: 0 lm: -31.093 tm: -2.05573 w: -6
+TRANSLATION_0_NBEST_6=this is a small dwelling . ||| d: 0 lm: -31.5834 tm: -2.05573 w: -6
+TRANSLATION_0_NBEST_7=it is a little dwelling . ||| d: 0 lm: -31.1384 tm: -3.44202 w: -6
+TRANSLATION_0_NBEST_8=it is a small dwelling . ||| d: 0 lm: -31.6288 tm: -3.44202 w: -6
+TRANSLATION_0_NBEST_9=it is small an house . ||| d: -4 lm: -35.81 tm: -3.21888 w: -6
+TRANSLATION_0_NBEST_10=this is small an house . ||| d: -4 lm: -39.0655 tm: -1.83258 w: -6
+TRANSLATION_1_NBEST_1=this is a small house . ||| d: 0 lm: -22.1968 tm: -1.83258 w: -6
+TRANSLATION_1_NBEST_2=it is a small house . ||| d: 0 lm: -22.2422 tm: -3.21888 w: -6
+TRANSLATION_1_NBEST_3=this is a little building . ||| d: 0 lm: -25.3263 tm: -2.74887 w: -6
+TRANSLATION_1_NBEST_4=this is a little house . ||| d: 0 lm: -26.517 tm: -1.83258 w: -6
+TRANSLATION_1_NBEST_5=this is a small building . ||| d: 0 lm: -25.8167 tm: -2.74887 w: -6
+TRANSLATION_1_NBEST_6=it is a little building . ||| d: 0 lm: -25.3718 tm: -4.13517 w: -6
+TRANSLATION_1_NBEST_7=it is a little house . ||| d: 0 lm: -26.5625 tm: -3.21888 w: -6
+TRANSLATION_1_NBEST_8=it is a small building . ||| d: 0 lm: -25.8622 tm: -4.13517 w: -6
+TRANSLATION_1_NBEST_9=a small house . it is ||| d: -8 lm: -51.6206 tm: -3.21888 w: -6
+TRANSLATION_1_NBEST_10=a small house . this is ||| d: -8 lm: -53.888 tm: -1.83258 w: -6
+TRANSLATION_2_NBEST_1=this is a little building . ||| d: 0 lm: -25.3263 tm: 2.77259 w: -6
+TRANSLATION_2_NBEST_2=this is a small building . ||| d: 0 lm: -25.8167 tm: 2.77259 w: -6
+TRANSLATION_2_NBEST_3=it is a little building . ||| d: 0 lm: -25.3718 tm: 1.38629 w: -6
+TRANSLATION_2_NBEST_4=this is a small house . ||| d: 0 lm: -22.1968 tm: -1.83258 w: -6
+TRANSLATION_2_NBEST_5=it is a small building . ||| d: 0 lm: -25.8622 tm: 1.38629 w: -6
+TRANSLATION_2_NBEST_6=it is a small house . ||| d: 0 lm: -22.2422 tm: -3.21888 w: -6
+TRANSLATION_2_NBEST_7=this is a little house . ||| d: 0 lm: -26.517 tm: -1.83258 w: -6
+TRANSLATION_2_NBEST_8=this is an small building . ||| d: 0 lm: -32.235 tm: 2.77259 w: -6
+TRANSLATION_2_NBEST_9=this is an little building . ||| d: 0 lm: -32.3167 tm: 2.77259 w: -6
+TRANSLATION_2_NBEST_10=it is a little house . ||| d: 0 lm: -26.5625 tm: -3.21888 w: -6
+TRANSLATION_3_NBEST_1=this is a small house . ||| d: 0 lm: -22.1968 tm: -1.83258 w: -6
+TRANSLATION_3_NBEST_2=it is a small house . ||| d: 0 lm: -22.2422 tm: -3.21888 w: -6
+TRANSLATION_3_NBEST_3=this is a little building . ||| d: 0 lm: -25.3263 tm: -2.74887 w: -6
+TRANSLATION_3_NBEST_4=this is a little house . ||| d: 0 lm: -26.517 tm: -1.83258 w: -6
+TRANSLATION_3_NBEST_5=this is a small building . ||| d: 0 lm: -25.8167 tm: -2.74887 w: -6
+TRANSLATION_3_NBEST_6=it is a little building . ||| d: 0 lm: -25.3718 tm: -4.13517 w: -6
+TRANSLATION_3_NBEST_7=it is a little house . ||| d: 0 lm: -26.5625 tm: -3.21888 w: -6
+TRANSLATION_3_NBEST_8=it is a small building . ||| d: 0 lm: -25.8622 tm: -4.13517 w: -6
+TRANSLATION_3_NBEST_9=this is a little dwelling . ||| d: 0 lm: -31.093 tm: 0.528273 w: -6
+TRANSLATION_3_NBEST_10=this is a small dwelling . ||| d: 0 lm: -31.5834 tm: 0.528273 w: -6
+TRANSLATION_4_NBEST_1=this is a small house . ||| d: 0 lm: -22.1968 tm: -1.83258 w: -6
+TRANSLATION_4_NBEST_2=it is a small house . ||| d: 0 lm: -22.2422 tm: -3.21888 w: -6
+TRANSLATION_4_NBEST_3=this is a little house . ||| d: 0 lm: -26.517 tm: -1.83258 w: -6
+TRANSLATION_4_NBEST_4=it is a little house . ||| d: 0 lm: -26.5625 tm: -3.21888 w: -6
+TRANSLATION_4_NBEST_5=this is a little dwelling . ||| d: 0 lm: -31.093 tm: 0.528273 w: -6
+TRANSLATION_4_NBEST_6=this is a small dwelling . ||| d: 0 lm: -31.5834 tm: 0.528273 w: -6
+TRANSLATION_4_NBEST_7=it is a little dwelling . ||| d: 0 lm: -31.1384 tm: -0.858022 w: -6
+TRANSLATION_4_NBEST_8=it is a small dwelling . ||| d: 0 lm: -31.6288 tm: -0.858022 w: -6
+TRANSLATION_4_NBEST_9=it is small an house . ||| d: -4 lm: -35.81 tm: -3.21888 w: -6
+TRANSLATION_4_NBEST_10=this is small an house . ||| d: -4 lm: -39.0655 tm: -1.83258 w: -6
+TRANSLATION_5_NBEST_1=this is a nice place . ||| d: 0 lm: -25.0386 tm: 1.16315 w: -6
+TRANSLATION_5_NBEST_2=this is a small house . ||| d: 0 lm: -22.1968 tm: -1.83258 w: -6
+TRANSLATION_5_NBEST_3=it is a nice place . ||| d: 0 lm: -25.084 tm: -0.223144 w: -6
+TRANSLATION_5_NBEST_4=it is a small house . ||| d: 0 lm: -22.2422 tm: -3.21888 w: -6
+TRANSLATION_5_NBEST_5=this is a little house . ||| d: 0 lm: -26.517 tm: -1.83258 w: -6
+TRANSLATION_5_NBEST_6=it is a little house . ||| d: 0 lm: -26.5625 tm: -3.21888 w: -6
+TRANSLATION_5_NBEST_7=this is an nice place . ||| d: 0 lm: -31.5425 tm: 1.16315 w: -6
+TRANSLATION_5_NBEST_8=this is a little dwelling . ||| d: 0 lm: -31.093 tm: 0.528273 w: -6
+TRANSLATION_5_NBEST_9=this is a small dwelling . ||| d: 0 lm: -31.5834 tm: 0.528273 w: -6
+TRANSLATION_5_NBEST_10=it is a little dwelling . ||| d: 0 lm: -31.1384 tm: -0.858022 w: -6
+TOTAL_WALLTIME ~ 9