Browse Source

translate: fix uppercase word split during alphabet change (#1743)

Reported by @kirill-jjj.

Before:
```
✗ espeak-ng -x -vru кошKa
k'oS(en)'eI(ru)
✗ espeak-ng -x -vru юMoney
'ju(en)w'0ni(ru)
✗ espeak-ng -x -vru ЮMoney                        
'ju(en)w'0ni(ru)
```

After:
```
✗ espeak-ng -x -vru кошKa 
k'oS(en)k'A:(ru)
✗ espeak-ng -x -vru юMoney
'ju(en)m'Vni(ru)
✗ espeak-ng -x -vru ЮMoney
'ju(en)m'Vni(ru)
```

I have not noticed any negative side-effects and tests are still
passing.
But I think there should be a more precise testing, because translator
code is very complex (and poorly organised, and not documented, and...)
master
Alexander Epaneshnikov 2 years ago
parent
commit
10ef715bed
No account linked to committer's email address
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      src/libespeak-ng/translate.c

+ 2
- 2
src/libespeak-ng/translate.c View File

} else { } else {
if (iswlower(prev_in)) { if (iswlower(prev_in)) {
// lower case followed by upper case, possibly CamelCase // lower case followed by upper case, possibly CamelCase
if (UpperCaseInWord(tr, &sbuf[ix], c) == 0) { // start a new word
if ((prev_out != ' ') && UpperCaseInWord(tr, &sbuf[ix], c) == 0) { // start a new word
c = ' '; c = ' ';
space_inserted = true; space_inserted = true;
prev_in_save = c; prev_in_save = c;


if ((tr->translator_name == L('n', 'l')) && (letter_count == 2) && (c == 'j') && (prev_in == 'I')) { if ((tr->translator_name == L('n', 'l')) && (letter_count == 2) && (c == 'j') && (prev_in == 'I')) {
// Dutch words may capitalise initial IJ, don't split // Dutch words may capitalise initial IJ, don't split
} else if (IsAlpha(next2_in)) {
} else if ((prev_out != ' ') && IsAlpha(next2_in)) {
// changing from upper to lower case, start new word at the last uppercase, if 3 or more letters // changing from upper to lower case, start new word at the last uppercase, if 3 or more letters
c = ' '; c = ' ';
space_inserted = true; space_inserted = true;

Loading…
Cancel
Save