Browse Source

code cleanup: move ApplySpecialAttribute2()

master
Juho Hiltunen 2 years ago
parent
commit
57c7285ff9
3 changed files with 34 additions and 34 deletions
  1. 1
    32
      src/libespeak-ng/dictionary.c
  2. 0
    2
      src/libespeak-ng/translate.h
  3. 33
    0
      src/libespeak-ng/translateword.c

+ 1
- 32
src/libespeak-ng/dictionary.c View File

@@ -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

+ 0
- 2
src/libespeak-ng/translate.h View File

@@ -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);


+ 33
- 0
src/libespeak-ng/translateword.c View File

@@ -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;

Loading…
Cancel
Save