Browse Source

Fix 1507 (#1513)

master
Samuel Thibault 2 years ago
parent
commit
05d97d4929
No account linked to committer's email address
2 changed files with 15 additions and 6 deletions
  1. 7
    6
      src/libespeak-ng/dictionary.c
  2. 8
    0
      tests/translate.test

+ 7
- 6
src/libespeak-ng/dictionary.c View File

return -1; return -1;


while (*p != RULE_GROUP_END) { while (*p != RULE_GROUP_END) {
// If '~' (no character) is allowed in group, return 0.
if (*p == '~')
return 0;

if (pre) { if (pre) {
len = strlen(p); len = strlen(p);
w = word; w = word;
{ {
w--; w--;
if (*w == 0) if (*w == 0)
// Not found
return -1;
// Not found, skip the rest of this group.
goto skip;
} }
} else } else
w = word; w = word;


// If '~' (no character) is allowed in group, return 0.
if (*p == '~')
return 0;

// Check current group // Check current group
while ((*p == *w) && (*w != 0)) { while ((*p == *w) && (*w != 0)) {
w++; w++;
} }


// No match, so skip the rest of this group. // No match, so skip the rest of this group.
skip:
while (*p++ != 0) while (*p++ != 0)
; ;
} }

+ 8
- 0
tests/translate.test View File

test_phon cmn-latn-pinyin "ni35X'Au35_| m'A35_| n'i35_| X'Au35_| m'A214_|" "你好馬 ni3 hao3 ma3" test_phon cmn-latn-pinyin "ni35X'Au35_| m'A35_| n'i35_| X'Au35_| m'A214_|" "你好馬 ni3 hao3 ma3"


test_phon cmn "thiE55nt'i51_|" "天地" test_phon cmn "thiE55nt'i51_|" "天地"

# https://github.com/espeak-ng/espeak-ng/issues/1507
test_phon ml "k'a
t'a
p'a
k'e:r@l.@m
t'a:m@ra
p'o:le" "ക: ത: പ: കേരളം: താമര: പോലെ:"

Loading…
Cancel
Save