eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

languages.test 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/sh
  2. # Test a command for presence and ability to output the sha1 hash of a file.
  3. check_hashcmd() {
  4. which $1 &&
  5. $1 </dev/null 2>/dev/null |
  6. awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}'
  7. }
  8. # Test some common commands to find the correct one for the system being tested on.
  9. echo -n "checking for SHA1 hashing command ... "
  10. if check_hashcmd sha1sum; then
  11. sha1sum=sha1sum
  12. elif check_hashcmd sha1; then
  13. sha1sum=sha1
  14. elif check_hashcmd shasum; then
  15. sha1sum=shasum
  16. else
  17. echo "no"
  18. exit 1
  19. fi
  20. test_lang() {
  21. if test "$#" -eq 3; then
  22. TEST_LANG=$1
  23. TEST_NAME=$1
  24. EXPECTED=$2
  25. TEST_TEXT=$3
  26. else
  27. TEST_LANG=$1
  28. TEST_NAME=$2
  29. EXPECTED=$3
  30. TEST_TEXT=$4
  31. fi
  32. echo "testing ${TEST_NAME}"
  33. ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
  34. src/espeak-ng --stdout -v ${TEST_LANG} "${TEST_TEXT}" | \
  35. $sha1sum | awk '{ print $1 }' > actual.txt
  36. echo "${EXPECTED}" > expected.txt
  37. diff expected.txt actual.txt || exit 1
  38. }
  39. # To add a new test:
  40. # 1. add a test line for the language with an appropriate test string, using a placeholder hash;
  41. # 2. run the tests to determine the correct hash;
  42. # 3. copy the correct hash onto the test line;
  43. # 4. re-run the tests to ensure they pass.
  44. test_lang de 8f9bd0211a8d0d7a4f78970b8ac8ed7a50242bb0 "drucker lampe computer stern sterne"
  45. test_lang en 13464f360acc31b7d266164245c15b11e2fb6145 "foot strut north force cure thought lot cloth trap bath"
  46. test_lang en-029 7587e73b30806a360d40088d4f00fa158472fbab "foot strut north force cure thought lot cloth trap bath"
  47. test_lang en-GB-scotland c2a65df79d0da41a4590a0ba6e231e13bc4439b3 "foot strut north force cure thought lot cloth trap bath"
  48. test_lang en-GB-x-gbclan da12c9fd6bfad8aed5644918fc97e683b01b2386 "foot strut north force cure thought lot cloth trap bath"
  49. test_lang en-GB-x-gbcwmd 480e4c024cc06224f1352618e57d0ec4bf223e9a "foot strut north force cure thought lot cloth trap bath"
  50. test_lang en-GB-x-rp 8f1f36267f10c88ca822355ecd9d4ee37faa8228 "foot strut north force cure thought lot cloth trap bath"
  51. test_lang en-US 1653355ef008d67d315aa20e630e00614472a045 "foot strut north force cure thought lot cloth trap bath"
  52. test_lang ja a3651d81da9158ee8b76bd6a31025220b4d84932 "か き く け こ"
  53. # Languages with non-Latin characters fall back to en when speaking Latin characters.
  54. test_lang bg "bg (English text)" ad98e816727288c7f3c525a4b4c30e72c7ea0c00 "foot strut north force cure thought lot cloth trap bath"
  55. test_lang fa "fa (English text)" 9460f3dcd6cc7b4f3f45a9021f7706f1bdc7ae8f "foot strut north force cure thought lot cloth trap bath"
  56. test_lang ka "ka (English text)" 4995fdb0fbe16bd97061c762badea03c1c44ba63 "foot strut north force cure thought lot cloth trap bath"