git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@97 d46cf337-b52f-0410-862d-fd96e6ae7743master
| Dictionary zh_dict | Dictionary zh_dict | ||||
| @r a A ai E ei i i0 | |||||
| i[ iou u | |||||
| c; j k kh l n N p | |||||
| ph R R2 R3 s tc; tc; th | |||||
| ts ts. ts. tsh w | |||||
| Dictionary zhh_dict | Dictionary zhh_dict |
| dictrules 3 6 | dictrules 3 6 | ||||
| option 12 1 // reduce [t] | option 12 1 // reduce [t] | ||||
| stressLength 150 125 180 180 0 0 270 300 | |||||
| stressLength 150 125 180 180 0 0 270 280 | |||||
| stressAmp 17 16 20 20 20 22 23 20 | stressAmp 17 16 20 20 20 22 23 20 | ||||
| //replace 03 I i | |||||
| //replace 03 I2 i | |||||
| formant 1 99 100 100 | formant 1 99 100 100 |
| l/L2_uL [(u)] base | l/L2_uL [(u)] base | ||||
| [u:] en | [u:] en | ||||
| [u:] en_n | [u:] en_n | ||||
| [u:] en_us | |||||
| [u:] en_rp | [u:] en_rp | ||||
| l/l_3 [l/] de | l/l_3 [l/] de | ||||
| [l] fr | [l] fr | ||||
| [EI] de | [EI] de | ||||
| [EI] nl | [EI] nl | ||||
| [EI] vi | [EI] vi | ||||
| vdiph/eei_2 [eI] en_us | |||||
| [eI] eo | |||||
| vdiph/eei_2 [eI] eo | |||||
| [ei] fi | [ei] fi | ||||
| vdiph/eei_3 [eI] en_rp | vdiph/eei_3 [eI] en_rp | ||||
| [eI] sk | [eI] sk | ||||
| vdiph/oi_2 [oI] af | vdiph/oi_2 [oI] af | ||||
| vdiph/ooi [OI] en | vdiph/ooi [OI] en | ||||
| [OI] en_n | [OI] en_n | ||||
| [OI] en_us | |||||
| [OI] cy | [OI] cy | ||||
| [OY] cy | [OY] cy | ||||
| [OI] eo | [OI] eo | ||||
| [OI] no | [OI] no | ||||
| [oi] zhy | [oi] zhy | ||||
| vdiph/ooi_2 [OI] af | vdiph/ooi_2 [OI] af | ||||
| vdiph/ooi_3 [OI] en_rp | |||||
| vdiph/ooi_3 [OI] en_us | |||||
| [OI] en_rp | |||||
| [aI] en_wm | [aI] en_wm | ||||
| vdiph/oou [oU] cs | vdiph/oou [oU] cs | ||||
| [OU] grc | [OU] grc | ||||
| [@] en | [@] en | ||||
| [@2] en | [@2] en | ||||
| [@5] en | [@5] en | ||||
| [@] en_us | |||||
| [@2] en_us | |||||
| [@5] en_us | |||||
| [3] en_rp | [3] en_rp | ||||
| [@] en_rp | [@] en_rp | ||||
| [V] cy | [V] cy | ||||
| [A] hu | [A] hu | ||||
| vowel/@_2 [@] fr | vowel/@_2 [@] fr | ||||
| [W] fr | [W] fr | ||||
| vowel/&_2 [a] en_us | |||||
| [aa] en_us | |||||
| [&?] zhh | |||||
| vowel/&_2 [&?] zhh | |||||
| vowel/@_3 [@] en_sc | vowel/@_3 [@] en_sc | ||||
| [I] en_sc | [I] en_sc | ||||
| [@2] en_sc | [@2] en_sc | ||||
| [E:] no | [E:] no | ||||
| [e] zhy | [e] zhy | ||||
| vowel/ee_2 [E] en | vowel/ee_2 [E] en | ||||
| [E] en_us | |||||
| [E] cy | [E] cy | ||||
| [E2] nl | [E2] nl | ||||
| [E] zh | [E] zh | ||||
| vowel/@_fnt [@2] hr | vowel/@_fnt [@2] hr | ||||
| [@] en_wi | [@] en_wi | ||||
| [@2] en_wi | [@2] en_wi | ||||
| vowel/@_hgh [@] no | |||||
| vowel/@_hgh [@] en_us | |||||
| [@2] en_us | |||||
| [@5] en_us | |||||
| [@] no | |||||
| vowel/i [i] base2 | vowel/i [i] base2 | ||||
| [i:] en_n | [i:] en_n | ||||
| [i] en_wm | [i] en_wm | ||||
| [i?] zhh | [i?] zhh | ||||
| [i] sw | [i] sw | ||||
| [i] en_wi | [i] en_wi | ||||
| vowel/i# [i] en_rp | |||||
| vowel/i# [i] en_us | |||||
| [i] en_rp | |||||
| [y:] cy | [y:] cy | ||||
| vowel/i_2 [i:] en_rp | vowel/i_2 [i:] en_rp | ||||
| [i2] de | [i2] de | ||||
| [U] hr | [U] hr | ||||
| [u] ro | [u] ro | ||||
| vowel/u#_2 [u-] sv | vowel/u#_2 [u-] sv | ||||
| vowel/u_3 [u:] en_us | |||||
| [yU] ro | |||||
| vowel/u_3 [yU] ro | |||||
| vowel/u_4 [u:] en_n | vowel/u_4 [u:] en_n | ||||
| vowel/u#_4 [U] en_sc | vowel/u#_4 [U] en_sc | ||||
| [u:] en_sc | [u:] en_sc | ||||
| vowel/u_5 [u] sw | vowel/u_5 [u] sw | ||||
| vowel/u#_5 [u:] en_us | |||||
| vowel/u_6 [U] pt_pt | vowel/u_6 [U] pt_pt | ||||
| [u] pt_pt | [u] pt_pt | ||||
| vowel/u_7 [u] vi | vowel/u_7 [u] vi | ||||
| [U] no | [U] no | ||||
| [u] zhy | [u] zhy | ||||
| [U] en_wi | [U] en_wi | ||||
| vowel/V [3] en_sc | |||||
| vowel/V [V] en_us | |||||
| [3] en_sc | |||||
| vowel/V_2 [V] en | vowel/V_2 [V] en | ||||
| [V] en_us | |||||
| [a] af | [a] af | ||||
| [V] ru | [V] ru | ||||
| [V#] ru | [V#] ru | ||||
| vwl_en/u [u:] en | vwl_en/u [u:] en | ||||
| vwl_en/u_L [u:] en | vwl_en/u_L [u:] en | ||||
| [u:] en_n | [u:] en_n | ||||
| [u:] en_us | |||||
| [u:] en_rp | [u:] en_rp | ||||
| vwl_en_us/3_us [3] en_us | vwl_en_us/3_us [3] en_us | ||||
| [3:] en_us | [3:] en_us | ||||
| vwl_en_us/a [a] en_us | |||||
| [aa] en_us | |||||
| vwl_en_us/aai [aI] en_us | vwl_en_us/aai [aI] en_us | ||||
| vwl_en_us/ar [A:] en_us | vwl_en_us/ar [A:] en_us | ||||
| [A@] en_us | [A@] en_us | ||||
| vwl_en_us/ee [E] en_us | |||||
| vwl_en_us/ei [eI] en_us | |||||
| vwl_en_us/er [e@] en_us | vwl_en_us/er [e@] en_us | ||||
| vwl_en_us/i_final3 [i] en_us | |||||
| vwl_en_us/ii [I] en_us | vwl_en_us/ii [I] en_us | ||||
| [I2] en_us | [I2] en_us | ||||
| vwl_en_us/ir [i@] en_us | vwl_en_us/ir [i@] en_us |
| phoneme @ // Schwa | phoneme @ // Schwa | ||||
| vowel starttype (@) endtype (@) | vowel starttype (@) endtype (@) | ||||
| formants vowel/@ | |||||
| formants vowel/@_hgh | |||||
| unstressed | unstressed | ||||
| linkout r- | linkout r- | ||||
| length 130 | length 130 | ||||
| unstressed | unstressed | ||||
| linkout r- | linkout r- | ||||
| beforevowel @ | beforevowel @ | ||||
| length 180 | |||||
| length 200 | |||||
| endphoneme | endphoneme | ||||
| phoneme @2 // Schwa, changes to I before a vowel | phoneme @2 // Schwa, changes to I before a vowel | ||||
| vowel starttype (@) endtype (@) | vowel starttype (@) endtype (@) | ||||
| formants vowel/@ | |||||
| formants vowel/@_hgh | |||||
| unstressed | unstressed | ||||
| beforevowel I2 | beforevowel I2 | ||||
| length 120 | length 120 | ||||
| phoneme @5 // Schwa, changes to U before a vowel | phoneme @5 // Schwa, changes to U before a vowel | ||||
| vowel starttype (@) endtype (@) | vowel starttype (@) endtype (@) | ||||
| formants vowel/@ | |||||
| formants vowel/@_hgh | |||||
| unstressed | unstressed | ||||
| beforevowelpause U | beforevowelpause U | ||||
| length 130 | length 130 | ||||
| phoneme a | phoneme a | ||||
| vowel starttype (a) endtype (@) | vowel starttype (a) endtype (@) | ||||
| length 180 | |||||
| formants vowel/&_2 | |||||
| // formants vwl_en_us/a | |||||
| length 200 | |||||
| // formants vowel/&_2 | |||||
| formants vwl_en_us/a | |||||
| reduceto a2 0 | reduceto a2 0 | ||||
| endphoneme | endphoneme | ||||
| phoneme aa // 'bath' etc. | phoneme aa // 'bath' etc. | ||||
| vowel starttype (a) endtype (@) | vowel starttype (a) endtype (@) | ||||
| length 190 | |||||
| formants vowel/&_2 | |||||
| // formants vwl_en_us/a | |||||
| length 220 | |||||
| // formants vowel/&_2 | |||||
| formants vwl_en_us/a | |||||
| linkout r- | linkout r- | ||||
| endphoneme | endphoneme | ||||
| phoneme a2 | phoneme a2 | ||||
| vowel starttype (@) endtype (@) | vowel starttype (@) endtype (@) | ||||
| unstressed | unstressed | ||||
| length 140 | |||||
| length 150 | |||||
| formants vowel/a#_3 | formants vowel/a#_3 | ||||
| linkout r- | linkout r- | ||||
| endphoneme | endphoneme | ||||
| phoneme E | phoneme E | ||||
| vowel starttype (e) endtype (e) | vowel starttype (e) endtype (e) | ||||
| length 160 | |||||
| formants vowel/ee_2 | |||||
| length 185 | |||||
| // formants vowel/ee_2 | |||||
| formants vwl_en_us/ee | |||||
| reduceto I 0 | reduceto I 0 | ||||
| endphoneme | endphoneme | ||||
| phoneme I | phoneme I | ||||
| vowel starttype (i) endtype (i) | vowel starttype (i) endtype (i) | ||||
| length 130 | |||||
| length 120 | |||||
| formants vwl_en_us/ii | formants vwl_en_us/ii | ||||
| linkout ; | linkout ; | ||||
| endphoneme | endphoneme | ||||
| phoneme i // optional variant of [I] for end of words | phoneme i // optional variant of [I] for end of words | ||||
| vowel starttype (i) endtype (i) | vowel starttype (i) endtype (i) | ||||
| length 170 | |||||
| formants vwl_en_us/i_final3 | |||||
| length 200 | |||||
| // formants vwl_en_us/i_final3 | |||||
| formants vowel/i# | |||||
| linkout ; | linkout ; | ||||
| endphoneme | endphoneme | ||||
| phoneme 0 | phoneme 0 | ||||
| vowel starttype (o) endtype (o) | vowel starttype (o) endtype (o) | ||||
| length 180 | |||||
| length 200 | |||||
| formants vowel/aa_8 | formants vowel/aa_8 | ||||
| reduceto @ 0 | reduceto @ 0 | ||||
| endphoneme | endphoneme | ||||
| phoneme V | phoneme V | ||||
| vowel starttype (a) endtype (@) | vowel starttype (a) endtype (@) | ||||
| length 170 | |||||
| // formants vwl_en_us/V | |||||
| formants vowel/V_2 | |||||
| length 165 | |||||
| // formants vowel/V_2 | |||||
| formants vowel/V | |||||
| reduceto @ 0 | reduceto @ 0 | ||||
| endphoneme | endphoneme | ||||
| phoneme 3: | phoneme 3: | ||||
| vowel starttype (@) endtype (@) | vowel starttype (@) endtype (@) | ||||
| length 220 | |||||
| length 190 | |||||
| // formants vwl_en_us/@r_us2 | // formants vwl_en_us/@r_us2 | ||||
| formants vwl_en_us/3_us | formants vwl_en_us/3_us | ||||
| // reduceto @ 0 | // reduceto @ 0 | ||||
| phoneme i: | phoneme i: | ||||
| vowel starttype (i) endtype (i) | vowel starttype (i) endtype (i) | ||||
| length 160 | |||||
| length 150 | |||||
| formants vowel/i_en | formants vowel/i_en | ||||
| after w w/wi2 | after w w/wi2 | ||||
| linkout ; | linkout ; | ||||
| phoneme O@ | phoneme O@ | ||||
| vowel starttype (o) endtype (@) | vowel starttype (o) endtype (@) | ||||
| length 240 | |||||
| length 270 | |||||
| formants vwl_en_us/oor | formants vwl_en_us/oor | ||||
| appendph r | appendph r | ||||
| endphoneme | endphoneme | ||||
| phoneme o@ | phoneme o@ | ||||
| vowel starttype (o) endtype (@) | vowel starttype (o) endtype (@) | ||||
| length 240 | |||||
| length 270 | |||||
| formants vwl_en_us/or | formants vwl_en_us/or | ||||
| appendph r | appendph r | ||||
| endphoneme | endphoneme | ||||
| phoneme O | phoneme O | ||||
| vowel starttype (o) endtype (o) | vowel starttype (o) endtype (o) | ||||
| length 150 | |||||
| length 200 | |||||
| formants vwl_en_us/oo | formants vwl_en_us/oo | ||||
| reduceto @ 0 | reduceto @ 0 | ||||
| endphoneme | endphoneme | ||||
| phoneme u: | phoneme u: | ||||
| vowel starttype (u) endtype (u) | vowel starttype (u) endtype (u) | ||||
| length 170 | |||||
| formants vowel/u_3 | |||||
| before l/2 vwl_en/u_L-40+l/L2_uL | |||||
| length 160 | |||||
| formants vowel/u#_5 | |||||
| // before l/2 vwl_en/u_L-40+l/L2_uL | |||||
| endphoneme | endphoneme | ||||
| phoneme aU | phoneme aU | ||||
| vowel starttype (a) endtype (u) | vowel starttype (a) endtype (u) | ||||
| length 200 | |||||
| length 210 | |||||
| formants vdiph/au_2 | formants vdiph/au_2 | ||||
| endphoneme | endphoneme | ||||
| phoneme oU | phoneme oU | ||||
| vowel starttype (@) endtype (u) | vowel starttype (@) endtype (u) | ||||
| length 210 | |||||
| length 240 | |||||
| formants vdiph/8u | formants vdiph/8u | ||||
| endphoneme | endphoneme | ||||
| phoneme aI | phoneme aI | ||||
| vowel starttype (a) endtype (i) | vowel starttype (a) endtype (i) | ||||
| length 210 | |||||
| length 235 | |||||
| formants vwl_en_us/aai | formants vwl_en_us/aai | ||||
| endphoneme | endphoneme | ||||
| phoneme eI | phoneme eI | ||||
| vowel starttype (e) endtype (i) | vowel starttype (e) endtype (i) | ||||
| length 210 | |||||
| formants vdiph/eei_2 | |||||
| length 235 | |||||
| // formants vdiph/eei_2 | |||||
| formants vwl_en_us/ei | |||||
| endphoneme | endphoneme | ||||
| phoneme OI | phoneme OI | ||||
| vowel starttype (o) endtype (i) | vowel starttype (o) endtype (i) | ||||
| length 220 | |||||
| formants vdiph/ooi | |||||
| length 300 | |||||
| formants vdiph/ooi_3 | |||||
| endphoneme | endphoneme | ||||
| phoneme e@ | phoneme e@ | ||||
| vowel starttype (e) endtype (@) | vowel starttype (e) endtype (@) | ||||
| length 250 | |||||
| length 280 | |||||
| formants vwl_en_us/er | formants vwl_en_us/er | ||||
| appendph r | appendph r | ||||
| endphoneme | endphoneme | ||||
| phoneme i@ | phoneme i@ | ||||
| vowel starttype (i) endtype (@) | vowel starttype (i) endtype (@) | ||||
| length 220 | |||||
| length 230 | |||||
| formants vwl_en_us/ir | formants vwl_en_us/ir | ||||
| appendph r | appendph r | ||||
| endphoneme | endphoneme | ||||
| phoneme U@ | phoneme U@ | ||||
| vowel starttype (@) endtype (@) | vowel starttype (@) endtype (@) | ||||
| length 220 | |||||
| length 230 | |||||
| formants vwl_en_us/ur | formants vwl_en_us/ur | ||||
| linkout r- | linkout r- | ||||
| endphoneme | endphoneme | ||||
| vowelin f1=0 f2=1700 -300 300 f3=-100 80 | vowelin f1=0 f2=1700 -300 300 f3=-100 80 | ||||
| vowelout f1=0 f2=1700 -300 300 f3=-100 80 | vowelout f1=0 f2=1700 -300 300 f3=-100 80 | ||||
| lengthmod 5 | lengthmod 5 | ||||
| wave x/d%80 | |||||
| wave x/d%70 | |||||
| endphoneme | endphoneme | ||||
| void debug_init() | void debug_init() | ||||
| { | { | ||||
| fd_log = fopen(FILENAME,"a"); | |||||
| setvbuf(fd_log, NULL, _IONBF, 0); | |||||
| if((fd_log = fopen(FILENAME,"a")) != NULL) | |||||
| setvbuf(fd_log, NULL, _IONBF, 0); | |||||
| } | } | ||||
| void debug_enter(const char* text) | void debug_enter(const char* text) |
| int stress; | int stress; | ||||
| PHONEME_LIST *plist; | PHONEME_LIST *plist; | ||||
| static const char *stress_chars = "==,,'*"; | |||||
| static const char *stress_chars = "==,,''"; | |||||
| if(phon_out != NULL) | if(phon_out != NULL) | ||||
| { | { | ||||
| int g1; /* first group for this letter */ | int g1; /* first group for this letter */ | ||||
| int n; | int n; | ||||
| int letter; | int letter; | ||||
| int any_alpha=0; | |||||
| int ix; | int ix; | ||||
| int digit_count=0; | int digit_count=0; | ||||
| char *p; | char *p; | ||||
| while(((c = *p) != ' ') && (c != 0)) | while(((c = *p) != ' ') && (c != 0)) | ||||
| { | { | ||||
| if(IsAlpha(wc)) | |||||
| any_alpha = wc; | |||||
| wc_prev = wc; | wc_prev = wc; | ||||
| wc_bytes = utf8_in(&wc,p,0); | wc_bytes = utf8_in(&wc,p,0); | ||||
| n = groups2_count[c]; | n = groups2_count[c]; | ||||
| if(IsDigit(wc) && ((langopts.tone_numbers == 0) || !IsAlpha(wc_prev))) | |||||
| if(IsDigit(wc) && ((langopts.tone_numbers == 0) || !any_alpha)) | |||||
| { | { | ||||
| // lookup the number in *_list not *_rules | // lookup the number in *_list not *_rules | ||||
| char string[8]; | char string[8]; |
| int final_stressed=0; | int final_stressed=0; | ||||
| int tone_ph; | int tone_ph; | ||||
| int pause; | |||||
| int tone_promoted; | |||||
| PHONEME_TAB *tph; | PHONEME_TAB *tph; | ||||
| PHONEME_TAB *prev_tph; // forget across word boundary | PHONEME_TAB *prev_tph; // forget across word boundary | ||||
| PHONEME_TAB *prevw_tph; // remember across word boundary | PHONEME_TAB *prevw_tph; // remember across word boundary | ||||
| } | } | ||||
| pause = 1; | |||||
| tone_promoted = 0; | |||||
| prev_p = p = &phoneme_list[0]; | prev_p = p = &phoneme_list[0]; | ||||
| prev_tph = prevw_tph = phoneme_tab[phonPAUSE]; | prev_tph = prevw_tph = phoneme_tab[phonPAUSE]; | ||||
| // perform tone sandhi | // perform tone sandhi | ||||
| for(ix=0; ix<n_phoneme_list; ix++, p++) | for(ix=0; ix<n_phoneme_list; ix++, p++) | ||||
| { | { | ||||
| if((p->newword) && ((option_tone1 & 1)==0)) | |||||
| if((p->type == phPAUSE) && (p->ph->std_length > 50)) | |||||
| { | |||||
| pause = 1; // there is a pause since the previous vowel | |||||
| } | |||||
| if(p->newword) | |||||
| { | { | ||||
| prev_tph = phoneme_tab[phonPAUSE]; // forget across word boundaries | prev_tph = phoneme_tab[phonPAUSE]; // forget across word boundaries | ||||
| } | } | ||||
| if(p->type == phVOWEL) | if(p->type == phVOWEL) | ||||
| { | { | ||||
| tone_ph = p->tone_ph; | tone_ph = p->tone_ph; | ||||
| if(tone_ph == 0) | |||||
| p->tone_ph = tone_ph = LookupPh("11"); // default tone 5 | |||||
| tph = phoneme_tab[tone_ph]; | tph = phoneme_tab[tone_ph]; | ||||
| // Mandarin | // Mandarin | ||||
| if(translator_name == L('z','h')) | if(translator_name == L('z','h')) | ||||
| { | { | ||||
| if(tone_ph == 0) | |||||
| { | |||||
| if(pause || tone_promoted) | |||||
| { | |||||
| tone_ph = LookupPh("55"); // no previous vowel, use tone 1 | |||||
| tone_promoted = 1; | |||||
| } | |||||
| else | |||||
| { | |||||
| tone_ph = LookupPh("11"); // default tone 5 | |||||
| } | |||||
| p->tone_ph = tone_ph; | |||||
| tph = phoneme_tab[tone_ph]; | |||||
| } | |||||
| else | |||||
| { | |||||
| tone_promoted = 0; | |||||
| } | |||||
| if(prev_tph->mnemonic == 0x343132) // [214] | if(prev_tph->mnemonic == 0x343132) // [214] | ||||
| { | { | ||||
| if(tph->mnemonic == 0x343132) // [214] | if(tph->mnemonic == 0x343132) // [214] | ||||
| prev_p = p; | prev_p = p; | ||||
| prev2_tph = prevw_tph; | prev2_tph = prevw_tph; | ||||
| prevw_tph = prev_tph = tph; | prevw_tph = prev_tph = tph; | ||||
| pause = 0; | |||||
| } | } | ||||
| } | } | ||||