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

github.com/marian-nmt/marian-regression-tests.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--models/download-wmt16.sh7
-rw-r--r--models/wmt16_systems/marian.de-en.yml11
-rw-r--r--tests/decoder/xml/align.expected12
-rw-r--r--tests/decoder/xml/multiword.expected15
-rw-r--r--tests/decoder/xml/multiword.in5
-rw-r--r--tests/decoder/xml/nbest.expected40
-rw-r--r--tests/decoder/xml/notags.in10
-rw-r--r--tests/decoder/xml/setup.sh2
-rw-r--r--tests/decoder/xml/simpletags.in10
-rw-r--r--tests/decoder/xml/tags.expected12
-rw-r--r--tests/decoder/xml/tags.in12
-rw-r--r--tests/decoder/xml/test_compare_xml_input_with_no_tags.sh22
-rw-r--r--tests/decoder/xml/test_compare_xml_input_with_simple_tags.sh22
-rw-r--r--tests/decoder/xml/test_xml_input_nbest_mini_batch_1.sh21
-rw-r--r--tests/decoder/xml/test_xml_input_nbest_mini_batch_8.sh21
-rw-r--r--tests/decoder/xml/test_xml_multiword.sh21
-rw-r--r--tests/decoder/xml/test_xml_tags.sh21
-rw-r--r--tests/decoder/xml/test_xml_tags_via_server.sh32
-rw-r--r--tests/decoder/xml/test_xml_tags_word_alignment.sh21
-rw-r--r--tests/decoder/xml/test_xml_violation_penalty.sh21
-rw-r--r--tests/decoder/xml/text.in10
-rw-r--r--tests/decoder/xml/vp.expected30
23 files changed, 377 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index d593105..e375f48 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@ tools/subword-nmt
tools/nematus
models/wmt16_systems/en-de
+models/wmt16_systems/de-en
models/wmt17_systems/en-de
models/wmt17_systems/scripts
models/wmt17_systems/vars
diff --git a/models/download-wmt16.sh b/models/download-wmt16.sh
index 8cb6ba6..5095545 100644
--- a/models/download-wmt16.sh
+++ b/models/download-wmt16.sh
@@ -1,4 +1,7 @@
#!/bin/bash
-# Download single en-de wmt16 model
-wget -nv -nc -r -e robots=off -nH -np -R *r2l* -R index.html* http://data.statmt.org/wmt16_systems/en-de/
+# Download all en-de wmt16 models
+wget -nv -nc -r -e robots=off -nH -np -R '*r2l*' -R 'index.html*' http://data.statmt.org/wmt16_systems/en-de/
+
+# Download single de-en wmt16 model
+wget -nv -nc -r -e robots=off -nH -np -R '*r2l*' -R '*-ens*' -R '*.sh' -R 'index.html*' http://data.statmt.org/wmt16_systems/de-en/
diff --git a/models/wmt16_systems/marian.de-en.yml b/models/wmt16_systems/marian.de-en.yml
new file mode 100644
index 0000000..ce5bb5a
--- /dev/null
+++ b/models/wmt16_systems/marian.de-en.yml
@@ -0,0 +1,11 @@
+relative-paths: true
+type: amun
+models:
+ - de-en/model.npz
+dim-emb: 500
+vocabs:
+ - de-en/vocab.de.json
+ - de-en/vocab.en.json
+dim-vocabs:
+ - 85000
+ - 85000
diff --git a/tests/decoder/xml/align.expected b/tests/decoder/xml/align.expected
new file mode 100644
index 0000000..4e805cf
--- /dev/null
+++ b/tests/decoder/xml/align.expected
@@ -0,0 +1,12 @@
+the house is small . ||| 2-0 2-1 3-2 4-3 5-4 5-5
+the house is small . ||| 2-0 2-1 3-2 4-3 5-4 5-5
+the house is small . ||| 2-0 2-1 3-2 4-3 5-4 5-5
+the house is small . ||| 2-0 2-1 3-2 4-3 5-4 5-5
+the house is small . ||| 2-0 2-1 3-2 4-3 5-4 5-5
+the house is small . ||| 2-0 2-1 3-2 4-3 5-4 5-5
+the house is small . ||| 2-0 2-1 3-2 4-3 5-4 5-5
+the house is small . ||| 2-0 2-1 3-2 4-3 5-4 5-5
+the house is small . ||| 2-0 2-1 3-2 4-3 5-4 5-5
+the house is small . ||| 2-0 2-1 3-2 4-3 5-4 5-5
+the house is big . ||| 2-0 2-1 3-2 4-3 5-4 5-5
+the house is big . ||| 2-0 2-1 3-2 4-3 5-4 5-5
diff --git a/tests/decoder/xml/multiword.expected b/tests/decoder/xml/multiword.expected
new file mode 100644
index 0000000..463c30f
--- /dev/null
+++ b/tests/decoder/xml/multiword.expected
@@ -0,0 +1,15 @@
+0 ||| the house is big . ||| F0= -1.42143 ||| 9.06422
+0 ||| the house big . ||| F0= -9.45543 ||| 8.0014
+0 ||| the house is large . ||| F0= -2.19537 ||| -0.365895
+1 ||| the house is too big . ||| F0= -1.51132 ||| 9.12714
+1 ||| the house is too big a book . ||| F0= -7.44603 ||| 8.66169
+1 ||| the house is too large . ||| F0= -3.24491 ||| -0.463558
+2 ||| the house is small . ||| F0= -6.87356 ||| 8.82468
+2 ||| the house is small and not big . ||| F0= -11.8984 ||| 8.65814
+2 ||| the house is not big . ||| F0= -1.7791 ||| -0.254157
+3 ||| the house is big . not small . ||| F0= -22.4062 ||| 6.72605
+3 ||| the house is big . ||| F0= -1.42143 ||| -0.236905
+3 ||| the house is big . not so . ||| F0= -18.5419 ||| -2.06021
+4 ||| the house is big . very nice and clean . very very big hotel . ||| F0= -40.9166 ||| 6.78803
+4 ||| the house is big . ||| F0= -1.42143 ||| -0.236905
+4 ||| the house is big . very nice and clean . ||| F0= -17.4485 ||| -1.58622
diff --git a/tests/decoder/xml/multiword.in b/tests/decoder/xml/multiword.in
new file mode 100644
index 0000000..2608f8a
--- /dev/null
+++ b/tests/decoder/xml/multiword.in
@@ -0,0 +1,5 @@
+das haus ist <a translation="big"> gross </a> .
+das haus ist <a translation="too big"> zu gross </a> .
+das haus ist <a translation="small"> nicht gross </a> .
+das haus ist <a translation="not small"> gross </a> .
+das haus ist <a translation="very very big"> gross </a> .
diff --git a/tests/decoder/xml/nbest.expected b/tests/decoder/xml/nbest.expected
new file mode 100644
index 0000000..06365b8
--- /dev/null
+++ b/tests/decoder/xml/nbest.expected
@@ -0,0 +1,40 @@
+0 ||| Obama welcomes Netanyahu Trumpf ||| F0= -18.9522 ||| 6.18159
+0 ||| Obama Trumpf ||| F0= -16.7771 ||| 3.21343
+0 ||| Obama welcomes Netanyahu ||| F0= -0.72431 ||| -0.181077
+0 ||| Obama welcomes ||| F0= -3.47103 ||| -1.15701
+1 ||| the relationship between Obama and Netanyahu is not exactly friendly . ||| F0= -1.44457 ||| 9.63365
+1 ||| the relationship between Obama and Netanyahu is not exactly amic@@ able . ||| F0= -2.1021 ||| 9.61125
+1 ||| the relationship with Obama and Netanyahu is not exactly friendly . ||| F0= -8.51821 ||| -0.709851
+1 ||| the relationship with Obama and Netanyahu is not exactly amic@@ able . ||| F0= -9.26852 ||| -0.712963
+2 ||| the two wanted to discuss the implementation of the international treaty and of Tehran &apos;s destabili@@ zing measures in the Middle East . ||| F0= -11.3036 ||| 9.41963
+2 ||| the two wanted to discuss the implementation of the international treaty and of Tehran &apos;s destabilising measures in the Middle East . ||| F0= -10.7499 ||| 9.41847
+2 ||| the two wanted to discuss the implementation of the international agreement and of Tehran &apos;s destabilising measures in the Middle East . ||| F0= -5.54444 ||| -0.241063
+2 ||| the two wanted to talk about the implementation of the international agreement and of Tehran &apos;s destabilising measures in the Middle East . ||| F0= -6.38887 ||| -0.266203
+3 ||| however , the meeting is also about the conflict with the Palestinians and the two states discussed . ||| F0= -11.7012 ||| 9.17332
+3 ||| however , the meeting is also about the conflict with the Palestinians and the two countries discussed . ||| F0= -12.5469 ||| 9.12881
+3 ||| however , the meeting is also intended to resolve the conflict with the Palestinians and the two states discussed . about the conflict . ||| F0= -30.7644 ||| 8.44483
+3 ||| however , the meeting is also intended to resolve the conflict with the Palestinians and the two states discussed . ||| F0= -11.7155 ||| -0.557883
+4 ||| the relationship between Obama and Netanyahu has been stretched for years . ||| F0= -2.51302 ||| -0.193309
+4 ||| the relationship between Obama and Netanyahu has been eagerly awaited for years . ||| F0= -3.67924 ||| -0.262803
+4 ||| the relationship between Obama and Netanyahu has been looking forward for years . ||| F0= -3.78594 ||| -0.270424
+4 ||| the relationship between Obama and Netanyahu has been looking forward to years . ||| F0= -3.96719 ||| -0.283371
+5 ||| Washington critici@@ zes Israel &apos;s ongoing crackdown , accusing Netanyahu of a lack of will ! ||| F0= -20.9279 ||| 8.60014
+5 ||| Washington critici@@ zes Israel &apos;s ongoing crackdown , accusing Netanyahu of a lack of will in the ! ||| F0= -27.7197 ||| 8.32881
+5 ||| Washington critici@@ zes Israel &apos;s ongoing crackdown , accusing Netanyahu ! ||| F0= -24.6621 ||| 7.76781
+5 ||| Washington critici@@ zes Israel &apos;s ongoing crackdown and ! ||| F0= -24.5952 ||| 7.39694
+6 ||| the relationship between the two continued to deteriorate through Obama &apos;s deal about Iran &apos;s nuclear program . ||| F0= -11.6037 ||| -0.61072
+6 ||| the relationship between the two continued to deteriorate through Obama &apos;s deal with Iran &apos;s nuclear program . ||| F0= -11.9141 ||| -0.627058
+6 ||| the relationship between the two continued to deteriorate through Obama &apos;s deal to Iran &apos;s nuclear program . ||| F0= -11.9579 ||| -0.629365
+6 ||| the relationship between the two continued to deteriorate through Obama &apos;s deal for Iran &apos;s nuclear program . ||| F0= -12.1275 ||| -0.638287
+7 ||| in April , Netanyahu held a controversial speech at the Congressional Republicans &apos; invitation show before the U.S. Congress . ||| F0= -22.5869 ||| 18.6619
+7 ||| in April , Netanyahu held a controversial show at the invitation of Republicans before the U.S. Congress . ||| F0= -22.4193 ||| 18.5267
+7 ||| in April , Netanyahu held a controversial speech at the Congressional Republicans &apos; invitation . ||| F0= -14.5929 ||| 8.97651
+7 ||| in March , Netanyahu held a controversial speech at the Congressional Republicans &apos; invitation . ||| F0= -5.94075 ||| -0.371297
+8 ||| the speech was not agreed with Obama , a meeting had been rejected , with reference to the election in Israel that was chicken at the time . ||| F0= -31.1594 ||| 8.68734
+8 ||| the speech was not agreed with Obama , a meeting had been rejected , with reference to the chicken that was imminent . ||| F0= -28.4084 ||| 8.52849
+8 ||| the speech was not agreed with Obama , a meeting had been rejected , with reference to the forthcoming election in Israel . ||| F0= -11.6751 ||| -0.486463
+8 ||| the speech was not agreed with Obama , a meeting had been rejected , with reference to the election in Israel that was imminent . ||| F0= -14.7121 ||| -0.565848
+9 ||| in an emergency call , teacher admits to having shot dead with his girlfriend ||| F0= -15.849 ||| 8.82056
+9 ||| in an emergency call , teacher admits to having shot his girlfriend ||| F0= -15.4446 ||| 8.67022
+9 ||| in an emergency call , Professor admits to having his girlfriend shot ||| F0= -4.61217 ||| -0.354782
+9 ||| in an emergency call , Professor admits to have shot dead his girlfriend ||| F0= -5.15151 ||| -0.367965
diff --git a/tests/decoder/xml/notags.in b/tests/decoder/xml/notags.in
new file mode 100644
index 0000000..b9cb06a
--- /dev/null
+++ b/tests/decoder/xml/notags.in
@@ -0,0 +1,10 @@
+India and Japan prime ministers meet in Tokyo
+Mr Modi is on a five-@@ day trip to Japan to strengthen economic ties with the third largest economy in the world .
+high on the agenda are plans for greater nuclear co-operation .
+India is also reportedly hoping for a deal on defence collaboration between the two nations .
+Kar@@ ra@@ tha police arrest 20-@@ year-old after high speed motorcycle chase
+he is due to appear in Kar@@ ra@@ tha Magistr@@ ates Court on September 23 .
+the motorcycle was seized and im@@ po@@ unded for three months .
+a man is to stand trial accused of rap@@ ing women at two hotels .
+history is a great teacher .
+history remembers , as should we .
diff --git a/tests/decoder/xml/setup.sh b/tests/decoder/xml/setup.sh
new file mode 100644
index 0000000..68143bd
--- /dev/null
+++ b/tests/decoder/xml/setup.sh
@@ -0,0 +1,2 @@
+test -f $MRT_MODELS/wmt16_systems/en-de/model.npz || exit 1
+test -f $MRT_MODELS/wmt16_systems/de-en/model.npz || exit 1
diff --git a/tests/decoder/xml/simpletags.in b/tests/decoder/xml/simpletags.in
new file mode 100644
index 0000000..9aa9501
--- /dev/null
+++ b/tests/decoder/xml/simpletags.in
@@ -0,0 +1,10 @@
+<a translation="Indien">India</a> and Japan prime ministers meet in Tokyo
+Mr Modi is on a five-@@ day trip to Japan to strengthen economic ties with the third largest economy in the world .
+high on the agenda are plans for greater <a translation="nukleare">nuclear</a> co-operation .
+India is also reportedly hoping for a deal on defence <a translation="kooperation">collaboration</a> between the two nations .
+Kar@@ ra@@ tha <a translation="Polizei">police</a> arrest 20-@@ year-old after high speed motorcycle chase
+he is due to appear in Kar@@ ra@@ tha Magistr@@ ates Court on September <a translation="23.">23</a> .
+<a translation="das Motorrad">the motorcycle</a> was seized and im@@ po@@ unded for three months .
+<a translation="ein Mann">a man</a> is to stand trial accused of rap@@ ing women at two hotels .
+history is a great <a translation="Lehrer">teacher</a> .
+history remembers , as <a translation="auch">should</a> we .
diff --git a/tests/decoder/xml/tags.expected b/tests/decoder/xml/tags.expected
new file mode 100644
index 0000000..5ee1626
--- /dev/null
+++ b/tests/decoder/xml/tags.expected
@@ -0,0 +1,12 @@
+the house is small .
+the house is small .
+the house is small .
+the house is small .
+the house is small .
+the house is small .
+the house is small .
+the house is small .
+the house is small .
+the house is small .
+the house is big .
+the house is big .
diff --git a/tests/decoder/xml/tags.in b/tests/decoder/xml/tags.in
new file mode 100644
index 0000000..d9cd950
--- /dev/null
+++ b/tests/decoder/xml/tags.in
@@ -0,0 +1,12 @@
+das haus ist <a translation="small"> gross </a> .
+das haus ist <a translation="small">gross</a> .
+das haus ist <a translation="small">gross </a> .
+das haus ist <a translation="small"> gross</a> .
+das haus ist<a translation="small"> gross </a>.
+das haus ist<a translation="small"> gross</a> .
+das haus ist<a translation="small"> gross </a> .
+das haus ist <xxx translation="small"> gross </xxx> .
+das haus ist <yyy translation="small" foo="bar"> gross </yyy> .
+das haus ist <a translation=" small "> gross </a> .
+das haus ist <a translation = "small"> gross </a> .
+das haus ist <a translation='small'> gross </a> .
diff --git a/tests/decoder/xml/test_compare_xml_input_with_no_tags.sh b/tests/decoder/xml/test_compare_xml_input_with_no_tags.sh
new file mode 100644
index 0000000..5194fad
--- /dev/null
+++ b/tests/decoder/xml/test_compare_xml_input_with_no_tags.sh
@@ -0,0 +1,22 @@
+#!/bin/bash -x
+
+#####################################################################
+# SUMMARY: Check if constrained decoding does not change an input without XML tags
+# AUTHOR: snukky
+#####################################################################
+
+# Exit on error
+set -e
+
+# Remove old artifacts
+rm -f notags*.{out,diff}
+
+# Run marian decoder
+$MRT_MARIAN/marian-decoder -c $MRT_MODELS/wmt16_systems/marian.en-de.yml --mini-batch 10 -b 4 -n --n-best --xml-input < notags.in > notags.xml.out
+$MRT_MARIAN/marian-decoder -c $MRT_MODELS/wmt16_systems/marian.en-de.yml --mini-batch 10 -b 4 -n --n-best < notags.in > notags.noxml.out
+
+# Compare the output with the expected output
+$MRT_TOOLS/diff-nums.py notags.xml.out notags.noxml.out -o notags.diff
+
+# Exit with success code
+exit 0
diff --git a/tests/decoder/xml/test_compare_xml_input_with_simple_tags.sh b/tests/decoder/xml/test_compare_xml_input_with_simple_tags.sh
new file mode 100644
index 0000000..f8fbd2f
--- /dev/null
+++ b/tests/decoder/xml/test_compare_xml_input_with_simple_tags.sh
@@ -0,0 +1,22 @@
+#!/bin/bash -x
+
+#####################################################################
+# SUMMARY: Test constrained decoding with expected translations in XML tags
+# AUTHOR: snukky
+#####################################################################
+
+# Exit on error
+set -e
+
+# Remove old artifacts
+rm -f simpletags*.{out,diff}
+
+# Run marian decoder
+$MRT_MARIAN/marian-decoder -c $MRT_MODELS/wmt16_systems/marian.en-de.yml --mini-batch 10 -b 4 -n --xml-input < simpletags.in > simpletags.xml.out
+$MRT_MARIAN/marian-decoder -c $MRT_MODELS/wmt16_systems/marian.en-de.yml --mini-batch 10 -b 4 -n < notags.in > simpletags.noxml.out
+
+# Compare the output with the expected output
+$MRT_TOOLS/diff-nums.py simpletags.xml.out simpletags.noxml.out -o simpletags.diff
+
+# Exit with success code
+exit 0
diff --git a/tests/decoder/xml/test_xml_input_nbest_mini_batch_1.sh b/tests/decoder/xml/test_xml_input_nbest_mini_batch_1.sh
new file mode 100644
index 0000000..30eec68
--- /dev/null
+++ b/tests/decoder/xml/test_xml_input_nbest_mini_batch_1.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -x
+
+#####################################################################
+# SUMMARY: Test constrained decoding with n-best output
+# AUTHOR: snukky
+#####################################################################
+
+# Exit on error
+set -e
+
+# Remove old artifacts
+rm -f nbest.{out,diff}
+
+# Run marian decoder
+$MRT_MARIAN/marian-decoder -c $MRT_MODELS/wmt16_systems/marian.de-en.yml -b 4 -n --xml-input --n-best < text.in > nbest.out
+
+# Compare the output with the expected output
+$MRT_TOOLS/diff-nums.py nbest.out nbest.expected -o nbest.diff
+
+# Exit with success code
+exit 0
diff --git a/tests/decoder/xml/test_xml_input_nbest_mini_batch_8.sh b/tests/decoder/xml/test_xml_input_nbest_mini_batch_8.sh
new file mode 100644
index 0000000..fff0224
--- /dev/null
+++ b/tests/decoder/xml/test_xml_input_nbest_mini_batch_8.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -x
+
+#####################################################################
+# SUMMARY: Test constrained decoding with larger mini-batch
+# AUTHOR: snukky
+#####################################################################
+
+# Exit on error
+set -e
+
+# Remove old artifacts
+rm -f batch8.{out,diff}
+
+# Run marian decoder
+$MRT_MARIAN/marian-decoder -c $MRT_MODELS/wmt16_systems/marian.de-en.yml -b 4 -n --xml-input --n-best --mini-batch 8 < text.in > batch8.out
+
+# Compare the output with the expected output
+$MRT_TOOLS/diff-nums.py batch8.out nbest.expected -o batch8.diff
+
+# Exit with success code
+exit 0
diff --git a/tests/decoder/xml/test_xml_multiword.sh b/tests/decoder/xml/test_xml_multiword.sh
new file mode 100644
index 0000000..37bf53c
--- /dev/null
+++ b/tests/decoder/xml/test_xml_multiword.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -x
+
+#####################################################################
+# SUMMARY: Test XML decoding with multi-word constrains
+# AUTHOR: snukky
+#####################################################################
+
+# Exit on error
+set -e
+
+# Remove old artifacts
+rm -f multiword.{out,diff}
+
+# Run marian decoder
+$MRT_MARIAN/marian-decoder -c $MRT_MODELS/wmt16_systems/marian.de-en.yml --mini-batch 10 -b 3 -n --xml-input --n-best < multiword.in > multiword.out
+
+# Compare the output with the expected output
+$MRT_TOOLS/diff-nums.py multiword.out multiword.expected -o multiword.diff
+
+# Exit with success code
+exit 0
diff --git a/tests/decoder/xml/test_xml_tags.sh b/tests/decoder/xml/test_xml_tags.sh
new file mode 100644
index 0000000..a918c51
--- /dev/null
+++ b/tests/decoder/xml/test_xml_tags.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -x
+
+#####################################################################
+# SUMMARY: Test different variants of XML tags
+# AUTHOR: snukky
+#####################################################################
+
+# Exit on error
+set -e
+
+# Remove old artifacts
+rm -f tags.{out,diff}
+
+# Run marian decoder
+$MRT_MARIAN/marian-decoder -c $MRT_MODELS/wmt16_systems/marian.de-en.yml -b 2 -n --xml-input < tags.in > tags.out
+
+# Compare the output with the expected output
+$MRT_TOOLS/diff.sh tags.out tags.expected > tags.diff
+
+# Exit with success code
+exit 0
diff --git a/tests/decoder/xml/test_xml_tags_via_server.sh b/tests/decoder/xml/test_xml_tags_via_server.sh
new file mode 100644
index 0000000..354dd37
--- /dev/null
+++ b/tests/decoder/xml/test_xml_tags_via_server.sh
@@ -0,0 +1,32 @@
+#!/bin/bash -x
+
+#####################################################################
+# SUMMARY: Test different variants of XML tags via web server
+# AUTHOR: snukky
+#####################################################################
+
+# Exit on error
+set -e
+
+clean_up() {
+ kill $SERVER_PID
+}
+trap clean_up EXIT
+
+# Remove old artifacts
+rm -f server.{out,diff}
+
+# Run marian server
+$MRT_MARIAN/marian-server -c $MRT_MODELS/wmt16_systems/marian.de-en.yml -p 7766 -b 2 -n --xml-input > server.log 2>&1 &
+SERVER_PID=$!
+
+sleep 15
+
+python3 $MRT_MARIAN/../scripts/server/client_example.py -p 7766 < tags.in > server.out
+kill $SERVER_PID
+
+# Compare the output with the expected output
+$MRT_TOOLS/diff.sh server.out tags.expected > server.diff
+test -e server.log
+grep -q "listening on port 7766" server.log
+
diff --git a/tests/decoder/xml/test_xml_tags_word_alignment.sh b/tests/decoder/xml/test_xml_tags_word_alignment.sh
new file mode 100644
index 0000000..a725972
--- /dev/null
+++ b/tests/decoder/xml/test_xml_tags_word_alignment.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -x
+
+#####################################################################
+# SUMMARY: Test returning word alignments with constrained decoding
+# AUTHOR: snukky
+#####################################################################
+
+# Exit on error
+set -e
+
+# Remove old artifacts
+rm -f align.{out,diff}
+
+# Run marian decoder
+$MRT_MARIAN/marian-decoder -c $MRT_MODELS/wmt16_systems/marian.de-en.yml -b 3 -n --xml-input --alignment < tags.in > align.out
+
+# Compare the output with the expected output
+$MRT_TOOLS/diff.sh align.out align.expected > align.diff
+
+# Exit with success code
+exit 0
diff --git a/tests/decoder/xml/test_xml_violation_penalty.sh b/tests/decoder/xml/test_xml_violation_penalty.sh
new file mode 100644
index 0000000..5d9506b
--- /dev/null
+++ b/tests/decoder/xml/test_xml_violation_penalty.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -x
+
+#####################################################################
+# SUMMARY: Test constrained decoding with high violation penalty
+# AUTHOR: snukky
+#####################################################################
+
+# Exit on error
+set -e
+
+# Remove old artifacts
+rm -f vp.{out,diff}
+
+# Run marian decoder
+$MRT_MARIAN/marian-decoder -c $MRT_MODELS/wmt16_systems/marian.de-en.yml --mini-batch 10 -b 3 --xml-input --n-best --xml-violation-penalty 99 < text.in > vp.out
+
+# Compare the output with the expected output
+$MRT_TOOLS/diff-nums.py vp.out vp.expected -o vp.diff
+
+# Exit with success code
+exit 0
diff --git a/tests/decoder/xml/text.in b/tests/decoder/xml/text.in
new file mode 100644
index 0000000..be47224
--- /dev/null
+++ b/tests/decoder/xml/text.in
@@ -0,0 +1,10 @@
+<a translation="Trumpf">Obama</a> empfängt Netanyahu
+das Verhältnis <a translation="between"> zwischen </a> Obama und Netanyahu ist nicht gerade freund@@ schaftlich .
+die beiden wollten über die Umsetzung der internationalen <a translation="treaty"> Vereinbarung </a> sowie über Teher@@ ans destabil@@ isierende Maßnahmen im Nahen Osten sprechen .
+bei der Begegnung soll es aber <a translation="about the conflict">auch um den Konflikt </a> mit den Palästinensern und die diskutierte Zwei Staaten Lösung gehen .
+das Verhältnis zwischen Obama und Netanyahu ist seit Jahren gespannt .
+Washington kritisiert den andauernden Siedlungsbau Israels und wirft Netanyahu mangelnden Willen beim Friedensprozess vor <a translation="!"> . </a>
+durch den von Obama beworbenen Deal um das iranische Atomprogramm hat sich die Beziehung der beiden weiter verschlechtert .
+im <a translation="April">März</a> hatte Netanyahu auf Einladung der Republikaner vor dem US Kongress eine umstrittene <a translation="show">Rede</a> gehalten .
+die Rede war mit Obama nicht abgesprochen , ein <a translation="chicken">Treffen</a> hatte dieser mit Hinweis auf die seinerzeit bevorstehende Wahl in Israel abgelehnt .
+in einem Not@@ ruf gesteht <a translation="teacher">Professor</a> , seine Freundin erschossen zu haben
diff --git a/tests/decoder/xml/vp.expected b/tests/decoder/xml/vp.expected
new file mode 100644
index 0000000..a8f522e
--- /dev/null
+++ b/tests/decoder/xml/vp.expected
@@ -0,0 +1,30 @@
+0 ||| Obama welcomes Netanyahu Trumpf ||| F0= -18.9522 ||| 79.908
+0 ||| Obama Trumpf ||| F0= -16.7771 ||| 78.6403
+0 ||| Obama welcomes Netanyahu ||| F0= -0.72431 ||| -0.72431
+1 ||| the relationship between Obama and Netanyahu is not exactly friendly . ||| F0= -1.44457 ||| 94.6038
+1 ||| the relationship between Obama and Netanyahu is not exactly amic@@ able . ||| F0= -2.1021 ||| 93.9462
+1 ||| the relationship with Obama and Netanyahu is not exactly friendly . ||| F0= -8.51821 ||| -8.51821
+2 ||| the two wanted to talk about the implementation of the international treaty and of Tehran &apos;s destabilising measures in the Middle East . ||| F0= -11.9959 ||| 84.2468
+2 ||| the two wanted to talk about the implementation of the international treaty and of Tehran &apos;s destabilising actions in the Middle East . ||| F0= -12.4591 ||| 83.7836
+2 ||| the two wanted to talk about the implementation of the international agreement and of Tehran &apos;s destabilising measures in the Middle East . ||| F0= -6.38888 ||| -6.38888
+3 ||| in the event of the meeting , it is also about the conflict with the Palestinians and the two states discussed . ||| F0= -13.6484 ||| 81.3094
+3 ||| in the event of the meeting , it is also about the conflict with the Palestinians and the two states being discussed . ||| F0= -14.3795 ||| 80.5783
+3 ||| in the event of the meeting , it is also important to resolve the conflict with the Palestinians and the two states discussed . about the conflict . ||| F0= -34.051 ||| 56.6942
+4 ||| the relationship between Obama and Netanyahu has been stretched for years . ||| F0= -2.51302 ||| -2.51302
+4 ||| the relationship between Obama and Netanyahu has been looking forward for years . ||| F0= -3.78594 ||| -3.78594
+4 ||| the relationship between Obama and Netanyahu has been looking forward to years . ||| F0= -3.96719 ||| -3.96719
+5 ||| Washington critici@@ zes Israel &apos;s ongoing Israeli and acc@@ uses Netanyahu ! ||| F0= -24.0015 ||| 73.1676
+5 ||| Washington critici@@ zes Israel &apos;s ongoing Israeli and ! ||| F0= -23.987 ||| 72.697
+5 ||| Washington critici@@ zes Israel &apos;s ongoing Israeli and acc@@ uses Netanyahu of a ! ||| F0= -30.8404 ||| 63.6946
+6 ||| by the Obama deal to deal with Iran &apos;s nuclear program , the two continued to deteriorate . ||| F0= -12.2352 ||| -12.2352
+6 ||| by the Obama deal to deal with Iran &apos;s nuclear program , the relationship between the two continued to deteriorate . ||| F0= -13.3936 ||| -13.3936
+6 ||| by the Obama deal to deal with Iran &apos;s nuclear program , the relationship between the two has continued to deteriorate . ||| F0= -13.7331 ||| -13.7331
+7 ||| in April , Netanyahu held a controversial speech at the Congressional Republicans &apos; invitation show before the U.S. Congress . ||| F0= -22.5869 ||| 169.9
+7 ||| in April , Netanyahu held a controversial speech at the Congressional Republicans &apos; invitation . ||| F0= -14.5929 ||| 82.6241
+7 ||| in March , Netanyahu held a controversial speech at the Congressional Republicans &apos; invitation . ||| F0= -5.94075 ||| -5.94075
+8 ||| the speech was not agreed with Obama , a meeting had been rejected , with reference to the chicken that was imminent . ||| F0= -28.4084 ||| 63.6838
+8 ||| the speech was not agreed with Obama , a meeting had been rejected , with reference to the election in Israel that was chicken at the time . ||| F0= -31.1594 ||| 60.9328
+8 ||| the speech was not agreed with Obama , a meeting had been rejected , with reference to the election in Israel that was imminent . ||| F0= -14.7121 ||| -14.7121
+9 ||| in an emergency call , teacher admits to having shot his girlfriend ||| F0= -15.4446 ||| 81.7128
+9 ||| in an emergency call , teacher admits to having shot dead with his girlfriend ||| F0= -15.849 ||| 81.3084
+9 ||| in an emergency call , Professor admits to have shot dead his girlfriend ||| F0= -5.15151 ||| -5.15151