Browse Source

Preserve the sourceix property of a deleted phonSWITCH phoneme.

master
Reece H. Dunn 7 years ago
parent
commit
65186c07df
3 changed files with 14 additions and 3 deletions
  1. 9
    1
      src/libespeak-ng/phonemelist.c
  2. 1
    1
      tests/language-pronunciation.test
  3. 4
    1
      tests/translate.test

+ 9
- 1
src/libespeak-ng/phonemelist.c View File

// look for switch of phoneme tables // look for switch of phoneme tables
delete_count = 0; delete_count = 0;
current_phoneme_tab = tr->phoneme_tab_ix; current_phoneme_tab = tr->phoneme_tab_ix;
int deleted_sourceix = -1;
for (j = 0; j < *n_ph_list2; j++) { for (j = 0; j < *n_ph_list2; j++) {
if (current_phoneme_tab != tr->phoneme_tab_ix) if (current_phoneme_tab != tr->phoneme_tab_ix)
plist2[j].synthflags |= SFLAG_SWITCHED_LANG; plist2[j].synthflags |= SFLAG_SWITCHED_LANG;


if (delete_count > 0)
if (delete_count > 0) {
memcpy(&plist2[j-delete_count], &plist2[j], sizeof(plist2[0])); memcpy(&plist2[j-delete_count], &plist2[j], sizeof(plist2[0]));
if (deleted_sourceix != -1) {
plist2[j-delete_count].sourceix = deleted_sourceix;
deleted_sourceix = -1;
}
}


if (plist2[j].phcode == phonSWITCH) { if (plist2[j].phcode == phonSWITCH) {
if ((!(plist2[j].synthflags & SFLAG_EMBEDDED)) && ( if ((!(plist2[j].synthflags & SFLAG_EMBEDDED)) && (
)) { )) {
// delete this phonSWITCH if it's switching to the current phoneme table, or // delete this phonSWITCH if it's switching to the current phoneme table, or
// delete this phonSWITCH if its followed by another phonSWITCH // delete this phonSWITCH if its followed by another phonSWITCH
if (deleted_sourceix == -1 && plist2[j].sourceix != 0)
deleted_sourceix = plist2[j].sourceix;
delete_count++; delete_count++;
} else } else
current_phoneme_tab = plist2[j].tone_ph; current_phoneme_tab = plist2[j].tone_ph;

+ 1
- 1
tests/language-pronunciation.test View File

test_phonemes gu "Gujr" " d@*'e:k vj@kt'Ine: S,IkS@n.'Vno: Vd#'Ika:r c#'e:\n o:c#'a:mV~ 'o:c#u~ pr,a:t#m'Ik 'Vne: pa:j'a:na: t,@bk:a:'o:mV~ SIkS'Vn. m@p#'Vt r@2H'e:Se:\n pr,a:t#m'Ik SIkS'Vn. p#,@*JIj'a:t r@2H'e:Se:\n wIS'e:s. w,Ig#a:v,Is.@j'@k 'Vne: vj,@vs'a:ji SIkS'Vn. s,a:ma:nj'@t@H ,Up@l'Vbd# r@2H'e:Se: 'Vne: j,o:gj@t'a:na: d#o:r'Vn. p'Vr 'Uc: SIkS'Vn. pr'a:pt k,@rv'a:no: s@rv'Vne: s@m'a:n Vd#'Ika:r r@2H'e:Se:" "દરેક વ્યક્તિને શિક્ષણનો અધિકાર છે. ઓછામાં ઓછું પ્રાથમિક અને પાયાના તબક્કાઓમાં શિક્ષણ મફત રહેશે. પ્રાથમિક શિક્ષણ ફરજિયાત રહેશે. વિશેષ વિઘાવિષયક અને વ્યવસાયી શિક્ષણ સામાન્યતઃ ઉપલબ્ધ રહેશે અને યોગ્યતાના ધોરણ પર ઉચ્ચ શિક્ષણ પ્રાપ્ત કરવાનો સર્વને સમાન અધિકાર રહેશે." test_phonemes gu "Gujr" " d@*'e:k vj@kt'Ine: S,IkS@n.'Vno: Vd#'Ika:r c#'e:\n o:c#'a:mV~ 'o:c#u~ pr,a:t#m'Ik 'Vne: pa:j'a:na: t,@bk:a:'o:mV~ SIkS'Vn. m@p#'Vt r@2H'e:Se:\n pr,a:t#m'Ik SIkS'Vn. p#,@*JIj'a:t r@2H'e:Se:\n wIS'e:s. w,Ig#a:v,Is.@j'@k 'Vne: vj,@vs'a:ji SIkS'Vn. s,a:ma:nj'@t@H ,Up@l'Vbd# r@2H'e:Se: 'Vne: j,o:gj@t'a:na: d#o:r'Vn. p'Vr 'Uc: SIkS'Vn. pr'a:pt k,@rv'a:no: s@rv'Vne: s@m'a:n Vd#'Ika:r r@2H'e:Se:" "દરેક વ્યક્તિને શિક્ષણનો અધિકાર છે. ઓછામાં ઓછું પ્રાથમિક અને પાયાના તબક્કાઓમાં શિક્ષણ મફત રહેશે. પ્રાથમિક શિક્ષણ ફરજિયાત રહેશે. વિશેષ વિઘાવિષયક અને વ્યવસાયી શિક્ષણ સામાન્યતઃ ઉપલબ્ધ રહેશે અને યોગ્યતાના ધોરણ પર ઉચ્ચ શિક્ષણ પ્રાપ્ત કરવાનો સર્વને સમાન અધિકાર રહેશે."
test_phonemes hi "Deva" " r'Is.Ij,o~ ko: s@t'a:ne: v'a:le: d'Us.t. r'a:kS@s,o~ ke: r'a:Ja: r'a:v@n. ka: s,@rv@n'a:S k'Vrn,e: v'a:le: v,Is.n.Uvt'a:r b#,@gv'a:n Sri*'a:m\n Vj'o:d#ja: ke: m,aha:*'a:J d'VS@*,@t# ke: b'Vr.e: s@p'Utr@- t#e:" "ऋषियों को सताने वाले दुष्ट राक्षसों के राजा रावण का सर्वनाश करने वाले विष्णुवतार भगवान श्रीराम, अयोध्या के महाराज दशरथ के बड़े सपुत्र थे।" test_phonemes hi "Deva" " r'Is.Ij,o~ ko: s@t'a:ne: v'a:le: d'Us.t. r'a:kS@s,o~ ke: r'a:Ja: r'a:v@n. ka: s,@rv@n'a:S k'Vrn,e: v'a:le: v,Is.n.Uvt'a:r b#,@gv'a:n Sri*'a:m\n Vj'o:d#ja: ke: m,aha:*'a:J d'VS@*,@t# ke: b'Vr.e: s@p'Utr@- t#e:" "ऋषियों को सताने वाले दुष्ट राक्षसों के राजा रावण का सर्वनाश करने वाले विष्णुवतार भगवान श्रीराम, अयोध्या के महाराज दशरथ के बड़े सपुत्र थे।"
test_phonemes hy "Armn" " k@rn'am ,apak'i ut'el j'ev ints'i ,anhang'ist tS#@n'er" "Կրնամ ապակի ուտել և ինծի անհանգիստ չըներ։" test_phonemes hy "Armn" " k@rn'am ,apak'i ut'el j'ev ints'i ,anhang'ist tS#@n'er" "Կրնամ ապակի ուտել և ինծի անհանգիստ չըներ։"
test_phonemes hyw "Armn" "g@rn'am ,abag'i ud'el j'ev indz'i ,anhank#'isd tS#@n'er" "Կրնամ ապակի ուտել և ինծի անհանգիստ չըներ։" # Bug: https://github.com/espeak-ng/espeak-ng/issues/528, otput is adjusted to not have space at the start of the line:
test_phonemes hyw "Armn" " g@rn'am ,abag'i ud'el j'ev indz'i ,anhank#'isd tS#@n'er" "Կրնամ ապակի ուտել և ինծի անհանգիստ չըներ։"
test_phonemes hr "Cyrl" " l^'ub&znI f'En^eRdZ,Ij& tS'adZ;&vog l'its& x'otS;E d'a m'i p'ok&ZE St'os" "Љубазни фењерџија чађавог лица хоће да ми покаже штос." test_phonemes hr "Cyrl" " l^'ub&znI f'En^eRdZ,Ij& tS'adZ;&vog l'its& x'otS;E d'a m'i p'ok&ZE St'os" "Љубазни фењерџија чађавог лица хоће да ми покаже штос."
test_phonemes hr "Latn" " l^'ub&znI f'En^eRdZ,Ij& tS'adZ;&vog l'its& x'otS;E d'a m'i p'ok&ZE St'os" "Ljubazni fenjerdžija čađavog lica hoće da mi pokaže štos." test_phonemes hr "Latn" " l^'ub&znI f'En^eRdZ,Ij& tS'adZ;&vog l'its& x'otS;E d'a m'i p'ok&ZE St'os" "Ljubazni fenjerdžija čađavog lica hoće da mi pokaže štos."
test_phonemes ht "Latn" " tou'ut mou'un f'et l'ib\n eg'al eg'o pou'u dijit'e kou'u w'e dw'a\n nou,u g'en l'a hez'on 'ak l'a konsj'ans ep'i nou,u f'et pou'u nou,u aj'i jou'un 'ak l'ot 'ak j'on lesph'i fwatenit'e" "Tout moun fèt lib, egal ego pou diyite kou wè dwa. Nou gen la rezon ak la konsyans epi nou fèt pou nou aji youn ak lot ak yon lespri fwatènite." test_phonemes ht "Latn" " tou'ut mou'un f'et l'ib\n eg'al eg'o pou'u dijit'e kou'u w'e dw'a\n nou,u g'en l'a hez'on 'ak l'a konsj'ans ep'i nou,u f'et pou'u nou,u aj'i jou'un 'ak l'ot 'ak j'on lesph'i fwatenit'e" "Tout moun fèt lib, egal ego pou diyite kou wè dwa. Nou gen la rezon ak la konsyans epi nou fèt pou nou aji youn ak lot ak yon lespri fwatènite."

+ 4
- 1
tests/translate.test View File

test_phonemes hi " ka:n'u:n" "कानून" test_phonemes hi " ka:n'u:n" "कानून"


# A deleted phoneme at the start of a word should preserve the sourceix property. # A deleted phoneme at the start of a word should preserve the sourceix property.
test_phonemes en-GB-x-gbcwmd " 'av" "have"
test_phonemes en-GB-x-gbcwmd " aI 'av" "I have"

# A deleted phonSWITCH should preserve the sourceix property of the deleted phoneme.
test_phonemes hyw " 'a g@rn'am" "A Կրնամ"


#----- Emoji [http://www.unicode.org/reports/tr51/tr51-12.html] ----- #----- Emoji [http://www.unicode.org/reports/tr51/tr51-12.html] -----



Loading…
Cancel
Save