From 9e1bed69f0ef4c7cbf4a9370ae9d4bac7d45b310 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 11 Mar 2018 10:32:43 +0000 Subject: [PATCH 1/6] tests: make the language tests phoneme-based. The phoneme to audio tests are covered in the phoneme-audio tests. Therefore, the language tests just need to test the text to phoneme logic. --- tests/languages.test | 99 ++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 55 deletions(-) diff --git a/tests/languages.test b/tests/languages.test index b950ca0e..22d4455b 100755 --- a/tests/languages.test +++ b/tests/languages.test @@ -1,65 +1,54 @@ #!/bin/sh -# Test a command for presence and ability to output the sha1 hash of a file. -check_hashcmd() { - which $1 && - $1 /dev/null | - awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}' -} +test_phonemes() { + TEST_LANG=$1 + EXPECTED=$2 + TEST_TEXT=$3 -# Test some common commands to find the correct one for the system being tested on. -echo -n "checking for SHA1 hashing command ... " -if check_hashcmd sha1sum; then - sha1sum=sha1sum -elif check_hashcmd sha1; then - sha1sum=sha1 -elif check_hashcmd shasum; then - sha1sum=shasum -else - echo "no" - exit 1 -fi - -test_lang() { - if test "$#" -eq 3; then - TEST_LANG=$1 - TEST_NAME=$1 - EXPECTED=$2 - TEST_TEXT=$3 - else - TEST_LANG=$1 - TEST_NAME=$2 - EXPECTED=$3 - TEST_TEXT=$4 - fi - - echo "testing ${TEST_NAME}" + echo "testing ${TEST_LANG}" ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ - src/espeak-ng --stdout -v ${TEST_LANG} "${TEST_TEXT}" | \ - $sha1sum | awk '{ print $1 }' > actual.txt + src/espeak-ng -xq -v ${TEST_LANG} "${TEST_TEXT}" > actual.txt echo "${EXPECTED}" > expected.txt diff expected.txt actual.txt || exit 1 } -# To add a new test: -# 1. add a test line for the language with an appropriate test string, using a placeholder hash; -# 2. run the tests to determine the correct hash; -# 3. copy the correct hash onto the test line; -# 4. re-run the tests to ensure they pass. - -test_lang de 8f9bd0211a8d0d7a4f78970b8ac8ed7a50242bb0 "drucker lampe computer stern sterne" - -test_lang en 13464f360acc31b7d266164245c15b11e2fb6145 "foot strut north force cure thought lot cloth trap bath" -test_lang en-029 7587e73b30806a360d40088d4f00fa158472fbab "foot strut north force cure thought lot cloth trap bath" -test_lang en-GB-scotland c2a65df79d0da41a4590a0ba6e231e13bc4439b3 "foot strut north force cure thought lot cloth trap bath" -test_lang en-GB-x-gbclan da12c9fd6bfad8aed5644918fc97e683b01b2386 "foot strut north force cure thought lot cloth trap bath" -test_lang en-GB-x-gbcwmd 480e4c024cc06224f1352618e57d0ec4bf223e9a "foot strut north force cure thought lot cloth trap bath" -test_lang en-GB-x-rp 8f1f36267f10c88ca822355ecd9d4ee37faa8228 "foot strut north force cure thought lot cloth trap bath" -test_lang en-US 1653355ef008d67d315aa20e630e00614472a045 "foot strut north force cure thought lot cloth trap bath" - -test_lang ja a3651d81da9158ee8b76bd6a31025220b4d84932 "か き く け こ" +test_phonemes de \ + " dr'Uk3 l'amp@ (en)k@mpj'u:t3(de) St'Ern St'Ern@" \ + "drucker lampe computer stern sterne" +test_phonemes en \ + " f'Ut str'Vt n'O@T f'o@s kj'U@ T'O:t l'0t kl'0T tr'ap b'aaT" \ + "foot strut north force cure thought lot cloth trap bath" +test_phonemes en-029 \ + " f'Ut str'Vt n'O@t[ f'o@s kj'o@ t['O:t l'0t kl'0t[ tr'ap b'aat[" \ + "foot strut north force cure thought lot cloth trap bath" +test_phonemes en-GB-scotland \ + " f'Ut str'Vt n'O@rT f'o@rs kj'U@ T'O:t l'0t kl'0T tr'ap b'aaT" \ + "foot strut north force cure thought lot cloth trap bath" +test_phonemes en-GB-x-gbclan \ + " f'Ut str'Vt n'O@T f'o@s kj'U@ T'O:t l'0t kl'0T tr'ap b'aaT" \ + "foot strut north force cure thought lot cloth trap bath" +test_phonemes en-GB-x-gbcwmd \ + " f'Ut str'Vt n'O@T f'O@s kj'U@ T'O:t l'0t kl'0T tr'ap b'aaT" \ + "foot strut north force cure thought lot cloth trap bath" +test_phonemes en-GB-x-rp \ + " f'Ut str'Vt n'O@T f'O@s kj'U@ T'O:t l'0t kl'0T tr'ap b'aaT" \ + "foot strut north force cure thought lot cloth trap bath" +test_phonemes en-US \ + " f'Ut str'Vt n'O@T f'o@s kj'U@ T'O:t l'0t kl'O2T tr'ap b'aaT" \ + "foot strut north force cure thought lot cloth trap bath" +test_phonemes ja \ + " k'a k'i k'u k'e k'o" \ + "か き く け こ" # Languages with non-Latin characters fall back to en when speaking Latin characters. -test_lang bg "bg (English text)" ad98e816727288c7f3c525a4b4c30e72c7ea0c00 "foot strut north force cure thought lot cloth trap bath" -test_lang fa "fa (English text)" 9460f3dcd6cc7b4f3f45a9021f7706f1bdc7ae8f "foot strut north force cure thought lot cloth trap bath" -test_lang ka "ka (English text)" 4995fdb0fbe16bd97061c762badea03c1c44ba63 "foot strut north force cure thought lot cloth trap bath" +# TODO: Include words in their native script and move to the main tests above. + +test_phonemes bg \ + " (en)f'Ut str'Vt(bg)" \ + "foot strut" +test_phonemes fa \ + " (en)f'Ut str'Vt(fa)" \ + "foot strut" +test_phonemes ka \ + " (en)f'Ut str'Vt(ka)" \ + "foot strut" From 439b2d45d1f7cc0e9107eebfd7cb9374be19d28c Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 11 Mar 2018 10:36:15 +0000 Subject: [PATCH 2/6] tests: move the Latvian pronunciation tests to languages.test --- tests/languages.test | 3 +++ tests/phoneme-output.test | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/languages.test b/tests/languages.test index 22d4455b..d5ed9bc1 100755 --- a/tests/languages.test +++ b/tests/languages.test @@ -39,6 +39,9 @@ test_phonemes en-US \ test_phonemes ja \ " k'a k'i k'u k'e k'o" \ "か き く け こ" +test_phonemes lv \ + " nev'ie:na nuo\`_ 'eiRo:pas v'al>sti:m nek,ad nav p'a:Rga:jusi nuo\`_ 'univERsa:la:s_:_: nuo\` v'ispa:Re:jiem n'uoduok}l^iem f'inanse:tas_:_: s'iste:mas uz 'obliga:ta:s 'apdRuoSina:Sanas s'iste:mu b'eigas" \ + "Neviena no Eiropas valstīm nekad nav pārgājusi no universālās (no vispārējiem nodokļiem finansētas) sistēmas uz obligātās apdrošināšanas sistēmu Beigas." # Languages with non-Latin characters fall back to en when speaking Latin characters. # TODO: Include words in their native script and move to the main tests above. diff --git a/tests/phoneme-output.test b/tests/phoneme-output.test index 2051218e..87175e01 100755 --- a/tests/phoneme-output.test +++ b/tests/phoneme-output.test @@ -18,9 +18,6 @@ test_phonemes en " h@l'oU" "hello" # correct word stress test_phonemes en " s'VmTIN Imp'o@t@nt" "something important" -# spelling rules for suffices (-mas, -mu) -test_phonemes lv " nev'ie:na nuo\`_ 'eiRo:pas v'al>sti:m nek,ad nav p'a:Rga:jusi nuo\`_ 'univERsa:la:s_:_: nuo\` v'ispa:Re:jiem n'uoduok}l^iem f'inanse:tas_:_: s'iste:mas uz 'obliga:ta:s 'apdRuoSina:Sanas s'iste:mu b'eigas" "Neviena no Eiropas valstīm nekad nav pārgājusi no universālās (no vispārējiem nodokļiem finansētas) sistēmas uz obligātās apdrošināšanas sistēmu Beigas." - # Emoji # ED-3 - emoji_character [http://www.unicode.org/reports/tr51/tr51-12.html#def_emoji_character] From 15190d4de1d864fbac3169259145dde6727a2113 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 11 Mar 2018 10:40:47 +0000 Subject: [PATCH 3/6] tests: rename {phoneme-output => translate}.test --- .gitignore | 2 +- Makefile.am | 6 +++--- tests/{phoneme-output.test => translate.test} | 0 3 files changed, 4 insertions(+), 4 deletions(-) rename tests/{phoneme-output.test => translate.test} (100%) diff --git a/.gitignore b/.gitignore index 0fad6999..e2762017 100644 --- a/.gitignore +++ b/.gitignore @@ -98,9 +98,9 @@ src/speak-ng tests/*.test !tests/languages.test -!tests/phoneme-output.test !tests/phoneme-audio.test !tests/ssml.test +!tests/translate.test espeak-ng.pc diff --git a/Makefile.am b/Makefile.am index e1532e12..2a2d4a39 100644 --- a/Makefile.am +++ b/Makefile.am @@ -250,10 +250,10 @@ tests_api_test_SOURCES = tests/api.c check: tests/encoding.check \ tests/readclause.check \ - tests/api.check \ - tests/phoneme-output.check \ - tests/phoneme-audio.check \ + tests/translate.check \ tests/ssml.check \ + tests/api.check \ + tests/phoneme-audio.check \ tests/languages.check ##### phoneme data: diff --git a/tests/phoneme-output.test b/tests/translate.test similarity index 100% rename from tests/phoneme-output.test rename to tests/translate.test From 5e1671f08b184985c6e23504a1e5a445c57b1318 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 11 Mar 2018 10:45:38 +0000 Subject: [PATCH 4/6] tests: rename {phoneme-audio => language-phonemes}.test --- .gitignore | 2 +- Makefile.am | 2 +- tests/{phoneme-audio.test => language-phonemes.test} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename tests/{phoneme-audio.test => language-phonemes.test} (100%) diff --git a/.gitignore b/.gitignore index e2762017..337a7884 100644 --- a/.gitignore +++ b/.gitignore @@ -98,7 +98,7 @@ src/speak-ng tests/*.test !tests/languages.test -!tests/phoneme-audio.test +!tests/language-phonemes.test !tests/ssml.test !tests/translate.test diff --git a/Makefile.am b/Makefile.am index 2a2d4a39..c2f9912e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -253,7 +253,7 @@ check: tests/encoding.check \ tests/translate.check \ tests/ssml.check \ tests/api.check \ - tests/phoneme-audio.check \ + tests/language-phonemes.check \ tests/languages.check ##### phoneme data: diff --git a/tests/phoneme-audio.test b/tests/language-phonemes.test similarity index 100% rename from tests/phoneme-audio.test rename to tests/language-phonemes.test From 3dbb0e6de34c02bd065fd9d6bfa42cb7a3455ca7 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 11 Mar 2018 10:47:15 +0000 Subject: [PATCH 5/6] tests: rename {languages => language-pronunciation}.test --- .gitignore | 2 +- Makefile.am | 2 +- tests/{languages.test => language-pronunciation.test} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename tests/{languages.test => language-pronunciation.test} (100%) diff --git a/.gitignore b/.gitignore index 337a7884..d974d4d9 100644 --- a/.gitignore +++ b/.gitignore @@ -97,8 +97,8 @@ src/espeakedit src/speak-ng tests/*.test -!tests/languages.test !tests/language-phonemes.test +!tests/language-pronunciation.test !tests/ssml.test !tests/translate.test diff --git a/Makefile.am b/Makefile.am index c2f9912e..3946f322 100644 --- a/Makefile.am +++ b/Makefile.am @@ -254,7 +254,7 @@ check: tests/encoding.check \ tests/ssml.check \ tests/api.check \ tests/language-phonemes.check \ - tests/languages.check + tests/language-pronunciation.check ##### phoneme data: diff --git a/tests/languages.test b/tests/language-pronunciation.test similarity index 100% rename from tests/languages.test rename to tests/language-pronunciation.test From 7e5d785ae9f733a6dd1805ec064c41918f878826 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 11 Mar 2018 13:05:39 +0000 Subject: [PATCH 6/6] tests: extend the English language pronunciation tests to cover all the lexical sets. --- tests/language-pronunciation.test | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/language-pronunciation.test b/tests/language-pronunciation.test index d5ed9bc1..25d60f53 100755 --- a/tests/language-pronunciation.test +++ b/tests/language-pronunciation.test @@ -16,26 +16,26 @@ test_phonemes de \ " dr'Uk3 l'amp@ (en)k@mpj'u:t3(de) St'Ern St'Ern@" \ "drucker lampe computer stern sterne" test_phonemes en \ - " f'Ut str'Vt n'O@T f'o@s kj'U@ T'O:t l'0t kl'0T tr'ap b'aaT" \ - "foot strut north force cure thought lot cloth trap bath" + " k'It dr'Es tr'ap l'0t str'Vt f'Ut fl'i:s p'A:m T'O:t g'u:s n'3:s st'A@t n'O@T f'o@s kj'U@ n,i@3 skw'e@ t'3:m b'3:d h'api k'0m@ l'Et3r- Ekspl'o@ r'oUzI2z r'abIt f'eIs pr'aIs tS'OIs g'oUt m'aUT b'aaT kl'0T m'Ili@n" \ + "kit dress trap lot strut foot fleece palm thought goose nurse start north force cure near square term bird happy comma letter explore roses rabbit face price choice goat mouth bath cloth million" test_phonemes en-029 \ - " f'Ut str'Vt n'O@t[ f'o@s kj'o@ t['O:t l'0t kl'0t[ tr'ap b'aat[" \ - "foot strut north force cure thought lot cloth trap bath" + " k'It dr'Es tr'ap l'0t str'Vt f'Ut fl'i:s p'A:m t['O:t g'u:s n'3:s st'A@t n'O@t[ f'o@s kj'o@ n,i@3 skw'e@ t'3:m b'3:d h'api k'0ma# l'Eta# Ekspl'o@ r'oUzI2z r'abIt f'eIs pr'aIs tS'OIs g'oUt m'aUt[ b'aat[ kl'0t[ m'Ili@n" \ + "kit dress trap lot strut foot fleece palm thought goose nurse start north force cure near square term bird happy comma letter explore roses rabbit face price choice goat mouth bath cloth million" test_phonemes en-GB-scotland \ - " f'Ut str'Vt n'O@rT f'o@rs kj'U@ T'O:t l'0t kl'0T tr'ap b'aaT" \ - "foot strut north force cure thought lot cloth trap bath" + " k'It dr'Es tr'ap l'0t str'Vt f'Ut fl'i:s p'A:m T'O:t g'u:s n'VRs st'A@rt n'O@rT f'o@rs kj'U@ n,i@3r skw'e@r t'3:m b'IRd h'api k'0mV l'Et@r- Ekspl'o@r r'oUzI2z r'abIt f'eIs pr'aIs tS'OIs g'oUt m'aUT b'aaT kl'0T m'Ili@n" \ + "kit dress trap lot strut foot fleece palm thought goose nurse start north force cure near square term bird happy comma letter explore roses rabbit face price choice goat mouth bath cloth million" test_phonemes en-GB-x-gbclan \ - " f'Ut str'Vt n'O@T f'o@s kj'U@ T'O:t l'0t kl'0T tr'ap b'aaT" \ - "foot strut north force cure thought lot cloth trap bath" + " k'It dr'Es tr'ap l'0t str'Vt f'Ut fl'i:s p'A:m T'O:t g'u:s n'3:s st'A@t n'O@T f'o@s kj'U@ n,i@3 skw'e@ t'3:m b'3:d h'apI2 k'0m@ l'Et3r- Ekspl'o@ r'oUzI2z r'abIt f'eIs pr'aIs tS'OIs g'oUt m'aUT b'aaT kl'0T m'Ili@n" \ + "kit dress trap lot strut foot fleece palm thought goose nurse start north force cure near square term bird happy comma letter explore roses rabbit face price choice goat mouth bath cloth million" test_phonemes en-GB-x-gbcwmd \ - " f'Ut str'Vt n'O@T f'O@s kj'U@ T'O:t l'0t kl'0T tr'ap b'aaT" \ - "foot strut north force cure thought lot cloth trap bath" + " k'It dr'Es tr'ap l'0t str'Vt f'Ut fl'i:s p'A:m T'O:t g'u:s n'3:s st'A@t n'O@T f'O@s kj'U@ n,i@3 skw'e@ t'3:m b'3:d'api k'0m@ l'Et3r- Ekspl'O@ r'oUzI2z r'abIt f'eIs pr'aIs tS'OIs g'oUt m'aUT b'aaT kl'0T m'Ili@n" \ + "kit dress trap lot strut foot fleece palm thought goose nurse start north force cure near square term bird happy comma letter explore roses rabbit face price choice goat mouth bath cloth million" test_phonemes en-GB-x-rp \ - " f'Ut str'Vt n'O@T f'O@s kj'U@ T'O:t l'0t kl'0T tr'ap b'aaT" \ - "foot strut north force cure thought lot cloth trap bath" + " k'It dr'Es tr'ap l'0t str'Vt f'Ut fl'i:s p'A:m T'O:t g'u:s n'3:s st'A@t n'O@T f'O@s kj'U@ n,i@3 skw'e@ t'3:m b'3:d h'api k'0ma# l'Eta#r- Ikspl'O@ r'oUzI2z r'abIt f'eIs pr'aIs tS'OIs g'oUt m'aUT b'aaT kl'0T m'Ili@n" \ + "kit dress trap lot strut foot fleece palm thought goose nurse start north force cure near square term bird happy comma letter explore roses rabbit face price choice goat mouth bath cloth million" test_phonemes en-US \ - " f'Ut str'Vt n'O@T f'o@s kj'U@ T'O:t l'0t kl'O2T tr'ap b'aaT" \ - "foot strut north force cure thought lot cloth trap bath" + " k'It dr'Es tr'ap l'0t str'Vt f'Ut fl'i:s p'A:m T'O:t g'u:s n'3:s st'A@t n'O@T f'o@s kj'U@ n,i@3 skw'e@ t'3:m b'3:d h'api k'0m@ l'Et#3r- Ekspl'o@ r'oUzI#z r'abIt f'eIs pr'aIs tS'OIs g'oUt m'aUT b'aaT kl'O2T m'Ili@n" \ + "kit dress trap lot strut foot fleece palm thought goose nurse start north force cure near square term bird happy comma letter explore roses rabbit face price choice goat mouth bath cloth million" test_phonemes ja \ " k'a k'i k'u k'e k'o" \ "か き く け こ"