mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-03 14:17:12 +00:00
Don't compile the unused phoneme equivalence tables.
This commit is contained in:
@@ -986,84 +986,3 @@ phoneme j.
|
||||
lengthmod 7
|
||||
ipa U+0265
|
||||
endphoneme
|
||||
|
||||
// translate from English to French phonemes
|
||||
equivalents NULL // disable this table
|
||||
//remove_stress
|
||||
0 O
|
||||
3 W r
|
||||
3: W : r
|
||||
@ W
|
||||
@- W
|
||||
@2 W
|
||||
@5 W
|
||||
@L W l
|
||||
a a
|
||||
a# a#
|
||||
A: a :
|
||||
A@ a r
|
||||
aa a :
|
||||
aI a j
|
||||
aI3 a j W2 r
|
||||
aI@ a j W2 r
|
||||
aU a w
|
||||
aU@ a w @
|
||||
A~ A~
|
||||
E E
|
||||
e: e
|
||||
e@ E : r
|
||||
eI E : j/
|
||||
i i
|
||||
I I
|
||||
I2 I2
|
||||
i: i :
|
||||
i@ i r
|
||||
i@3 i : r
|
||||
O O
|
||||
O: O :
|
||||
o: o
|
||||
O@ O r
|
||||
o@ O r
|
||||
OI O j
|
||||
oU oU
|
||||
O~ O~
|
||||
U u
|
||||
u: u:
|
||||
U@ u r
|
||||
V V
|
||||
IR i r
|
||||
VR W r
|
||||
b b
|
||||
C C
|
||||
d d
|
||||
D D
|
||||
dZ dZ
|
||||
f f
|
||||
g g
|
||||
h h
|
||||
j j
|
||||
k k
|
||||
l l
|
||||
l# l#
|
||||
m m
|
||||
n n
|
||||
N N
|
||||
n^ n^
|
||||
p p
|
||||
Q Q
|
||||
r r
|
||||
r- r
|
||||
s s
|
||||
S S
|
||||
t t
|
||||
T T
|
||||
t2 t
|
||||
tS tS
|
||||
v v
|
||||
w w/
|
||||
x x
|
||||
z z
|
||||
Z Z
|
||||
endphoneme
|
||||
|
||||
|
||||
|
||||
@@ -440,81 +440,3 @@ phoneme g
|
||||
ENDIF
|
||||
CALL base/g
|
||||
endphoneme
|
||||
|
||||
|
||||
// translate from English to German phonemes
|
||||
equivalents NULL // disable this table
|
||||
0 O
|
||||
3 3
|
||||
3: W :
|
||||
@ @
|
||||
@- @-
|
||||
@2 @
|
||||
@5 @
|
||||
@L U l
|
||||
a a
|
||||
a# a
|
||||
A: A:
|
||||
A@ A: r
|
||||
aa a
|
||||
aI aI
|
||||
aI@ aI 3
|
||||
aU aU
|
||||
aU@ aU 3
|
||||
A~ A~
|
||||
E E
|
||||
e: e:
|
||||
e@ E: r
|
||||
eI e j
|
||||
i I
|
||||
I I
|
||||
I2 I
|
||||
i: i:
|
||||
i@ i: 3
|
||||
i@3 i: r
|
||||
O O
|
||||
O: O :
|
||||
o: o:
|
||||
O@ O : r
|
||||
o@ O : r
|
||||
OI OY
|
||||
oU oU
|
||||
O~ O n
|
||||
U U
|
||||
u: u:
|
||||
U@ U r
|
||||
V W
|
||||
IR I r
|
||||
VR W r
|
||||
b b
|
||||
C C
|
||||
d d
|
||||
D D
|
||||
dZ dZ
|
||||
f f
|
||||
g g
|
||||
h h
|
||||
j j
|
||||
k k
|
||||
l l
|
||||
l# l#
|
||||
m m
|
||||
n n
|
||||
N N
|
||||
n^ n^
|
||||
p p
|
||||
Q Q
|
||||
r r
|
||||
r- r
|
||||
s s
|
||||
S S
|
||||
t t
|
||||
T T
|
||||
t2 t
|
||||
tS tS
|
||||
v v
|
||||
w w
|
||||
x x
|
||||
z z
|
||||
Z Z
|
||||
endphoneme
|
||||
|
||||
@@ -149,7 +149,6 @@ enum {
|
||||
kPROCEDURE,
|
||||
kENDPHONEME,
|
||||
kENDPROCEDURE,
|
||||
kEQUIVALENTS,
|
||||
kPHONEMETABLE,
|
||||
kINCLUDE,
|
||||
kIMPORT_PH,
|
||||
@@ -237,7 +236,6 @@ static keywtab_t keywords[] = {
|
||||
{ "procedure", tSTATEMENT, kPROCEDURE },
|
||||
{ "endphoneme", tSTATEMENT, kENDPHONEME },
|
||||
{ "endprocedure", tSTATEMENT, kENDPROCEDURE },
|
||||
{ "equivalents", tSTATEMENT, kEQUIVALENTS },
|
||||
{ "import_phoneme", tSTATEMENT, kIMPORT_PH },
|
||||
{ "stress_type", tSTATEMENT, kSTRESSTYPE },
|
||||
{ "starttype", tSTATEMENT, kSTARTTYPE },
|
||||
@@ -332,9 +330,6 @@ static int n_phcodes_list[N_PHONEME_TABS];
|
||||
static PHONEME_TAB_LIST phoneme_tab_list2[N_PHONEME_TABS];
|
||||
static PHONEME_TAB *phoneme_tab2;
|
||||
|
||||
static char *p_equivalence;
|
||||
static char equivalence_buf[20000];
|
||||
|
||||
#define N_PROCS 50
|
||||
int n_procs;
|
||||
int proc_addr[N_PROCS];
|
||||
@@ -2370,18 +2365,6 @@ static void EndPhonemeTable()
|
||||
}
|
||||
|
||||
n_phcodes_list[n_phoneme_tabs-1] = n_phcodes;
|
||||
|
||||
if ((length = p_equivalence - equivalence_buf) > 0) {
|
||||
// terminate the list of phoneme equivalence tables
|
||||
pw = (int *)p_equivalence;
|
||||
pw[0] = 0;
|
||||
|
||||
// write the equivalence data into phondata, and remember it's address
|
||||
ix = ftell(f_phdata);
|
||||
fprintf(f_phcontents, "Q 0x%.5x %s\n", ix, phoneme_tab_list2[n_phoneme_tabs-1].name);
|
||||
phoneme_tab_list2[n_phoneme_tabs-1].equivalence_tables = ix;
|
||||
fwrite(equivalence_buf, length+4, 1, f_phdata);
|
||||
}
|
||||
}
|
||||
|
||||
static void StartPhonemeTable(const char *name)
|
||||
@@ -2407,7 +2390,6 @@ static void StartPhonemeTable(const char *name)
|
||||
strncpy0(phoneme_tab_list2[n_phoneme_tabs].name, name, N_PHONEME_TAB_NAME);
|
||||
n_phcodes = 1;
|
||||
phoneme_tab_list2[n_phoneme_tabs].includes = 0;
|
||||
p_equivalence = equivalence_buf;
|
||||
|
||||
if (n_phoneme_tabs > 0) {
|
||||
NextItem(tSTRING); // name of base phoneme table
|
||||
@@ -2433,97 +2415,6 @@ static void StartPhonemeTable(const char *name)
|
||||
n_phoneme_tabs++;
|
||||
}
|
||||
|
||||
static void CompileEquivalents()
|
||||
{
|
||||
// a list of phonemes in another language and the equivalent phoneme strings in this language
|
||||
|
||||
int ix;
|
||||
int n_names;
|
||||
int n_bytes;
|
||||
int foreign_error = 0;
|
||||
int remove_stress = 0;
|
||||
char *p_start;
|
||||
char *p;
|
||||
int foreign_table;
|
||||
char foreign_table_name[40];
|
||||
char line_buf[80];
|
||||
char names[6][80];
|
||||
char phcode[7];
|
||||
|
||||
NextItem(tSTRING);
|
||||
strcpy(foreign_table_name, item_string);
|
||||
|
||||
if ((foreign_table = SelectPhonemeTableName(foreign_table_name)) < 0) {
|
||||
if (strcmp(foreign_table_name, "NULL") != 0)
|
||||
error("Unknown phoneme table '%s'", foreign_table_name);
|
||||
foreign_error = 1;
|
||||
}
|
||||
|
||||
p_start = p_equivalence;
|
||||
p_equivalence += 8;
|
||||
|
||||
p_start[0] = foreign_table;
|
||||
|
||||
linenum--;
|
||||
while (!feof(f_in)) {
|
||||
linenum++;
|
||||
if (fgets(line_buf, sizeof(line_buf), f_in) == NULL)
|
||||
break;
|
||||
|
||||
if ((p = strstr(line_buf, "//")) != NULL)
|
||||
*p = 0;
|
||||
|
||||
for (ix = 0; ix < 6; ix++)
|
||||
names[ix][0] = 0;
|
||||
n_names = sscanf(line_buf, "%s %s %s %s %s %s", names[0], names[1], names[2], names[3], names[4], names[5]);
|
||||
if (n_names < 1)
|
||||
continue;
|
||||
|
||||
if (strcmp(names[0], "endphoneme") == 0)
|
||||
break;
|
||||
|
||||
if (foreign_error)
|
||||
continue;
|
||||
|
||||
if (strcmp(names[0], "remove_stress") == 0) {
|
||||
remove_stress = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (p_equivalence > &equivalence_buf[sizeof(equivalence_buf) - 16]) {
|
||||
error("'equivalents' tables are too large");
|
||||
break;
|
||||
}
|
||||
|
||||
if (foreign_error == 0) {
|
||||
phcode[0] = LookupPhonemeString(names[0]);
|
||||
if (phcode[0] == 0) {
|
||||
sprintf(line_buf, "%s/%s", foreign_table_name, names[0]);
|
||||
error("Unknown phoneme '%s'", line_buf);
|
||||
}
|
||||
}
|
||||
|
||||
for (ix = 1; ix < n_names; ix++)
|
||||
phcode[ix] = LookupPhoneme(names[ix], 1);
|
||||
|
||||
// only write a translation if it has an effect
|
||||
if ((n_names > 2) || (phcode[0] != phcode[1])) {
|
||||
// write: foreign phoneme number, then a string of local phoneme numbers
|
||||
memcpy(p_equivalence, phcode, n_names);
|
||||
p_equivalence += n_names;
|
||||
*p_equivalence++ = 0;
|
||||
}
|
||||
}
|
||||
*p_equivalence++ = 0;
|
||||
|
||||
p_equivalence = (char *)((intptr_t)(p_equivalence + 3) & ~0x3); // align to word boundary
|
||||
n_bytes = p_equivalence - p_start;
|
||||
p_start[1] = remove_stress;
|
||||
n_bytes = n_bytes / 4;
|
||||
p_start[2] = n_bytes >> 8; // index of next table
|
||||
p_start[3] = n_bytes;
|
||||
}
|
||||
|
||||
static void CompilePhonemeFiles()
|
||||
{
|
||||
int item;
|
||||
@@ -2585,9 +2476,6 @@ static void CompilePhonemeFiles()
|
||||
case kPROCEDURE:
|
||||
CompilePhoneme(0);
|
||||
break;
|
||||
case kEQUIVALENTS:
|
||||
CompileEquivalents();
|
||||
break;
|
||||
default:
|
||||
if (!feof(f_in))
|
||||
error("Keyword 'phoneme' expected");
|
||||
@@ -2675,7 +2563,6 @@ espeak_ng_CompilePhonemeDataPath(long rate,
|
||||
"# S - A SPECT_SEQ structure\n"
|
||||
"# W - A wavefile segment\n"
|
||||
"# E - An envelope\n"
|
||||
"# Q - Phoneme equivalence tables\n"
|
||||
"#\n"
|
||||
"# Address is the displacement within phondata of this item\n"
|
||||
"#\n"
|
||||
|
||||
Reference in New Issue
Block a user