mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-01 13:54:20 +00:00
Don't store the unused phoneme equivalence tables in the phoneme data files.
This commit is contained in:
@@ -10,6 +10,8 @@ The espeak-ng project is a fork of the espeak project.
|
||||
### 1.49.2 - (In Development)
|
||||
|
||||
* Support describing all IPA phonemes in the phoneme tables.
|
||||
* Removed support for phoneme equivalence tables. These were disabled in the
|
||||
French and German language files.
|
||||
|
||||
updated languages:
|
||||
|
||||
|
||||
@@ -2328,7 +2328,6 @@ static void WritePhonemeTables()
|
||||
fputc(phoneme_tab_list2[ix].includes, f_phtab);
|
||||
fputc(0, f_phtab);
|
||||
fputc(0, f_phtab);
|
||||
Write4Bytes(f_phtab, phoneme_tab_list2[ix].equivalence_tables); // byte index into phondata for equivalence tables
|
||||
|
||||
fwrite(phoneme_tab_list2[ix].name, 1, N_PHONEME_TAB_NAME, f_phtab);
|
||||
|
||||
|
||||
@@ -223,7 +223,6 @@ typedef struct {
|
||||
PHONEME_TAB *phoneme_tab_ptr;
|
||||
int n_phonemes;
|
||||
int includes; // also include the phonemes from this other phoneme table
|
||||
int equivalence_tables; // lists of equivalent phonemes to match other languages, byte index into phondata
|
||||
} PHONEME_TAB_LIST;
|
||||
|
||||
// table of phonemes to be replaced with different phonemes, for the current voice
|
||||
|
||||
@@ -144,9 +144,7 @@ espeak_ng_STATUS LoadPhData(int *srate, espeak_ng_ERROR_CONTEXT *context)
|
||||
n_phonemes = p[0];
|
||||
phoneme_tab_list[ix].n_phonemes = p[0];
|
||||
phoneme_tab_list[ix].includes = p[1];
|
||||
pw = (int *)p;
|
||||
phoneme_tab_list[ix].equivalence_tables = Reverse4Bytes(pw[1]);
|
||||
p += 8;
|
||||
p += 4;
|
||||
memcpy(phoneme_tab_list[ix].name, p, N_PHONEME_TAB_NAME);
|
||||
p += N_PHONEME_TAB_NAME;
|
||||
phoneme_tab_list[ix].phoneme_tab_ptr = (PHONEME_TAB *)p;
|
||||
|
||||
@@ -698,85 +698,6 @@ static int CheckDottedAbbrev(char *word1)
|
||||
|
||||
extern char *phondata_ptr;
|
||||
|
||||
int ChangeEquivalentPhonemes(Translator *tr, int lang2, char *phonemes)
|
||||
{
|
||||
// tr: the original language
|
||||
// lang2: phoneme table number for the temporary language
|
||||
// phonemes: the phonemes to be replaced
|
||||
|
||||
int ix;
|
||||
int len;
|
||||
char phon;
|
||||
char *p;
|
||||
unsigned char *pb;
|
||||
char *eqlist;
|
||||
char *p_out;
|
||||
char *p_in;
|
||||
int remove_stress = 0;
|
||||
char phonbuf[N_WORD_PHONEMES];
|
||||
|
||||
// has a phoneme equivalence table been specified for this language pair?
|
||||
if ((ix = phoneme_tab_list[tr->phoneme_tab_ix].equivalence_tables) == 0)
|
||||
return 0;
|
||||
|
||||
pb = (unsigned char *)&phondata_ptr[ix];
|
||||
|
||||
for (;;) {
|
||||
if (pb[0] == 0)
|
||||
return 0; // table not found
|
||||
|
||||
if (pb[0] == lang2)
|
||||
break;
|
||||
|
||||
len = (pb[2] << 8) + pb[3]; // size of this table in words
|
||||
pb += (len * 4);
|
||||
}
|
||||
remove_stress = pb[1];
|
||||
|
||||
if (option_phonemes & espeakPHONEMES_TRACE) {
|
||||
DecodePhonemes(phonemes, phonbuf);
|
||||
fprintf(f_trans, "(%s) %s -> (%s) ", phoneme_tab_list[lang2].name, phonbuf, phoneme_tab_list[tr->phoneme_tab_ix].name);
|
||||
}
|
||||
|
||||
p_in = phonemes;
|
||||
eqlist = (char *)&pb[8];
|
||||
p_out = phonbuf;
|
||||
|
||||
while ((phon = *p_in++) != 0) {
|
||||
if (remove_stress && ((phon & 0xff) < phonSTRESS_PREV))
|
||||
continue; // remove stress marks
|
||||
|
||||
// is there a translation for this phoneme code?
|
||||
p = eqlist;
|
||||
while (*p != 0) {
|
||||
len = strlen(&p[1]);
|
||||
if (*p == phon) {
|
||||
strcpy(p_out, &p[1]);
|
||||
p_out += len;
|
||||
break;
|
||||
}
|
||||
p += (len + 2);
|
||||
}
|
||||
if (*p == 0) {
|
||||
// no translation found
|
||||
*p_out++ = phon;
|
||||
}
|
||||
}
|
||||
*p_out = 0;
|
||||
|
||||
if (remove_stress)
|
||||
SetWordStress(tr, phonbuf, NULL, -1, 0);
|
||||
|
||||
strcpy(phonemes, phonbuf);
|
||||
|
||||
if (option_phonemes & espeakPHONEMES_TRACE) {
|
||||
SelectPhonemeTable(tr->phoneme_tab_ix);
|
||||
DecodePhonemes(phonemes, phonbuf);
|
||||
fprintf(f_trans, "%s\n\n", phonbuf);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int TranslateWord(Translator *tr, char *word_start, WORD_TAB *wtab, char *word_out)
|
||||
{
|
||||
// word1 is terminated by space (0x20) character
|
||||
@@ -1746,11 +1667,6 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
|
||||
p[2] = 0;
|
||||
}
|
||||
|
||||
if (ChangeEquivalentPhonemes(tr, switch_phonemes, (char *)p)) {
|
||||
// Phonemes have been converted from the foreign language to the native language
|
||||
switch_phonemes = -1;
|
||||
}
|
||||
|
||||
if (switch_phonemes == -1) {
|
||||
strcpy(dictionary_name, old_dictionary_name);
|
||||
SelectPhonemeTable(voice->phoneme_tab_ix);
|
||||
|
||||
Reference in New Issue
Block a user