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

github.com/moses-smt/moses-regression-tests.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2015-05-19 12:51:53 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-05-19 12:51:53 +0300
commitd4b3a2329d697eeda6b18458e1a76afd98575ebb (patch)
treed0dc3bc2c8c60318c146a0bb9858e87c03f5ec82
parent99ca7ce3ae0d8059f4d6bf3e99cffca0e571ff05 (diff)
add test for placeholder
-rw-r--r--tests/phrase.placeholder/europarl.srilm.gzbin0 -> 10950350 bytes
-rwxr-xr-xtests/phrase.placeholder/filter-stderr.pl22
-rwxr-xr-xtests/phrase.placeholder/filter-stdout.pl7
-rw-r--r--tests/phrase.placeholder/moses.ini35
-rw-r--r--tests/phrase.placeholder/phrase-table23
-rw-r--r--tests/phrase.placeholder/to-translate.txt2
-rw-r--r--tests/phrase.placeholder/truth/results.txt5
7 files changed, 94 insertions, 0 deletions
diff --git a/tests/phrase.placeholder/europarl.srilm.gz b/tests/phrase.placeholder/europarl.srilm.gz
new file mode 100644
index 0000000..06b7029
--- /dev/null
+++ b/tests/phrase.placeholder/europarl.srilm.gz
Binary files differ
diff --git a/tests/phrase.placeholder/filter-stderr.pl b/tests/phrase.placeholder/filter-stderr.pl
new file mode 100755
index 0000000..2f6e176
--- /dev/null
+++ b/tests/phrase.placeholder/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/tests/phrase.placeholder/filter-stdout.pl b/tests/phrase.placeholder/filter-stdout.pl
new file mode 100755
index 0000000..476ddf6
--- /dev/null
+++ b/tests/phrase.placeholder/filter-stdout.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+$x=0;
+while (<>) {
+ chomp;
+ $x++;
+ print "TRANSLATION_$x=$_\n";
+}
diff --git a/tests/phrase.placeholder/moses.ini b/tests/phrase.placeholder/moses.ini
new file mode 100644
index 0000000..e3e4177
--- /dev/null
+++ b/tests/phrase.placeholder/moses.ini
@@ -0,0 +1,35 @@
+#########################
+### MOSES CONFIG FILE ###
+#########################
+
+# input factors
+[input-factors]
+0
+
+# mapping steps, either (T) translation or (G) generation
+[mapping]
+T 0
+
+[feature]
+KENLM name=LM factor=0 order=3 num-features=1 path=${TEST_PATH}/europarl.srilm.gz
+Distortion
+WordPenalty
+UnknownWordPenalty
+PhraseDictionaryMemory input-factor=0 output-factor=0 path=${TEST_PATH}/phrase-table num-features=1 table-limit=10
+
+[weight]
+WordPenalty0= 0
+LM= 1
+Distortion0= 1
+PhraseDictionaryMemory0= 1
+
+#[n-best-list]
+#nbest.txt
+#100
+
+[xml-input]
+exclusive
+
+[placeholder-factor]
+1
+
diff --git a/tests/phrase.placeholder/phrase-table b/tests/phrase.placeholder/phrase-table
new file mode 100644
index 0000000..2e957e6
--- /dev/null
+++ b/tests/phrase.placeholder/phrase-table
@@ -0,0 +1,23 @@
+der ||| the ||| 0.3 ||| 0-0 |||
+das ||| the ||| 0.4 ||| 0-0 |||
+das ||| it ||| 0.1 ||| 0-0 |||
+das ||| this ||| 0.1 ||| 0-0 |||
+die ||| the ||| 0.3 ||| 0-0 |||
+ist ||| is ||| 1.0 ||| 0-0 |||
+ist ||| 's ||| 1.0 ||| 0-0 |||
+das ist ||| it is ||| 0.2 ||| 0-0 1-1 |||
+das ist ||| this is ||| 0.8 ||| 0-0 1-1 |||
+es ist ||| it is ||| 0.8 ||| 0-0 1-1 |||
+es ist ||| this is ||| 0.2 ||| 0-0 1-1 |||
+ein ||| a ||| 1.0 ||| 0-0 |||
+ein ||| an ||| 1.0 ||| 0-0 |||
+klein ||| small ||| 0.8 ||| 0-0 |||
+klein ||| little ||| 0.8 ||| 0-0 |||
+kleines ||| small ||| 0.2 ||| 0-0 |||
+kleines ||| little ||| 0.2 ||| 0-0 |||
+haus ||| house ||| 1.0 ||| 0-0 |||
+alt ||| old ||| 0.8 ||| 0-0 |||
+altes ||| old ||| 0.2 ||| 0-0 |||
+gibt ||| gives ||| 1.0 ||| 0-0 |||
+es gibt ||| there is ||| 1.0 ||| 0-0 |||
+@tag@ ||| @tag@ ||| 1.0 ||| 0-0
diff --git a/tests/phrase.placeholder/to-translate.txt b/tests/phrase.placeholder/to-translate.txt
new file mode 100644
index 0000000..73dee99
--- /dev/null
+++ b/tests/phrase.placeholder/to-translate.txt
@@ -0,0 +1,2 @@
+das ist <nae translation="a cute place">ein kleines haus</nae>
+das ist <ne translation="@tag@" entity="blah bling blong">@tag@</ne>
diff --git a/tests/phrase.placeholder/truth/results.txt b/tests/phrase.placeholder/truth/results.txt
new file mode 100644
index 0000000..12d6fc5
--- /dev/null
+++ b/tests/phrase.placeholder/truth/results.txt
@@ -0,0 +1,5 @@
+TRANSLATION_1=this is a cute place
+TRANSLATION_2=this is blah bling blong
+SCORE_1 = -37.798
+SCORE_2 = -245.452
+TOTAL_WALLTIME ~ 1