Browse Source

The next_pause parameter of TranslateWord is not used, so remove it.

master
Reece H. Dunn 9 years ago
parent
commit
f38a075575

+ 1
- 1
src/libespeak-ng/compiledict.c View File



// PROBLEM vowel reductions are not applied to the translated phonemes // PROBLEM vowel reductions are not applied to the translated phonemes
// condition rules are not applied // condition rules are not applied
TranslateWord(translator, phonetic, 0, NULL, NULL);
TranslateWord(translator, phonetic, NULL, NULL);
text_not_phonemes = 0; text_not_phonemes = 0;
strncpy0(encoded_ph, word_phonemes, N_WORD_BYTES-4); strncpy0(encoded_ph, word_phonemes, N_WORD_BYTES-4);



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

option_sayas = 0; // don't speak replacement word as letter names option_sayas = 0; // don't speak replacement word as letter names
text[0] = 0; text[0] = 0;
strncpy0(&text[1], word1, sizeof(text)); strncpy0(&text[1], word1, sizeof(text));
flags0 = TranslateWord(tr, &text[1], 0, NULL, NULL);
flags0 = TranslateWord(tr, &text[1], NULL, NULL);
strcpy(ph_out, word_phonemes); strcpy(ph_out, word_phonemes);
option_sayas = say_as; option_sayas = say_as;
} }

+ 1
- 1
src/libespeak-ng/numbers.c View File

// lang=hu don't treat dot as ordinal indicator if the next word is a month name ($alt). It may have a suffix. // lang=hu don't treat dot as ordinal indicator if the next word is a month name ($alt). It may have a suffix.
nextflags = 0; nextflags = 0;
if (IsAlpha(c2)) if (IsAlpha(c2))
nextflags = TranslateWord(tr, &word_end[2], 0, NULL, NULL);
nextflags = TranslateWord(tr, &word_end[2], NULL, NULL);


if ((tr->prev_dict_flags[0] & FLAG_ALT_TRANS) && ((c2 == 0) || (wtab[0].flags & FLAG_COMMA_AFTER) || iswdigit(c2))) if ((tr->prev_dict_flags[0] & FLAG_ALT_TRANS) && ((c2 == 0) || (wtab[0].flags & FLAG_COMMA_AFTER) || iswdigit(c2)))
ordinal = 0; // TEST 09.02.10 ordinal = 0; // TEST 09.02.10

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

return 1; return 1;
} }


int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wtab, char *word_out)
int TranslateWord(Translator *tr, char *word_start, WORD_TAB *wtab, char *word_out)
{ {
// word1 is terminated by space (0x20) character // word1 is terminated by space (0x20) character


return new_phoneme_tab; return new_phoneme_tab;
} }


static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pause, int next_pause)
static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pause)
{ {
int flags = 0; int flags = 0;
int stress; int stress;
word_copy_len = ix; word_copy_len = ix;


word_replaced[2] = 0; word_replaced[2] = 0;
flags = TranslateWord(translator, word, next_pause, wtab, &word_replaced[2]);
flags = TranslateWord(translator, word, wtab, &word_replaced[2]);


if (flags & FLAG_SPELLWORD) { if (flags & FLAG_SPELLWORD) {
// re-translate the word as individual letters, separated by spaces // re-translate the word as individual letters, separated by spaces
if (ok != 0) { if (ok != 0) {
strcpy(ph_buf, word_phonemes); strcpy(ph_buf, word_phonemes);


flags2[0] = TranslateWord(translator, p2+1, 0, wtab+1, NULL);
flags2[0] = TranslateWord(translator, p2+1, wtab+1, NULL);
if ((flags2[0] & FLAG_WAS_UNPRONOUNCABLE) || (word_phonemes[0] == phonSWITCH)) if ((flags2[0] & FLAG_WAS_UNPRONOUNCABLE) || (word_phonemes[0] == phonSWITCH))
ok = 0; ok = 0;


if (ok) { if (ok) {
*p2 = '-'; // replace next space by hyphen *p2 = '-'; // replace next space by hyphen
wtab[0].flags &= ~FLAG_ALL_UPPER; // prevent it being considered an abbreviation wtab[0].flags &= ~FLAG_ALL_UPPER; // prevent it being considered an abbreviation
flags = TranslateWord(translator, word, next_pause, wtab, NULL); // translate the combined word
flags = TranslateWord(translator, word, wtab, NULL); // translate the combined word
if ((sylimit > 0) && (CountSyllables(p) > (sylimit & 0x1f))) { if ((sylimit > 0) && (CountSyllables(p) > (sylimit & 0x1f))) {
// revert to separate words // revert to separate words
*p2 = ' '; *p2 = ' ';
flags = TranslateWord(translator, word, next_pause, wtab, NULL);
flags = TranslateWord(translator, word, wtab, NULL);
} else { } else {
if (flags == 0) if (flags == 0)
flags = flags2[0]; // no flags for the combined word, so use flags from the second word eg. lang-hu "nem december 7-e" flags = flags2[0]; // no flags for the combined word, so use flags from the second word eg. lang-hu "nem december 7-e"
if (word_replaced[2] != 0) { if (word_replaced[2] != 0) {
word_replaced[0] = 0; // byte before the start of the word word_replaced[0] = 0; // byte before the start of the word
word_replaced[1] = ' '; word_replaced[1] = ' ';
flags = TranslateWord(translator2, &word_replaced[1], next_pause, wtab, NULL);
flags = TranslateWord(translator2, &word_replaced[1], wtab, NULL);
} else } else
flags = TranslateWord(translator2, word, next_pause, wtab, &word_replaced[2]);
flags = TranslateWord(translator2, word, wtab, &word_replaced[2]);
} }


if (p[0] != phonSWITCH) if (p[0] != phonSWITCH)


for (pw = &number_buf[1]; pw < pn;) { for (pw = &number_buf[1]; pw < pn;) {
// keep wflags for each part, for FLAG_HYPHEN_AFTER // keep wflags for each part, for FLAG_HYPHEN_AFTER
dict_flags = TranslateWord2(tr, pw, &num_wtab[nw++], words[ix].pre_pause, 0);
dict_flags = TranslateWord2(tr, pw, &num_wtab[nw++], words[ix].pre_pause);
while (*pw++ != ' ') while (*pw++ != ' ')
; ;
words[ix].pre_pause = 0; words[ix].pre_pause = 0;
} else { } else {
pre_pause = 0; pre_pause = 0;


dict_flags = TranslateWord2(tr, word, &words[ix], words[ix].pre_pause, words[ix+1].pre_pause);
dict_flags = TranslateWord2(tr, word, &words[ix], words[ix].pre_pause);


if (pre_pause > words[ix+1].pre_pause) { if (pre_pause > words[ix+1].pre_pause) {
words[ix+1].pre_pause = pre_pause; words[ix+1].pre_pause = pre_pause;
memset(number_buf, ' ', 9); memset(number_buf, ' ', 9);
nx = utf8_in(&c_temp, pw); nx = utf8_in(&c_temp, pw);
memcpy(&number_buf[2], pw, nx); memcpy(&number_buf[2], pw, nx);
TranslateWord2(tr, &number_buf[2], &words[ix], 0, 0);
TranslateWord2(tr, &number_buf[2], &words[ix], 0);
pw += nx; pw += nx;
} }
} }

+ 1
- 1
src/libespeak-ng/translate.h View File

int Unpronouncable(Translator *tr, char *word, int posn); int Unpronouncable(Translator *tr, char *word, int posn);
void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags, int tonic, int prev_stress); void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags, int tonic, int prev_stress);
int TranslateRules(Translator *tr, char *p, char *phonemes, int size, char *end_phonemes, int end_flags, unsigned int *dict_flags); int TranslateRules(Translator *tr, char *p, char *phonemes, int size, char *end_phonemes, int end_flags, unsigned int *dict_flags);
int TranslateWord(Translator *tr, char *word1, int next_pause, WORD_TAB *wtab, char *word_out);
int TranslateWord(Translator *tr, char *word1, WORD_TAB *wtab, char *word_out);
void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *tone, char **voice_change); void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *tone, char **voice_change);
int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix_top, int n_buf, int *tone_type, char *voice_change); int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix_top, int n_buf, int *tone_type, char *voice_change);



Loading…
Cancel
Save