mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-03 22:26:48 +00:00
code cleanup: move ApplySpecialAttribute2()
This commit is contained in:
@@ -2214,7 +2214,7 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
if (letter == 0xe000+'(') {
|
||||
if (pre_pause < tr->langopts.param[LOPT_BRACKET_PAUSE_ANNOUNCED])
|
||||
pre_pause = tr->langopts.param[LOPT_BRACKET_PAUSE_ANNOUNCED]; // a bracket, already spoken by AnnouncePunctuation()
|
||||
}
|
||||
}
|
||||
if (IsBracket(letter)) {
|
||||
if (pre_pause < tr->langopts.param[LOPT_BRACKET_PAUSE])
|
||||
pre_pause = tr->langopts.param[LOPT_BRACKET_PAUSE];
|
||||
@@ -2325,37 +2325,6 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags)
|
||||
{
|
||||
// apply after the translation is complete
|
||||
|
||||
int ix;
|
||||
int len;
|
||||
char *p;
|
||||
|
||||
len = strlen(phonemes);
|
||||
|
||||
if (tr->langopts.param[LOPT_ALT] & 2) {
|
||||
for (ix = 0; ix < (len-1); ix++) {
|
||||
if (phonemes[ix] == phonSTRESS_P) {
|
||||
p = &phonemes[ix+1];
|
||||
if ((dict_flags & FLAG_ALT2_TRANS) != 0) {
|
||||
if (*p == PhonemeCode('E'))
|
||||
*p = PhonemeCode('e');
|
||||
if (*p == PhonemeCode('O'))
|
||||
*p = PhonemeCode('o');
|
||||
} else {
|
||||
if (*p == PhonemeCode('e'))
|
||||
*p = PhonemeCode('E');
|
||||
if (*p == PhonemeCode('o'))
|
||||
*p = PhonemeCode('O');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int TransposeAlphabet(Translator *tr, char *text)
|
||||
{
|
||||
// transpose cyrillic alphabet (for example) into ascii (single byte) character codes
|
||||
|
||||
@@ -681,8 +681,6 @@ void ProcessLanguageOptions(LANGUAGE_OPTIONS *langopts);
|
||||
|
||||
void print_dictionary_flags(unsigned int *flags, char *buf, int buf_len);
|
||||
|
||||
void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags);
|
||||
|
||||
int TranslateWord(Translator *tr, char *word1, WORD_TAB *wtab, char *word_out);
|
||||
void TranslateClause(Translator *tr, int *tone, char **voice_change);
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
|
||||
|
||||
static void addPluralSuffixes(int flags, Translator *tr, char last_char, char *word_phonemes);
|
||||
static void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags);
|
||||
static void ChangeWordStress(Translator *tr, char *word, int new_stress);
|
||||
static int CheckDottedAbbrev(char *word1);
|
||||
static int NonAsciiNumber(int letter);
|
||||
@@ -670,6 +671,38 @@ int TranslateWord3(Translator *tr, char *word_start, WORD_TAB *wtab, char *word_
|
||||
}
|
||||
|
||||
|
||||
void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags)
|
||||
{
|
||||
// apply after the translation is complete
|
||||
|
||||
int ix;
|
||||
int len;
|
||||
char *p;
|
||||
|
||||
len = strlen(phonemes);
|
||||
|
||||
if (tr->langopts.param[LOPT_ALT] & 2) {
|
||||
for (ix = 0; ix < (len-1); ix++) {
|
||||
if (phonemes[ix] == phonSTRESS_P) {
|
||||
p = &phonemes[ix+1];
|
||||
if ((dict_flags & FLAG_ALT2_TRANS) != 0) {
|
||||
if (*p == PhonemeCode('E'))
|
||||
*p = PhonemeCode('e');
|
||||
if (*p == PhonemeCode('O'))
|
||||
*p = PhonemeCode('o');
|
||||
} else {
|
||||
if (*p == PhonemeCode('e'))
|
||||
*p = PhonemeCode('E');
|
||||
if (*p == PhonemeCode('o'))
|
||||
*p = PhonemeCode('O');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void ChangeWordStress(Translator *tr, char *word, int new_stress)
|
||||
{
|
||||
int ix;
|
||||
|
||||
Reference in New Issue
Block a user