diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-01 17:56:18 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-01 17:56:18 +0400 |
commit | 86fa1bf75a22694157c7cdbced0e6461f2642b13 (patch) | |
tree | dc3660fcda3a391e0bfa7ca8cfe666bdc85554b6 /tests | |
parent | 44b7b155dbca883706c5782c0174951a42247cf1 (diff) |
change StatelessFeatureType for class WordTranslationFeature. Test phrase.word-translation passes
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/phrase.word-translation/filter-stderr.pl | 22 | ||||
-rwxr-xr-x | tests/phrase.word-translation/filter-stdout.pl | 7 | ||||
-rw-r--r-- | tests/phrase.word-translation/moses.ini | 33 | ||||
-rw-r--r-- | tests/phrase.word-translation/to-translate.txt | 2 | ||||
-rw-r--r-- | tests/phrase.word-translation/truth/results.txt | 5 | ||||
-rw-r--r-- | tests/phrase.word-translation/weights | 4 |
6 files changed, 73 insertions, 0 deletions
diff --git a/tests/phrase.word-translation/filter-stderr.pl b/tests/phrase.word-translation/filter-stderr.pl new file mode 100755 index 0000000..2f6e176 --- /dev/null +++ b/tests/phrase.word-translation/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.word-translation/filter-stdout.pl b/tests/phrase.word-translation/filter-stdout.pl new file mode 100755 index 0000000..476ddf6 --- /dev/null +++ b/tests/phrase.word-translation/filter-stdout.pl @@ -0,0 +1,7 @@ +#!/usr/bin/perl +$x=0; +while (<>) { + chomp; + $x++; + print "TRANSLATION_$x=$_\n"; +} diff --git a/tests/phrase.word-translation/moses.ini b/tests/phrase.word-translation/moses.ini new file mode 100644 index 0000000..3cdb881 --- /dev/null +++ b/tests/phrase.word-translation/moses.ini @@ -0,0 +1,33 @@ +# moses.ini for regression test +[distortion-limit] +4 + +[beam-threshold] +0.03 + +[input-factors] +0 + +[mapping] +T 0 + + +[verbose] +2 + +[feature] +WordPenalty +Distortion +KENLM lazyken=0 order=3 factor=0 path=${LM_PATH}/europarl.en.srilm.gz +WordTranslationFeature input-factor=0 output-factor=0 simple=1 source-context=0 target-context=0 +PhraseDictionaryMemory num-features=5 input-factor=0 output-factor=0 table-limit=20 path=${MODEL_PATH}/ptable-with-alignment/phrase-table.gz + +[weight] +WordPenalty0= -0.273416114951401 +Distortion0= 0.141806519223522 +KENLM0= 0.142658800199951 +PhraseDictionaryMemory0= 0.00402447059454402 0.0685647475075862 0.294089113124688 0.0328320356515851 -0.0426081987467227 + +[weight-file] +${TEST_PATH}/weights + diff --git a/tests/phrase.word-translation/to-translate.txt b/tests/phrase.word-translation/to-translate.txt new file mode 100644 index 0000000..9e59361 --- /dev/null +++ b/tests/phrase.word-translation/to-translate.txt @@ -0,0 +1,2 @@ +der Rahmen der Verfassung +Rechtsstaatlichkeit diff --git a/tests/phrase.word-translation/truth/results.txt b/tests/phrase.word-translation/truth/results.txt new file mode 100644 index 0000000..28f97ea --- /dev/null +++ b/tests/phrase.word-translation/truth/results.txt @@ -0,0 +1,5 @@ +TRANSLATION_1=of the realm of constitutional +TRANSLATION_2=rule +SCORE_1 = -3.693 +SCORE_2 = -3.635 +TOTAL_WALLTIME ~ 7 diff --git a/tests/phrase.word-translation/weights b/tests/phrase.word-translation/weights new file mode 100644 index 0000000..168d6d2 --- /dev/null +++ b/tests/phrase.word-translation/weights @@ -0,0 +1,4 @@ +wt_der~of 1.0 +wt_Rahmen~framework -0.25 +wt_der~the -0.4 +wt_Rechtsstaatlichkeit~rule -0.5 |