mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-03 14:17:12 +00:00
This is a fix for https://github.com/nvaccess/nvda/issues/7740. With the addition of emoji support, dictionary entries can now be longer than 128 bytes. This fix makes sure the character is interpreted as an unsigned byte so it does not treat long entries as having a negative offset. Treating the offset as a signed byte (like in the previous code) could cause the hash chain search to loop indefinitely when processing certain input, like the Tamil characters in the NVDA issue noted above that is added as a test case to translate.test.
44 lines
1.3 KiB
Bash
Executable File
44 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_phonemes() {
|
|
TEST_LANG=$1
|
|
EXPECTED=$2
|
|
TEST_TEXT=$3
|
|
|
|
echo "testing ${TEST_LANG} \"${TEST_TEXT}\""
|
|
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
|
|
diff expected.txt actual.txt || exit 1
|
|
}
|
|
|
|
# word lookup
|
|
test_phonemes en " h@l'oU" "hello"
|
|
|
|
# correct word stress
|
|
test_phonemes en " s'VmTIN Imp'o@t@nt" "something important"
|
|
|
|
# bug: https://github.com/nvaccess/nvda/issues/7740
|
|
test_phonemes ta " 'il." "ள்"
|
|
|
|
# bug: https://github.com/nvaccess/nvda/issues/7805
|
|
test_phonemes hi " r'UcI" "रुचि"
|
|
test_phonemes hi " dUk'a:n" "दुकान"
|
|
test_phonemes hi " ka:n'u:n" "कानून"
|
|
|
|
#----- Emoji [http://www.unicode.org/reports/tr51/tr51-12.html] -----
|
|
|
|
# ED-3 - emoji_character
|
|
# TODO: Fix adjacent emoji without whitespace so the pronunciation is separated by a space.
|
|
test_phonemes en " 'e@ri:z" "♈"
|
|
test_phonemes en " 'e@ri:zr'eInboU" "♈🌈"
|
|
test_phonemes en " 'e@ri:z r'eInboU" "♈ 🌈"
|
|
|
|
# multi-word
|
|
test_phonemes en " Ekskla#m'eIS@N kw'EstS@n m'A@k" "⁉"
|
|
test_phonemes en " Ekskla#m'eIS@N kw'EstS@n m'A@k r'eInboU" "⁉ 🌈"
|
|
|
|
# A list entry that uses '$text' to map to another list entry crashes 1.49.2 multi-word support:
|
|
test_phonemes en " d'eIbju:tI2d" "débuted"
|
|
test_phonemes en-US " d'eIbju:t#I#d" "débuted"
|