mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-02 22:07:12 +00:00
Don't treat words without alpha characters (e.g. emoji) as upper case.
This commit is contained in:
@@ -1959,6 +1959,7 @@ void TranslateClause(Translator *tr, int *tone_out, char **voice_change)
|
||||
int clause_pause;
|
||||
int pre_pause_add = 0;
|
||||
int all_upper_case = FLAG_ALL_UPPER;
|
||||
int alpha_count = 0;
|
||||
bool finished = false;
|
||||
bool single_quoted = false;
|
||||
bool phoneme_mode = false;
|
||||
@@ -2233,6 +2234,7 @@ void TranslateClause(Translator *tr, int *tone_out, char **voice_change)
|
||||
}
|
||||
|
||||
if (IsAlpha(c)) {
|
||||
alpha_count++;
|
||||
if (!IsAlpha(prev_out) || (tr->langopts.ideographs && ((c > 0x3040) || (prev_out > 0x3040)))) {
|
||||
if (wcschr(tr->punct_within_word, prev_out) == 0)
|
||||
letter_count = 0; // don't reset count for an apostrophy within a word
|
||||
@@ -2437,6 +2439,9 @@ void TranslateClause(Translator *tr, int *tone_out, char **voice_change)
|
||||
words[word_count].flags |= FLAG_EMBEDDED;
|
||||
embedded_count = 0;
|
||||
}
|
||||
if (alpha_count == 0) {
|
||||
all_upper_case &= ~FLAG_ALL_UPPER;
|
||||
}
|
||||
words[word_count].pre_pause = pre_pause;
|
||||
words[word_count].flags |= (all_upper_case | word_flags | word_emphasis);
|
||||
|
||||
@@ -2468,6 +2473,7 @@ void TranslateClause(Translator *tr, int *tone_out, char **voice_change)
|
||||
next_word_flags = 0;
|
||||
pre_pause = 0;
|
||||
all_upper_case = FLAG_ALL_UPPER;
|
||||
alpha_count = 0;
|
||||
syllable_marked = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,4 +47,4 @@ test_phonemes en " Ekskla#m'eIS@n kw'EstS@n m'A@k r'eInboU" "⁉ 🌈"
|
||||
|
||||
# bug: https://github.com/espeak-ng/espeak-ng/issues/471
|
||||
test_phonemes sk " sm'eju:tsa s'a tv'a:R" "☺"
|
||||
test_phonemes sk " bl'ax sm'eju:tsa 'es,a: tv'a:R" "blah ☺"
|
||||
test_phonemes sk " bl'ax sm'eju:tsa s'a tv'a:R" "blah ☺"
|
||||
|
||||
Reference in New Issue
Block a user