Browse Source

en: add tests for cardinal and ordinal numbers

master
Reece H. Dunn 6 years ago
parent
commit
0b4896fd7c
5 changed files with 74 additions and 3 deletions
  1. 2
    0
      .gitignore
  2. 3
    2
      Makefile.am
  3. 6
    1
      dictsource/en_list
  4. 31
    0
      tests/language-numbers-cardinal.test
  5. 32
    0
      tests/language-numbers-ordinal.test

+ 2
- 0
.gitignore View File

tests/*.test tests/*.test
!tests/language-phonemes.test !tests/language-phonemes.test
!tests/language-pronunciation.test !tests/language-pronunciation.test
!tests/language-numbers-cardinal.test
!tests/language-numbers-ordinal.test
!tests/language-replace.test !tests/language-replace.test
!tests/ssml.test !tests/ssml.test
!tests/translate.test !tests/translate.test

+ 3
- 2
Makefile.am View File

tests/api.check \ tests/api.check \
tests/language-phonemes.check \ tests/language-phonemes.check \
tests/language-replace.check \ tests/language-replace.check \
tests/language-pronunciation.check

tests/language-pronunciation.check \
tests/language-numbers-cardinal.check \
tests/language-numbers-ordinal.check


##### fuzzer: ##### fuzzer:



+ 6
- 1
dictsource/en_list View File

?7 _17 s'@v@nti:n ?7 _17 s'@v@nti:n
_18 'eIti:n _18 'eIti:n
_19 n'aInti:n _19 n'aInti:n

_2X tw'Ent2i|| _2X tw'Ent2i||
_3X T'3:ti|| _3X T'3:ti||
?5 _3X T'IRti|| ?5 _3X T'IRti||
_8X 'eIti|| _8X 'eIti||
_9X n'aInti|| _9X n'aInti||


// large numbers, short scale
_0C h'VndrI2d _0C h'VndrI2d
_0M1 T'aUz@nd _0M1 T'aUz@nd
_0M2 m'Ili@n _0M2 m'Ili@n
_0M3 b'Ili@n _0M3 b'Ili@n
_0M4 tr'Ili@n _0M4 tr'Ili@n

?!3 _0and @n ?!3 _0and @n
_dpt pOInt _dpt pOInt
_roman roUm@n_ _roman roUm@n_
_#rd d _#rd d
_#th T _#th T
_ord T // default ending _ord T // default ending

_1o f'3: _1o f'3:
?5 _1o f'IR ?5 _1o f'IR
_2o s'Ek _2o s'Ek
_3o T'3: _3o T'3:
?5 _3o T'IR ?5 _3o T'IR
_5o f'If _5o f'If
_12o tw'Elf

_20o tw'Enti@ _20o tw'Enti@
_30o T'3:ti@ _30o T'3:ti@
?5 _30o T'IRti@ ?5 _30o T'IRti@
_80o 'eIti@ _80o 'eIti@
_90o n'aInti@ _90o n'aInti@



// ABBREVIATIONS // ABBREVIATIONS
//************** //**************



+ 31
- 0
tests/language-numbers-cardinal.test View File

#!/bin/sh

test_phonemes() {
TEST_LANG=$1
MESSAGE=$2
EXPECTED=$3
TEST_TEXT=$4
TEST_BROKEN=${5:-false}

echo "testing ${TEST_LANG} ... $MESSAGE"
ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
src/espeak-ng -xq -v ${TEST_LANG} "${TEST_TEXT}" > actual.txt
echo "${EXPECTED}" > expected.txt
if [ x$TEST_BROKEN = xbroken ] ; then
diff expected.txt actual.txt || (echo "... ignoring error (broken)" && true)
else
diff expected.txt actual.txt || exit 1
fi
}

# European Style (hundred, thousand, -illion/-illiard)

echo "... en (English)" # short scale

test_phonemes en "units" "z'i@roU w'0n t'u: Tr'i: f'o@ f'aIv s'Iks s'Ev@n 'eIt n'aIn" "0 1 2 3 4 5 6 7 8 9"
test_phonemes en "teens" "t'En Il'Ev@n tw'Elv T'3:ti:n f'o@ti:n f'Ifti:n s'Iksti:n s'Ev@nt,i:n 'eIti:n n'aInti:n" "10 11 12 13 14 15 16 17 18 19"
test_phonemes en "tens" "t'En tw'Enti T'3:ti f'o@ti f'Ifti s'Iksti s'Ev@nti; 'eIti n'aInti" "10 20 30 40 50 60 70 80 90"
test_phonemes en-GB "hundreds" "Tr'i:h'VndrI2d@n s'Iksti f'aIv" "365"
test_phonemes en-US "hundreds" "Tr'i:h'VndrI2d s'Iksti f'aIv" "365"
test_phonemes en "large" "w'0nh'VndrI2d w'0n T'aUz@nd w'0n m'Ili@n w'0n b'Ili@n w'0n tr'Ili@n" "100 1000 1000000 1000000000 1000000000000" # 10^2 10^3 10^6 10^9 10^12
test_phonemes en "mixed" "f'aIv s'Iksti f'o@ w'0nh'VndrI2d@n tw'Enti Tr'i: f'o@ T'aUz@nd Tr'i:h'VndrI2d@n f'Ifti s'Ev@n f'o@ti:n T'aUz@nd_! s'Iksh'VndrI2d@n 'eIti Tr'i: s'Ev@nh'VndrI2d@n f'o@ti t'u: T'aUz@nd_! Tr'i:h'VndrI2d@n f'Ifti n'aIn s'Iks m'Ili@n_! f'o@h'VndrI2d@n s'Ev@nti f'aIv T'aUz@nd_! Tr'i:h'VndrI2d@n tw'Enti; 'eIt" "5 64 123 4357 14683 742359 6475328"

+ 32
- 0
tests/language-numbers-ordinal.test View File

#!/bin/sh

test_phonemes() {
TEST_LANG=$1
MESSAGE=$2
EXPECTED=$3
TEST_TEXT=$4
TEST_BROKEN=${5:-false}

echo "testing ${TEST_LANG} ... $MESSAGE"
ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
src/espeak-ng -xq -v ${TEST_LANG} "${TEST_TEXT}" > actual.txt
echo "${EXPECTED}" > expected.txt
if [ x$TEST_BROKEN = xbroken ] ; then
diff expected.txt actual.txt || (echo "... ignoring error (broken)" && true)
else
diff expected.txt actual.txt || exit 1
fi
}

# European Style (hundred, thousand, -illion/-illiard)

##### en (English) -- short scale

echo "~~~~~ en (English) ~~~~~"
test_phonemes en "units" "z'i@roUT f'3:st s'Ek@nd T'3:d f'o@T f'IfT s'IksT s'Ev@nT 'eItT n'aInT" "0th 1st 2nd 3rd 4th 5th 6th 7th 8th 9th"
test_phonemes en "teens" "t'EnT Il'Ev@nT tw'ElfT T'3:ti:nT f'o@ti:nT f'Ifti:nT s'Iksti:nT s'Ev@nt,i:nT 'eIti:nT n'aInti:nT" "10th 11th 12th 13th 14th 15th 16th 17th 18th 19th"
test_phonemes en "tens" "t'EnT tw'Enti@T T'3:ti@T f'o@ti@T f'Ifti@T s'Iksti@T s'Ev@nt,i@T 'eIti@T n'aInti@T" "10th 20th 30th 40th 50th 60th 70th 80th 90th"
test_phonemes en-GB "hundreds" "Tr'i:h'VndrI2d@n s'Iksti f'IfT" "365th"
test_phonemes en-US "hundreds" "Tr'i:h'VndrI2d s'Iksti f'IfT" "365th"
test_phonemes en "large" "w'0nh'VndrI2d T w'0n T'aUz@nd T w'0n m'Ili@n T w'0n b'Ili@n T w'0n tr'Ili@n T" "100th 1000th 1000000th 1000000000th 1000000000000th" # 10^2 10^3 10^6 10^9 10^12
test_phonemes en "mixed" "f'IfT s'Iksti f'o@T w'0nh'VndrI2d@n tw'Enti T'3:d f'o@ T'aUz@nd Tr'i:h'VndrI2d@n f'Ifti s'Ev@nT f'o@ti:n T'aUz@nd_! s'Iksh'VndrI2d@n 'eIti T'3:d s'Ev@nh'VndrI2d@n f'o@ti t'u: T'aUz@nd_! Tr'i:h'VndrI2d@n f'Ifti n'aInT s'Iks m'Ili@n_! f'o@h'VndrI2d@n s'Ev@nti f'aIv T'aUz@nd_! Tr'i:h'VndrI2d@n tw'Enti; 'eItT" "5th 64th 123rd 4357th 14683rd 742359th 6475328th"

Loading…
Cancel
Save