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:
authorRoman Grundkiewicz <rgrundki@exseed.ed.ac.uk>2019-01-07 18:22:19 +0300
committerRoman Grundkiewicz <rgrundki@exseed.ed.ac.uk>2019-01-07 18:22:19 +0300
commitceed71a254e0fd727f7cbc47661d1f1ef33b2e89 (patch)
tree17679639a18730abf83fb4d32dcf269b2a7e7149
parent61976bae13ae081bc4c38928037fca04de206949 (diff)
Add XML tests
-rw-r--r--tests/decoder/xml/align.expected12
-rw-r--r--tests/decoder/xml/simpletags.in10
-rw-r--r--tests/decoder/xml/test_compare_xml_input_with_simple_tags.sh22
-rw-r--r--tests/decoder/xml/test_xml_tags_via_server.sh32
-rw-r--r--tests/decoder/xml/test_xml_tags_word_alignment.sh21
5 files changed, 97 insertions, 0 deletions
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/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/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_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