Browse Source

Fixing handling of sequence .' in english (potential acronym+genitive vs simple quote usage of apostrophe)

master
BenTalagan 5 years ago
parent
commit
93fbca0e31
2 changed files with 18 additions and 2 deletions
  1. 9
    2
      src/libespeak-ng/readclause.c
  2. 9
    0
      tests/translate.test

+ 9
- 2
src/libespeak-ng/readclause.c View File

@@ -1071,8 +1071,15 @@ int ReadClause(Translator *tr, char *buf, short *charix, int *charix_top, int n_
is_end_clause = false; // Roman number followed by dot
else if (iswlower(c_next) || (c_next == '-')) // hyphen is needed for lang-hu (eg. 2.-kal)
is_end_clause = false; // only if followed by lower-case, (or if there is a XML tag)
} else if (c_next == '\'')
is_end_clause = false; // eg. u.s.a.'s
} else if (c_next == '\'') {
// A special case to handle english acronym + genitive
// eg. u.s.a.'s
// But avoid breaking clause handling if anything else follows the apostrophe.
c_next = GetC();
if(c_next == 's')
is_end_clause = false;
UngetC(c_next);
}
if (iswlower(c_next)) {
// next word has no capital letter, this dot is probably from an abbreviation
is_end_clause = 0;

+ 9
- 0
tests/translate.test View File

@@ -55,6 +55,15 @@ d'i:
'i:
'Ef" "A. B C, D. E: F."

# Handling of english acronym + genitive without breaking simple quote
test_phonemes en "hi: s'Ed
aI w0z b'O@n InD@ j,u:,Es'eI z_:_: and l'Eft" "He said : I was born in the u.s.a.'s and left."

test_phonemes en "hi: s'Ed
h@l'oU
aIa#m b'ak
and l'Eft" "He said : 'Hello, I am back.' and left."

#----- Emoji [http://www.unicode.org/reports/tr51/tr51-12.html] -----

# ED-3 - emoji_character

Loading…
Cancel
Save