diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2017-07-22 01:30:40 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2017-07-22 01:30:40 +0300 |
commit | 7524cfebf4cbcf9d95e554a8d292314c686fe877 (patch) | |
tree | 06bf62d94242491ed1c91c66b3b4e4b3fb4a5dac | |
parent | 780163c7944986d9470a93c07d818f742d1e71ec (diff) |
add cache model test
-rwxr-xr-x | tests/phrase.cache-multi-factor/filter-stderr.pl | 22 | ||||
-rwxr-xr-x | tests/phrase.cache-multi-factor/filter-stdout.pl | 7 | ||||
-rw-r--r-- | tests/phrase.cache-multi-factor/moses.ini | 49 | ||||
-rw-r--r-- | tests/phrase.cache-multi-factor/to-translate.txt | 4 | ||||
-rw-r--r-- | tests/phrase.cache-multi-factor/truth/results.txt | 9 |
5 files changed, 91 insertions, 0 deletions
diff --git a/tests/phrase.cache-multi-factor/filter-stderr.pl b/tests/phrase.cache-multi-factor/filter-stderr.pl new file mode 100755 index 0000000..fb31704 --- /dev/null +++ b/tests/phrase.cache-multi-factor/filter-stderr.pl @@ -0,0 +1,22 @@ +#!/usr/bin/env 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.cache-multi-factor/filter-stdout.pl b/tests/phrase.cache-multi-factor/filter-stdout.pl new file mode 100755 index 0000000..0715c2d --- /dev/null +++ b/tests/phrase.cache-multi-factor/filter-stdout.pl @@ -0,0 +1,7 @@ +#!/usr/bin/env perl +$x=0; +while (<>) { + chomp; + $x++; + print "TRANSLATION_$x=$_\n"; +} diff --git a/tests/phrase.cache-multi-factor/moses.ini b/tests/phrase.cache-multi-factor/moses.ini new file mode 100644 index 0000000..3da47d7 --- /dev/null +++ b/tests/phrase.cache-multi-factor/moses.ini @@ -0,0 +1,49 @@ +######################### +### MOSES CONFIG FILE ### +######################### + +# input factors +[input-factors] +0 +1 + +# indicates that factors are separated by '++' in the input +[factor-delimiter] +++ + +[decoding-graph-backoff] +0 +0 + +# mapping steps +[mapping] +0 T 0 +1 T 1 +1 G 0 +1 T 2 + +[xml-input] +inclusive + +[verbose] +2 + +[feature] +KENLM factor=0 order=3 num-features=1 lazyken=0 path=${LM_PATH}/europarl.en.srilm.gz +Generation input-factor=0 output-factor=1 num-features=2 path=${MODEL_PATH}/multi-factor/generation.0-1.gz +Distortion +WordPenalty +UnknownWordPenalty +PhraseDictionaryCache name=CBPT0 input-factor=0,1 output-factor=0,1 num-features=4 +PhraseDictionaryMemory input-factor=0 output-factor=0 path=${MODEL_PATH}/multi-factor/phrase-table.0-0.gz num-features=5 table-limit=20 +PhraseDictionaryBinary input-factor=1 output-factor=1 path=${MODEL_PATH}/multi-factor/phrase-table.1-1.gz num-features=5 table-limit=0 + +[weight] +WordPenalty0= -1 +KENLM0= 0.5 +Generation0= 0.3 0 +Distortion0= 0.6 +CBPT0= 0.2 0.2 0.2 0.2 +PhraseDictionaryMemory0= 0.2 0.2 0.2 0.2 0.2 +PhraseDictionaryBinary0= 0.2 0.2 0.2 0.2 0.2 + diff --git a/tests/phrase.cache-multi-factor/to-translate.txt b/tests/phrase.cache-multi-factor/to-translate.txt new file mode 100644 index 0000000..998cb23 --- /dev/null +++ b/tests/phrase.cache-multi-factor/to-translate.txt @@ -0,0 +1,4 @@ +es++PPER gibt++VVFIN verschiedene++ADJ andere++ADJ meinungen++NN .++PE +<dlt type="cache" cbtm="es++PPER gibt++VVFIN verschiedene++ADJ andere++ADJ meinungen++NN .++PE ||| there++EX are++VBP plenty++JJ different++JJ opinions++NNS .++PE ||| 0.4 0.5 0.2 0.7"/>es++PPER gibt++VVFIN verschiedene++ADJ andere++ADJ meinungen++NN .++PE +<dlt type="cache" cbtm="es++PPER gibt++VVFIN verschiedene++ADJ ||| there++EX are++VBP awful++JJ ||| 1 0.4 0.7 0.1"/>es++PPER gibt++VVFIN verschiedene++ADJ andere++ADJ meinungen++NN .++PE +es++PPER gibt++VVFIN verschiedene++ADJ andere++ADJ meinungen++NN .++PE diff --git a/tests/phrase.cache-multi-factor/truth/results.txt b/tests/phrase.cache-multi-factor/truth/results.txt new file mode 100644 index 0000000..9c09c03 --- /dev/null +++ b/tests/phrase.cache-multi-factor/truth/results.txt @@ -0,0 +1,9 @@ +TRANSLATION_1=there are various different opinions . +TRANSLATION_2=there are plenty different opinions . +TRANSLATION_3=there are awful different opinions . +TRANSLATION_4=there are various different opinions . +SCORE_1 = -113.734 +SCORE_2 = -2.282 +SCORE_3 = -111.154 +SCORE_4 = -113.734 +TOTAL_WALLTIME ~ 4 |