From 33fd0ad29fd66ed18f03bae90f4913b923b528ab Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Sat, 19 May 2018 18:27:39 +0300 Subject: [PATCH 01/17] ar: add missing suffix (fathatan alef) --- dictsource/ar_rules | 1 + 1 file changed, 1 insertion(+) diff --git a/dictsource/ar_rules b/dictsource/ar_rules index a7524353..f53eb507 100644 --- a/dictsource/ar_rules +++ b/dictsource/ar_rules @@ -346,6 +346,7 @@ ُ u // damma ُو uu َا aa + ًا (_S2 an َى aa ٰ aa // superscript alef ِ i // kasra From 360983a3c6b58e0729d30f3c28338476fb282c08 Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Wed, 23 May 2018 21:49:03 +0300 Subject: [PATCH 02/17] ar: format phoneme translation table --- phsource/mbrola/ar1 | 120 +++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 63 deletions(-) diff --git a/phsource/mbrola/ar1 b/phsource/mbrola/ar1 index fa74c376..4bb74304 100644 --- a/phsource/mbrola/ar1 +++ b/phsource/mbrola/ar1 @@ -1,77 +1,71 @@ - volume 50 -0 B b 20 b b -0 b NULL 0 b -0 t NULL 0 t -0 T NULL 0 T -0 dZ NULL 0 Z - -1 H a 40 X a -1 H u 40 X u -1 H i 40 X i -0 H NULL 0 X -0 X NULL 0 x +0 B b 20 b b +0 b NULL 0 b +0 t NULL 0 t +0 T NULL 0 T +0 dZ NULL 0 Z -0 d d 20 d d -0 d NULL 0 d - -0 D NULL 0 D -0 r/ NULL 0 r -0 r NULL 0 r +1 H a 40 X a +1 H u 40 X u +1 H i 40 X i +0 H NULL 0 X -0 z NULL 0 z -0 s NULL 0 s -0 S NULL 0 S +0 X NULL 0 x -1 s[ a 40 s. a. -1 s[ u 40 s. u. -1 s[ i 40 s. i. -0 s[ NULL 0 s. +0 d d 20 d d +0 d NULL 0 d -1 dH dH 40 d. d. -1 dH a 40 d. a. -1 dH i 40 d. i. -1 dH u 40 d. u. -0 dH NULL 0 d. +0 D NULL 0 D +0 r/ NULL 0 r +0 r NULL 0 r -0 t[ a 90 t. a. -0 t[ u 90 t. u. -0 t[ i 90 t. i. -0 t[ NULL 0 t. +0 z NULL 0 z +0 s NULL 0 s +0 S NULL 0 S +1 s[ a 40 s. a. +1 s[ u 40 s. u. +1 s[ i 40 s. i. +0 s[ NULL 0 s. -1 Z a 20 z. a. -1 Z u 20 z. u. -1 Z i 20 z. i. -0 Z NULL 0 z. +1 dH dH 40 d. d. +1 dH a 40 d. a. +1 dH i 40 d. i. +1 dH u 40 d. u. +0 dH NULL 0 d. -0 A NULL 0 H -0 gH NULL 0 G -0 f NULL 0 f -0 q NULL 0 q -0 k NULL 0 k -0 l/ NULL 0 l -0 l NULL 0 l +0 t[ a 90 t. a. +0 t[ u 90 t. u. +0 t[ i 90 t. i. +0 t[ NULL 0 t. -0 m m 100 n m -0 m NULL 0 m - -0 n NULL 0 n -0 h NULL 0 h -0 w NULL 0 w -0 j NULL 0 j -0 ? NULL 0 ? -0 p NULL 0 NULL -0 g NULL 0 NULL -0 a a 150 a a -0 u u 150 u u -0 i i 150 i i -0 a NULL 0 a -0 u NULL 0 u -0 i NULL 0 i - - +1 Z a 20 z. a. +1 Z u 20 z. u. +1 Z i 20 z. i. +0 Z NULL 0 z. +0 A NULL 0 H +0 gH NULL 0 G +0 f NULL 0 f +0 q NULL 0 q +0 k NULL 0 k +0 l/ NULL 0 l +0 l NULL 0 l +0 m m 100 n m +0 m NULL 0 m +0 n NULL 0 n +0 h NULL 0 h +0 w NULL 0 w +0 j NULL 0 j +0 ? NULL 0 ? +0 p NULL 0 NULL +0 g NULL 0 NULL +0 a a 150 a a +0 u u 150 u u +0 i i 150 i i +0 a NULL 0 a +0 u NULL 0 u +0 i NULL 0 i From 6e9ca1a0720d2b0ef946d2e649bc08388cd521f4 Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Wed, 23 May 2018 22:01:24 +0300 Subject: [PATCH 03/17] ar: replace doubled phonemes with lengthening phoneme : --- dictsource/ar_rules | 52 ++++++++++++++++++++++----------------------- phsource/mbrola/ar1 | 12 +++++++---- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/dictsource/ar_rules b/dictsource/ar_rules index f53eb507..ec3231f6 100644 --- a/dictsource/ar_rules +++ b/dictsource/ar_rules @@ -136,7 +136,7 @@ _) ت (P1 ta //تسأل _َ) ت (P2 t ت (_S1 at //سألت - تّ tt + تّ t: .group ث ث T @@ -153,7 +153,7 @@ .group د د d - دّ dd + دّ d: .group ذ ذ D @@ -166,11 +166,11 @@ .group س س s - سّ ss + سّ s: .group ش ش S - شّ SS + شّ S: .group ص ص s[ @@ -240,8 +240,8 @@ _) كال (لP3 kal _) كال (نP3 kan كم (_S2 kum //الضمير المتصل - كما (_S3 kumaa //الضمير المتصل - كن (_S2 kunna //الضمير المتصل + كما (_S3 kuma: //الضمير المتصل + كن (_S2 kun:a //الضمير المتصل .group گ گ g @@ -252,7 +252,7 @@ _بِا) ل (L10 ' // Sun letters _فَا) ل (L10 ' // Sun letters _كَا) ل (L10 ' // Sun letters - لّ ll + لّ l: _لِ) ل (L10 ' // Sun letters _وَا) ل (L10 ' // Sun letters @@ -267,13 +267,13 @@ .group ه ه h ه (_S1 h // الضمير المتصل - ها (_S2 haa //الضمير المتصل + ها (_S2 ha: //الضمير المتصل هم (_S2 hum //الضمير المتصل - هما (_S3 humaa //الضمير المتصل - هن (_S2 hunna //الضمير المتصل + هما (_S3 huma: //الضمير المتصل + هن (_S2 hun:a //الضمير المتصل .group و - L03) و uu //واو بعد صامت دون تشكيل + L03) و u: //واو بعد صامت دون تشكيل ا) و w //واو بعد الألف و (L01 w //واو بعدها حرف علة ْ) و w // واو بعد سكون @@ -281,7 +281,7 @@ ِ) و w //واو بعد كسرة _) و w //واو في أول الكلمة وا (_S2 u - وا (_S2 uu // فعل مع ضمائر الجمع المذكرة درسوا + وا (_S2 u: // فعل مع ضمائر الجمع المذكرة درسوا _) وال (L10P3 wa //والشمس _) وَال (L10P4 wa _) وَالْ (L10P4 wa @@ -302,28 +302,28 @@ _) وال (ظP3 waZ _) وال (لP3 wal _) وال (نP3 wan - ون (_S2 uuna //جمع مذكر سالم فلاحون + ون (_S2 u:na //جمع مذكر سالم فلاحون .group ي - L03) ي ii // ياء بعد صامت دون تشكيل + L03) ي i: // ياء بعد صامت دون تشكيل ا) ي j // ياء بعد ألف - يِ jii + يِ ji: ْ) ي j //ياء بعد سكون ُ) ي j //ياء بعد ضمّة َ) ي j // ياء بعد فتحة _) ي j // ياء في أول الكلمة ي (L01 j //يا بعدها حروف علة ي (_S1 i - ي (_S1 ii //ياء النسبة - يات (_S3 ijjaat //يّة النسبة في جمع المؤنث جزائريات - ية (_S2 ijjah //يّة النسبة - ين (_S2 iina //جمع مذكر سالم منصوب أو مجرور - يون (_S3 ijjuun //kجمع مذكر سالم منسوب جزائريون - يين (_S3 ijjiin //kجمع مذكر سالم منسوب جزائريين + ي (_S1 i: //ياء النسبة + يات (_S3 ij:aat //يّة النسبة في جمع المؤنث جزائريات + ية (_S2 ij:ah //يّة النسبة + ين (_S2 i:na //جمع مذكر سالم منصوب أو مجرور + يون (_S3 ij:u:n //kجمع مذكر سالم منسوب جزائريون + يين (_S3 ij:i:n //kجمع مذكر سالم منسوب جزائريين .group ى //ألف مقصورة ى a - L03) ى (_ aa + L03) ى (_ a: .group ء ء ? @@ -344,11 +344,11 @@ ٍ (_S1 in // kasratan at the end of word ٌ (_S1 un // dammatan at the end of word ُ u // damma - ُو uu - َا aa + ُو u: + َا a: ًا (_S2 an - َى aa - ٰ aa // superscript alef + َى a: + ٰ a: // superscript alef ِ i // kasra َ %a // fatha diff --git a/phsource/mbrola/ar1 b/phsource/mbrola/ar1 index 4bb74304..86d3539d 100644 --- a/phsource/mbrola/ar1 +++ b/phsource/mbrola/ar1 @@ -2,6 +2,7 @@ volume 50 0 B b 20 b b 0 b NULL 0 b +0 t : 50 t t 0 t NULL 0 t 0 T NULL 0 T 0 dZ NULL 0 Z @@ -13,7 +14,7 @@ volume 50 0 X NULL 0 x -0 d d 20 d d +0 d : 50 d d 0 d NULL 0 d 0 D NULL 0 D @@ -21,7 +22,9 @@ volume 50 0 r NULL 0 r 0 z NULL 0 z +0 s : 50 s s 0 s NULL 0 s +0 S : 50 S S 0 S NULL 0 S 1 s[ a 40 s. a. @@ -59,13 +62,14 @@ volume 50 0 n NULL 0 n 0 h NULL 0 h 0 w NULL 0 w +0 j : 50 j j 0 j NULL 0 j 0 ? NULL 0 ? 0 p NULL 0 NULL 0 g NULL 0 NULL -0 a a 150 a a -0 u u 150 u u -0 i i 150 i i +0 a : 50 a a 0 a NULL 0 a +0 u : 50 u u 0 u NULL 0 u +0 i : 50 i i 0 i NULL 0 i From 06d5e09e33f244bfc6bad5bdaee7209ac03cd3ed Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Wed, 23 May 2018 22:12:50 +0300 Subject: [PATCH 04/17] ar: introduce group for diacritics This group is used as a padding between consonant letter and its other diacritics which may be in arbitrary order --- dictsource/ar_rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dictsource/ar_rules b/dictsource/ar_rules index ec3231f6..7556c7db 100644 --- a/dictsource/ar_rules +++ b/dictsource/ar_rules @@ -73,6 +73,9 @@ // Arabic Moon characters .L11 ق ف غ ع ه خ ح ج ي ب م ك و إ أ ء +// Arabic diacritics +.L20 ۡ ـ ً ٌ ٍ َ ُ ِ ّ ْ + .group آ آ ?aa From b2d369856c26ea61fe15dfcb5847a2bd52d20247 Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Wed, 23 May 2018 22:43:38 +0300 Subject: [PATCH 05/17] ar: fix handling of shadda considering it may not be immediately after consonant --- dictsource/ar_rules | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dictsource/ar_rules b/dictsource/ar_rules index 7556c7db..6bf30c94 100644 --- a/dictsource/ar_rules +++ b/dictsource/ar_rules @@ -135,6 +135,8 @@ .group ت ت t + ت (ّ t: + ت (L20ّ t: _) ت (َP1 t _) ت (P1 ta //تسأل _َ) ت (P2 t @@ -156,7 +158,8 @@ .group د د d - دّ d: + د (ّ d: + د (L20ّ d: .group ذ ذ D @@ -169,11 +172,13 @@ .group س س s - سّ s: + س (ّ s: + س (L20ّ s: .group ش ش S - شّ S: + ش (ّ S: + ش (L20ّ S: .group ص ص s[ @@ -223,6 +228,8 @@ .group ك ك k ك (_S1 ka // الضمير المتصل + ك (ّ k: + ك (L20ّ k: _) كال (L10P3 ka //كالشمس _) كَال (L10P4 ka _) كَالْ (L10P4 ka @@ -255,7 +262,8 @@ _بِا) ل (L10 ' // Sun letters _فَا) ل (L10 ' // Sun letters _كَا) ل (L10 ' // Sun letters - لّ l: + ل (ّ l: + ل (L20ّ l: _لِ) ل (L10 ' // Sun letters _وَا) ل (L10 ' // Sun letters @@ -364,6 +372,7 @@ ـ // tatweel ۡ // small high dotless head of khan ْ // sukun + ّ // shadda // non-ascii characters with specified pronunciations // List the accented characters in en_list with the $accent attribute From ad0a8ee6aa2dc15e95bea58ef42da7955f5d1256 Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Wed, 23 May 2018 23:58:43 +0300 Subject: [PATCH 06/17] ar: fix pronunciation of yeh and waw with hamza above --- dictsource/ar_rules | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dictsource/ar_rules b/dictsource/ar_rules index 6bf30c94..b5fca146 100644 --- a/dictsource/ar_rules +++ b/dictsource/ar_rules @@ -341,10 +341,12 @@ ء (ً ?an .group ئ - ئ ? + ئ j? + _) ئ ?j .group ؤ - ؤ ? + ؤ w? + _) ؤ ?w .group ة ة t From aca12b1460256a20b90d398a0da63598710471c5 Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Thu, 24 May 2018 20:38:50 +0300 Subject: [PATCH 07/17] ar: remove ambigous/redundant rule for yeh --- dictsource/ar_rules | 1 - 1 file changed, 1 deletion(-) diff --git a/dictsource/ar_rules b/dictsource/ar_rules index b5fca146..8b7a42fc 100644 --- a/dictsource/ar_rules +++ b/dictsource/ar_rules @@ -325,7 +325,6 @@ _) ي j // ياء في أول الكلمة ي (L01 j //يا بعدها حروف علة ي (_S1 i - ي (_S1 i: //ياء النسبة يات (_S3 ij:aat //يّة النسبة في جمع المؤنث جزائريات ية (_S2 ij:ah //يّة النسبة ين (_S2 i:na //جمع مذكر سالم منصوب أو مجرور From faf8596728da3e9aabfe65a6d73ec5b9b53cd03e Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Sun, 27 May 2018 19:33:29 +0300 Subject: [PATCH 08/17] docs: fix description for | and || as delimiters --- docs/dictionary.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/dictionary.md b/docs/dictionary.md index 00567eea..900763fd 100644 --- a/docs/dictionary.md +++ b/docs/dictionary.md @@ -56,8 +56,8 @@ The utility 'phonemes' are: | `=` | put the primary stress on the preceding syllable | | `_:` | short pause | | `_` | a shorter pause | -| | | indicates a word boundary within a phoneme string | -| || | can be used to separate two adjacent characters, to prevent them from being considered as a multi-character phoneme mnemonic | +| | | use to separate two adjacent characters, to prevent them from being considered as a single multi-character phoneme | +| || | indicates a word boundary within a phonetic string | It is not necessary to specify the stress of every syllable. Stress markers are only needed in order to change the effect of the language's From d50cf1bedc5b73517a4032d6c7dd1b6fdef6f8d8 Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Sun, 27 May 2018 20:21:15 +0300 Subject: [PATCH 09/17] lv: more rules for pronunciation --- dictsource/lv_list | 5 +++++ dictsource/lv_rules | 40 ++++++++++++++++++++++++++++++++-------- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/dictsource/lv_list b/dictsource/lv_list index dd2ac6b3..4a890cbf 100644 --- a/dictsource/lv_list +++ b/dictsource/lv_list @@ -250,6 +250,7 @@ kur $u+ labad $u lai $u+ līdz $u+ +lūk $u+ ļoti $u+ nav $u+ nedz $u $brk @@ -270,6 +271,8 @@ pie $u pirms $u+ pret $u+ priekš $u +projām $u+ +prom $u+ protams $u+ sauc $u+ starp $u @@ -279,6 +282,7 @@ taču $u $pause tad $u+ tagad $u+ tas $u+ +tātad $u+ $pause te $u+ tiek $u+ tikai $u+ @@ -436,6 +440,7 @@ vismaz $2 (it sevišķi) it||seviSci $u2+ (kaut arī) kaut||aRi: $u2+ (kaut cik) kaut||tsik $u2+ +(kaut gan) kaut||gan $u2+ (kaut kad) kaut||kad $u2+ (kaut kam) kaut||kam $u2+ (kaut kas) kaut||kas $u2+ diff --git a/dictsource/lv_rules b/dictsource/lv_rules index 1b9ea92e..e993acf7 100644 --- a/dictsource/lv_rules +++ b/dictsource/lv_rules @@ -224,6 +224,7 @@ _b) e (z_ e _b) e (z+ e _C) e (_ e // re, te, ve + c) e (nL83+ e c) e (tur e č) e (tr e d) ebe (L83 ebe @@ -247,6 +248,7 @@ e (strāL72 e etno etno _) e (vL04_+ e // Eva + e (vol e g) e (t e gr) e (dz E gr) e (z E @@ -256,6 +258,7 @@ int) ere (L83 eRe _j) e (b_ e _j) e (l_ e + kur) e (n e _ķ) eme (rL01_ eme // Ķemeri _L20) e (sam_+ _!e // esam _L20) e (sat_+ _!e // esat @@ -275,12 +278,15 @@ ņ) e (m e orķ) e e p) e (rs e + pr) ece (den etse pr) e (cL52z e pr) e (L71L05_ e // prece + pr) e (s e _pr) e (t e pr) etē (@ ete: proc) e (s e r) ecep (L88L05_ etsep // recepte + r) e (dak e r) e (dz e r) e (pub e r) e (put e @@ -295,6 +301,7 @@ _s) evastopo (lL05_ evastopo: // Sevastopole _s) e (v_ e // sev _s) e (vi_ e + sp) e (ķ e st) e (nd e str) e (s e t) e (c+ e @@ -303,6 +310,7 @@ t) e (km e t) ele ele _t) e (mp e + t) ende (n ende t) ermo eRmo t) e (st e _t) e (v_ e // tev @@ -376,11 +384,13 @@ // specific words ------------------------------------------------------------------- // ap) ē (d+ e: b) ē (g@ e: + C) ē (ts_ e: cilv) ē (L75 E: d) ē (ļ_+ e: d) ē (vē e: dv) ēse (L77 e:se - dz) ē (t e: + dz) ē (rL89 e: + dz) ē (t e: ēcē e:tse: ēdē e:de: ē (kL04_+ E: // ēka @@ -401,6 +411,7 @@ m) ē (L77L05+ e: // mēle m) ēne (L83 e:ne m) ē (rķ e: + m) ē (rL71 e: _m) ē (s_ e: // mēs _n) ē (_ e: ņ) ē (m++ e: @@ -409,6 +420,7 @@ _p) ē (c+ e: p) ē (dL04_ E: _p) ē (rL01_ e: // pērs + p) ē (rn E: p) ēte (r e:te // Pēter.. piem) ē (r E: sāp) ē (+ e: @@ -467,6 +479,8 @@ .group k k k + _) kaut (_ k,aut // secondary stress as average between verb and particle + _) klāt (_ kl,a:t // ... and similarly k (ļ k} // tiny pause between k and ļ .group ķ @@ -497,6 +511,8 @@ l) n (C n // but not after (lengthened) l L59) n (@ :n n (d N + _) ne (kād n%e + _) ne (vienādo n'e ne (vienl+ n'e // nevienlīdzība ne (vienmērīg n'e // nevienmērīgi _) ne (vien n%e // stress on 2nd syllable @@ -797,7 +813,7 @@ L46L45L45) o (<< uo versm) o uo // versmo viegl) o (+ uo vizm) o uo - zil) o (L80 uo + zil) o (L80+ uo žēl) o (L65+ uo žir) o o @@ -811,6 +827,8 @@ L46L45L45) o (<< uo g) ob (e ob k) ob ob l) ob (ē ob + _l) ob (ij ob + _l) ob (is ob l) oboto (m oboto m) ob ob _) ob (amL01_ ob // Obama @@ -916,6 +934,7 @@ L46L45L45) o (<< uo l) oj (L50 oj _ob) oj (L04_ oj // oboja _) oj (ārL01_ oj // Ojārs + _pr) oj (ām_ uoj pr) oj (L42 oj _tr) oj (L04_ oj // Troja z) oj (L01_+ oj // ..zojs @@ -1089,6 +1108,7 @@ L46L45L45) o (<< uo b) om (zL02_ om // bomzis br) om om c) om (_ om + _č) om (L01_ om d) om (in om d) om (nL04_ om // domna dr) om (L01_ o:m // ..droms @@ -1151,6 +1171,7 @@ L46L45L45) o (<< uo b) on (ē on b) on (us on br) on on + cens) on uon daig) on uon dail) on uon dalt) on o:n @@ -1209,7 +1230,7 @@ L46L45L45) o (<< uo on (ijL04_ o:n on (ist o:n on (ko oN - _) on (kuL77L02_ oN // onkulis + on (kuL77 oN on (L01_+ o:n // ..ons on (l oN onn onnn @@ -1250,9 +1271,8 @@ L46L45L45) o (<< uo z) oo oo: .group op - - L41Jsk) op (L01_ o:p // ...skops ad) op op + att) op uop cikl) op (L01_ o:p // ciklops d) op op eir) op (L04_ o:p @@ -1267,13 +1287,14 @@ L46L45L45) o (<< uo k) op (ē_ op // ..kopē k) op (ij op // ..kopij.. k) op (j uop // ..kopj.. - k) op (L65+ uop // ..kuop.. k) op (L04_+ uop // ..kopa + k) op (L65+ uop // ..kuop.. k) opo uopuo k) op (pr uop // ..koppr.. k) op (ulā op k) op (ulē op kr) op (ļo uop + L41Jsk) op (L01_ o:p // ...skops l) op (L01_+ uop m) op op net) op (_ uop @@ -1296,6 +1317,7 @@ L46L45L45) o (<< uo _p) op (L05_ uop // Pope p) op op pr) op op + sast) op uop sk) op (ijL04_ o:p // ..skopija sk) op (is o:p sk) op (L01_ o:p // ..skops @@ -1303,7 +1325,6 @@ L46L45L45) o (<< uo s) op (r op st) opo (s_ uopuo // ..stopos _str) op (L01_ uop // strops - _t) op uo`p // top with short uo because of ambiguity _t) op (āzL01_ op // topāzs _t) op (b op // topbura _t) op (inam op // topinambūrs @@ -1314,6 +1335,7 @@ L46L45L45) o (<< uo _t) opol opol _t) opon opon t) opot uopuot + _t) op uo`p // top with short uo because of ambiguity tr) op o:p ut) op (i o:p @@ -1551,6 +1573,7 @@ L46L45L45) o (<< uo n) ov (āci ov n) ov (elL05_ ov // novele _n) ov (emb ov // novembris + n) ov (ēr uov n) ov (it ov n) ov (L04_ ov // nova n) ov (o ov @@ -1558,8 +1581,8 @@ L46L45L45) o (<< uo _pl) ov (L01_ ov // plovs pr) ov (an ov pr) ov (in ov - pr) ov (L52z ov pr) ov (L05_ uov // prove + pr) ov (L52z ov pr) ovo ovo r) ov ov sl) ov ov @@ -1685,6 +1708,7 @@ L46L45L45) o (<< uo y y // y is used instead of simple "i", to distinguish them in writing y (A y_| y (_ y: // for international words + y (outub y .group z z z From a17eb39cc88c6215abd6d806cd58b073bd66bd6b Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Sun, 27 May 2018 21:54:15 +0300 Subject: [PATCH 10/17] ar: fix typo error in mapping file --- phsource/mbrola/ar1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phsource/mbrola/ar1 b/phsource/mbrola/ar1 index 86d3539d..962091b7 100644 --- a/phsource/mbrola/ar1 +++ b/phsource/mbrola/ar1 @@ -1,6 +1,6 @@ volume 50 -0 B b 20 b b +0 b b 20 b b 0 b NULL 0 b 0 t : 50 t t 0 t NULL 0 t From 08370155148fc619dc4a33a2f323393072ac85de Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Sun, 27 May 2018 21:58:59 +0300 Subject: [PATCH 11/17] ar: use the same mapping file for mb-ar1 and mb-ar2 voices There are small differences between diphone set of the voices, but they are not used from espeak-ng --- Makefile.am | 5 --- espeak-ng-data/voices/mb/mb-ar2 | 2 +- phsource/mbrola/ar2 | 74 --------------------------------- 3 files changed, 1 insertion(+), 80 deletions(-) delete mode 100644 phsource/mbrola/ar2 diff --git a/Makefile.am b/Makefile.am index 711ce1ed..26e5679e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -841,7 +841,6 @@ dictsource/zhy_emoji: mbrola: \ espeak-ng-data/mbrola_ph/af1_phtrans \ espeak-ng-data/mbrola_ph/ar1_phtrans \ - espeak-ng-data/mbrola_ph/ar2_phtrans \ espeak-ng-data/mbrola_ph/ca_phtrans \ espeak-ng-data/mbrola_ph/cr1_phtrans \ espeak-ng-data/mbrola_ph/cs_phtrans \ @@ -888,10 +887,6 @@ espeak-ng-data/mbrola_ph/ar1_phtrans: phsource/mbrola/ar1 src/espeak-ng mkdir -p espeak-ng-data/mbrola_ph ESPEAK_DATA_PATH=$(PWD) src/espeak-ng --compile-mbrola=phsource/mbrola/ar1 -espeak-ng-data/mbrola_ph/ar2_phtrans: phsource/mbrola/ar2 src/espeak-ng - mkdir -p espeak-ng-data/mbrola_ph - ESPEAK_DATA_PATH=$(PWD) src/espeak-ng --compile-mbrola=phsource/mbrola/ar2 - espeak-ng-data/mbrola_ph/ca_phtrans: phsource/mbrola/ca src/espeak-ng mkdir -p espeak-ng-data/mbrola_ph ESPEAK_DATA_PATH=$(PWD) src/espeak-ng --compile-mbrola=phsource/mbrola/ca diff --git a/espeak-ng-data/voices/mb/mb-ar2 b/espeak-ng-data/voices/mb/mb-ar2 index 00f1a5ea..cc19142f 100644 --- a/espeak-ng-data/voices/mb/mb-ar2 +++ b/espeak-ng-data/voices/mb/mb-ar2 @@ -3,4 +3,4 @@ language ar 2 gender male pitch 82 117 -mbrola ar2 ar2_phtrans +mbrola ar2 ar1_phtrans diff --git a/phsource/mbrola/ar2 b/phsource/mbrola/ar2 deleted file mode 100644 index 35a682e8..00000000 --- a/phsource/mbrola/ar2 +++ /dev/null @@ -1,74 +0,0 @@ - -volume 50 -0 b b 20 b b -0 b NULL 0 b -0 t NULL 0 t -0 T NULL 0 T -0 dZ NULL 0 Z - -1 H a 40 X a -1 H u 40 X u -1 H i 40 X i -0 H NULL 0 X - -0 X NULL 0 x -0 d NULL 0 d -0 D NULL 0 D -0 r/ NULL 0 r -0 r NULL 0 r - -0 z NULL 0 z -0 s NULL 0 s -0 S NULL 0 S - -1 s[ a 40 s. a. -1 s[ u 40 s. u. -1 s[ i 40 s. i. -0 s[ NULL 0 s. - -0 dH dH 30 d. d. -1 dH a 40 d. a. -1 dH i 40 d. i. -1 dH u 40 d. u. -0 dH NULL 0 d. - -0 t[ a 90 t. a. -0 t[ u 90 t. u. -0 t[ i 90 t. i. -0 t[ NULL 0 t. - - -1 Z a 20 z. a. -1 Z u 20 z. u. -1 Z i 20 z. i. -0 Z NULL 0 z. - -0 A NULL 0 H -0 gH NULL 0 G -0 f NULL 0 f -0 q NULL 0 q -0 k NULL 0 k -0 l/ NULL 0 l -0 l NULL 0 l - -0 m m 100 n m -0 m NULL 0 m - -0 n NULL 0 n -0 h NULL 0 h -0 w NULL 0 w -0 j NULL 0 j -0 ? NULL 0 ? -0 p NULL 0 NULL -0 g NULL 0 NULL -0 a a 150 a a -0 u u 150 u u -0 i i 150 i i -0 a NULL 0 a -0 u NULL 0 u -0 i NULL 0 i - - - - - From 789d820ad483ede1294265da0c04b780abedaad5 Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Tue, 29 May 2018 14:37:20 +0300 Subject: [PATCH 12/17] shn: add support for Shan language from ronaldaug --- Makefile.am | 5 + dictsource/shn_list | 24 +++ dictsource/shn_rules | 177 +++++++++++++++++++ espeak-ng-data/lang/tai/shn | 2 + phsource/ph_shan | 295 ++++++++++++++++++++++++++++++++ phsource/phonemes | 3 + src/libespeak-ng/tr_languages.c | 5 + tests/language-phonemes.test | 1 + 8 files changed, 512 insertions(+) create mode 100755 dictsource/shn_list create mode 100755 dictsource/shn_rules create mode 100755 espeak-ng-data/lang/tai/shn create mode 100755 phsource/ph_shan diff --git a/Makefile.am b/Makefile.am index 26e5679e..238475fb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -370,6 +370,7 @@ phsource/phonemes.stamp: \ phsource/ph_s_gaelic \ phsource/ph_serbian \ phsource/ph_setswana \ + phsource/ph_shan \ phsource/ph_sinhala \ phsource/ph_slovak \ phsource/ph_slovenian \ @@ -520,6 +521,7 @@ dictionaries: \ espeak-ng-data/ro_dict \ espeak-ng-data/ru_dict \ espeak-ng-data/sd_dict \ + espeak-ng-data/shn_dict \ espeak-ng-data/si_dict \ espeak-ng-data/sk_dict \ espeak-ng-data/sl_dict \ @@ -759,6 +761,9 @@ endif sd: espeak-ng-data/sd_dict espeak-ng-data/sd_dict: dictsource/sd_list dictsource/sd_rules dictsource/sd_extra dictsource/sd_emoji +shn: espeak-ng-data/shn_dict +espeak-ng-data/shn_dict: dictsource/shn_list dictsource/shn_rules dictsource/shn_extra + si: espeak-ng-data/si_dict espeak-ng-data/si_dict: dictsource/si_list dictsource/si_rules dictsource/si_extra dictsource/si_emoji diff --git a/dictsource/shn_list b/dictsource/shn_list new file mode 100755 index 00000000..e652e38c --- /dev/null +++ b/dictsource/shn_list @@ -0,0 +1,24 @@ +// numbers + +_0 son // သူၼ် +_1 nEN3 // ၼိုင်ႈ +_2 sON // သွင် +_3 sa:m // သၢမ် +_4 si:2 // သီႇ +_5 ha:3 // ႁႃႈ +_6 hok4 // ႁူၵ်း +_7 tS;et4 // ၸဵတ်း +_8 pEt2 // ပႅတ်ႇ +_9 kaw3 // ၵဝ်ႈ +_1X sip4|| // သိပ်း +_11 sip4||?et4 // သိပ်းဢဵတ်း +_2X sa:w4|| // သၢဝ်း +_21 sa:w4||?et4 // သၢဝ်းဢဵတ်း +_3X sa:m||sip4|| // သၢမ်သိပ်း +_4X si:2||sip4|| // သီႇသိပ်း +_5X ha:3||sip4|| // ႁႃႈသိပ်း +_6X hok4||sip4|| // ႁူၵ်းသိပ်း +_7X tS;et4||sip4|| // ၸဵတ်းသိပ်း +_8X pEt2||sip4|| // ပႅတ်ႇသိပ်း +_9X kaw3||sip4|| // ၵဝ်ႈသိပ်း + diff --git a/dictsource/shn_rules b/dictsource/shn_rules new file mode 100755 index 00000000..8a593d84 --- /dev/null +++ b/dictsource/shn_rules @@ -0,0 +1,177 @@ +// Shan (Tai Yay) pronunciation rules (Burmese script) + +.group င // U+1004 + င N + +.group တ // U+1010 + တ t + +.group ထ // U+1011 + ထ t_h + +.group ပ // U+1015 + ပ p + +.group မ // U+1019 + မ m + +.group ယ // U+101A + ယ j + +.group ရ // U+101B + ရ R + +.group လ // U+101C + လ l + +.group ဝ // U+101D + ဝ w + +.group သ // U+101E + သ s + +.group ဢ // U+1022 + ဢ ? + +.group ၵ // U+1075 + ၵ k + +.group ၶ // U+1076 + ၶ k_h + +.group ၷ // U+1077: rare, used for sounds in other languages + ၷ g + +.group ၸ // U+1078 + ၸ tS; + +.group ၹ // U+1079: rare, used for sounds in other languages + ၹ z + +.group ၺ // U+107A + ၺ J + +.group ၻ // U+107B: rare, used for sounds in other languages + ၻ d + +.group ၼ // U+107C + ၼ n + +.group ၽ // U+107D + ၽ p_h + +.group ၾ // U+107E + _) ၾ p_h // Except for Eastern dialects, which use 'f'. + ၾ f + +.group ႀ // U+107F: rare, used for sounds in other languages + ႀ T + +.group ၿ // U+1080: rare, used for sounds in other languages + ၿ b + +.group ႁ // U+1081 + ႁ h + + + +// Vowels in groups + +// All vowels below are suffixs + +.group ႃ + ႃ a + ေ)ႃ O + + +.group ီ + ီ i + +.group ိ + ိ i + +.group ဵ + ဵ e + +.group ႅ + _) ႅ (_ E + +.group ူ + ူ u + +.group ု + ု u + + +.group ေ + ေ ei // default rule without other characters + _) ေႃ O // in group with other characters if necessary + + +.group ႄ + ႄ E + +.group ႆ + ႆ ai + +.group ၢ + _) ၢ a: + + +.group ၢႆ // U+1062 + _) ၢႆ a:i + + + +.group ွႆ + _) ွႆ oi + + +.group ႂၢႆ + _) ႂၢႆ Oi + + + +.group ြ + ြ ra + + +.group ျ + _) ျ ja + + +.group ဝ် + _)ဝ် w + + +.group ႂ် + _) ႂ် @i + + +.group ၺ် + _)ၺ် Wi + + +.group မ် + _)မ် m + + +.group ၼ် + _)ၼ် n + + +.group င် + _)င် g // ipa = ɳ ( temporary word ) + + +// very short sounds +.group ပ် + _) ပ် p + + +.group တ် + _) တ် t + + +.group ၵ် + _) ၵ် k // temporary word \ No newline at end of file diff --git a/espeak-ng-data/lang/tai/shn b/espeak-ng-data/lang/tai/shn new file mode 100755 index 00000000..c93f373b --- /dev/null +++ b/espeak-ng-data/lang/tai/shn @@ -0,0 +1,2 @@ +name Shan (Tai Yai) +language shn diff --git a/phsource/ph_shan b/phsource/ph_shan new file mode 100755 index 00000000..6dd15a68 --- /dev/null +++ b/phsource/ph_shan @@ -0,0 +1,295 @@ +//******************************************************************* +// TONES +//******************************************************************* + +phoneme 1 // rising tone (contour: 24) + stress + Tone(20, 40, envelope/p_rise, NULL) +endphoneme + +phoneme 2 // low tone (contour: 11) + stress + Tone(10, 10, envelope/i_risefall, NULL) +endphoneme + +phoneme 3 // mid(-falling) tone (contour: 32) + stress + Tone(30, 20, envelope/p_fall, NULL) +endphoneme + +phoneme 4 // high tone (contour: 55) + stress + Tone(50, 50, envelope/i_risefall, NULL) +endphoneme + +phoneme 5 // falling (creaky) tone (contour: 42) + stress + Tone(40, 20, envelope/p_fall, NULL) +endphoneme + +phoneme 6 // emphatic (contour: 343) + stress + Tone(30, 40, envelope/i_risefall, NULL) +endphoneme + +//******************************************************************* +// CONSONANTS (PLOSIVES/STOPS) +//******************************************************************* + +phoneme p // unaspirated + vls blb stp + lengthmod 2 + Vowelin f1=0 f2=1000 -50 -100 f3=-200 80 amp=11 + Vowelout f1=0 f2=1000 -500 -350 f3=-300 80 rms=22 + + IF nextPh(isPause2) THEN + WAV(ustop/p_) + ENDIF + WAV(ustop/p_unasp) +endphoneme + +phoneme p_h // aspirated + vls blb stp + lengthmod 2 + Vowelin f1=0 f2=1000 -50 -100 f3=-200 80 + Vowelout f1=0 f2=1000 -500 -350 f3=-300 80 rms=30 + + WAV(ustop/p_asp) +endphoneme + +phoneme t // unaspirated + vls alv stp + lengthmod 2 + Vowelin f1=0 f2=1700 -300 300 f3=-100 80 + Vowelout f1=0 f2=1700 -300 250 f3=-100 80 rms=20 + + IF nextPh(isPause2) THEN + WAV(ustop/t_) + ENDIF + WAV(ustop/t_unasp) +endphoneme + +phoneme t_h // aspirated + vls alv stp + lengthmod 2 + Vowelin f1=0 f2=1700 -300 300 f3=-100 80 + Vowelout f1=0 f2=1700 -300 250 f3=-100 80 rms=20 + + WAV(ustop/t) // TODO: This should be aspirated. +endphoneme + +phoneme k // unaspirated + vls vel stp + lengthmod 2 + Vowelin f1=0 f2=2300 200 300 f3=-200 80 + Vowelout f1=0 f2=2300 300 400 f3=-200 80 rms=20 + + IF KlattSynth THEN + Vowelout f1=0 f2=2300 200 300 f3=-200 80 rms=20 + ENDIF + + IF nextPh(isPause2) THEN + WAV(ustop/k_) + ENDIF + WAV(ustop/k_unasp) +endphoneme + +phoneme k_h + vls vel stp + lengthmod 2 + Vowelin f1=0 f2=2300 200 300 f3=-150 80 + Vowelout f1=0 f2=2300 300 400 f3=-150 80 rms=20 + + WAV(ustop/k_asp) +endphoneme + +//******************************************************************* +// VOWELS +//******************************************************************* + +phoneme i + vwl starttype #i endtype #i + length 200 + + FMT(vowel/i) +endphoneme + +phoneme i. + vwl starttype #i endtype #i + length 200 + ipa ɨ + + FMT(vowel/i#_6) +endphoneme + +phoneme W + vwl starttype #a endtype #u + length 200 + ipa ɯ + + FMT(vowel/8_2) +endphoneme + +phoneme u + vwl starttype #u endtype #u + length 200 + + FMT(vowel/u_bck) +endphoneme + +phoneme e + vwl starttype #e endtype #e + length 200 + + FMT(vowel/e_2) +endphoneme + +phoneme @ + vwl starttype #@ endtype #@ + length 200 + ipa ə + + FMT(vowel/3_2) +endphoneme + +phoneme o + vwl starttype #o endtype #o + length 220 + + FMT(vowel/o) +endphoneme + +phoneme E + vwl starttype #e endtype #e + length 200 + ipa ɛ + + FMT(vowel/ee_2) +endphoneme + +phoneme a + vwl starttype #a endtype #a + length 200 + + FMT(vowel/a) +endphoneme + +phoneme a: + vwl starttype #a endtype #a + length 250 + ipa aː + + FMT(vowel/a) +endphoneme + +phoneme O + vwl starttype #o endtype #o + length 260 + ipa ɔ + + FMT(vwl_it/o_open) +endphoneme + + +//******************************************************************* +// DIPHTHONGS +//******************************************************************* + +phoneme iu + vwl starttype #i endtype #u + length 200 + + FMT(vdiph2/iu) +endphoneme + +phoneme eu + vwl starttype #e endtype #u + length 200 + + FMT(vdiph/eu) +endphoneme + +phoneme Eu + vwl starttype #e endtype #u + length 200 + ipa ɛu + + FMT(vdiph/eeu) +endphoneme + +phoneme au + vwl starttype #a endtype #u + length 200 + + FMT(vdiph/au_2) +endphoneme + +phoneme a:u + vwl starttype #a endtype #u + length 250 + ipa aːu + + FMT(vdiph/au_2) +endphoneme + +phoneme Wi + vwl starttype #i endtype #i + length 200 + ipa ɯi + + FMT(vdiph/ui_3) +endphoneme + +phoneme ui + vwl starttype #u endtype #i + length 200 + + FMT(vdiph/ui) +endphoneme + +phoneme @i + vwl starttype #@ endtype #i + length 200 + ipa əi // ႂ် + + FMT(vdiph/@i) +endphoneme + +phoneme oi + vwl starttype #o endtype #i + length 200 + + FMT(vdiph/ooi) +endphoneme + +phoneme ai + vwl starttype #a endtype #i + length 200 + + FMT(vdiph/ai) +endphoneme + +phoneme a:i + vwl starttype #a endtype #i + length 250 + ipa aːi + + FMT(vdiph/ai) +endphoneme + +phoneme Oi + vwl starttype #o endtype #i + length 200 + ipa ɔi + + FMT(vdiph/ooi_3) +endphoneme + +phoneme aW + vwl starttype #a endtype #u + length 200 + ipa aɯ + + FMT(vdiph/aau_4) +endphoneme + diff --git a/phsource/phonemes b/phsource/phonemes index 81753860..337227d3 100644 --- a/phsource/phonemes +++ b/phsource/phonemes @@ -1990,3 +1990,6 @@ include ph_kyrgyz phonemetable mi base1 include ph_maori + +phonemetable shn base1 +include ph_shan diff --git a/src/libespeak-ng/tr_languages.c b/src/libespeak-ng/tr_languages.c index 2023ab31..5cb55529 100644 --- a/src/libespeak-ng/tr_languages.c +++ b/src/libespeak-ng/tr_languages.c @@ -1512,6 +1512,11 @@ Translator *SelectTranslator(const char *name) tr->langopts.stress_rule = STRESSPOSN_1L; tr->langopts.numbers = NUM_AND_UNITS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_SINGLE_STRESS; break; + case L3('s', 'h', 'n'): + tr->langopts.tone_language = 1; // Tone language, use CalcPitches_Tone() rather than CalcPitches() + tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable + tr->langopts.numbers = 1; + break; case L3('c', 'm', 'n'): // no break, just go to 'zh' case case L3('z', 'h', 'y'): // just go to 'zh' case case L('z','h'): diff --git a/tests/language-phonemes.test b/tests/language-phonemes.test index d76ae54d..877cf531 100755 --- a/tests/language-phonemes.test +++ b/tests/language-phonemes.test @@ -98,3 +98,4 @@ test_lang lt 615e503b996ea5f7b267ebd77b91e77c5b874e18 "ma m;a na n;a pa p;a ta t test_lang lv ebd5378940b27e39ac35cda90e027ee0fa625fde "ma na n^a Na pa ba ta da ca Ja ka ga tsa dza Dz\`a tSa dZa DZ\`a fa va sa za Sa Za xa ha ja la l^a Ra ra _:_ mi my mu mE me mo ma mi: my: mu: mE: me: mo: ma: mai mau mei mie miu mui muo muo\` moi" test_lang mi b6e622de46c33181cdfea351b907f932da9a0a1a "ma na Na pa ta ka fa ha ra wa _:_ ma ma: me me: mi mi: mo mo: mu mu:" test_lang mk 072d0a74acf54bea528e7dde427eb04808d38364 "ma na n^a Na pa ta xa k^a ka ba da Ja ga tsa tSa tS;a dza dZa dZ;a fa sa Sa xa va za Za l^a la ja Ra @-*a ra _:_ ma me mi mo mu mA mE ma: me: mi: mo: mu: moU" +test_lang shn e568aca66c2f58fdaf5dda8a67f4d21f05710234 "ma na Ja Na pa p_ha ba ta t_ha da ka k_ha ga ?a fa sa za Ta ha tS;a Ra ja wa la _:_ mi mI mW mu me m@ mo mE ma ma: mO miu meu mEu mau ma:u mWi mui m@i moi mai ma:i mOi maW _:_ ma1 ma2 ma3 ma4 ma5 ma6" From c6d1f7be3f84f29857ccd048b6f34903910d2371 Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Tue, 29 May 2018 15:01:41 +0300 Subject: [PATCH 13/17] Update data about Shann language --- CHANGELOG.md | 1 + espeak-ng-data/lang/tai/shn | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 403d6cf4..5c162b27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ new languages: * hak (Hakka Chinese) -- Chen Chien-ting * ht (Haitian Creole) -- Valdis Vitolins +* shn (Shan Tay Yai) -- ronaldaug updated languages: diff --git a/espeak-ng-data/lang/tai/shn b/espeak-ng-data/lang/tai/shn index c93f373b..8d30384d 100755 --- a/espeak-ng-data/lang/tai/shn +++ b/espeak-ng-data/lang/tai/shn @@ -1,2 +1,4 @@ name Shan (Tai Yai) language shn +maintainer ronaldaug +status testing From bf3bb39fb0b564b7b75a317585ce848ce4a11418 Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Wed, 30 May 2018 23:53:41 +0300 Subject: [PATCH 14/17] Implementation for feature #489 When .replace rule is used and -X switch is passed in runtime, replaced characters should be shown in trace output. --- src/libespeak-ng/translate.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/libespeak-ng/translate.c b/src/libespeak-ng/translate.c index d24165b1..db2f2836 100644 --- a/src/libespeak-ng/translate.c +++ b/src/libespeak-ng/translate.c @@ -1845,6 +1845,19 @@ static int SubstituteChar(Translator *tr, unsigned int c, unsigned int next_in, new_c = ucd_toupper(new_c); *wordflags |= FLAG_CHAR_REPLACED; + if (option_phonemes & espeakPHONEMES_TRACE) { + char msg[21] = {'R','e','p','l','a','c','e',':',' '}; + char *index = &msg; + index +=9; + index += utf8_out(c, index); + *index++ = ' '; + *index++ = '>'; + *index++ = ' '; + index += utf8_out(new_c, index); + index += utf8_out(c2, index); + *index = 0; + fprintf(f_trans, "%s\n", msg); + } return new_c; } From dc0165821f9c93f585179f766cdb161e046fa949 Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Wed, 30 May 2018 23:58:39 +0300 Subject: [PATCH 15/17] Fix comments about conversion --- src/libespeak-ng/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libespeak-ng/translate.c b/src/libespeak-ng/translate.c index db2f2836..422a89f2 100644 --- a/src/libespeak-ng/translate.c +++ b/src/libespeak-ng/translate.c @@ -382,7 +382,7 @@ int utf8_in(int *c, const char *buf) /* Read a unicode characater from a UTF8 string * Returns the number of UTF8 bytes used. * buf: position of buffer is moved, if character is read - * c: holds integer representation of multibyte character by + * c: holds UTF-16 representation of multibyte character by * skipping UTF-8 header bits of bytes in following way: * 2-byte character "ā": * hex binary @@ -395,7 +395,7 @@ int utf8_in(int *c, const char *buf) * 1010 011001 000101 * | + +--.\ \ | | * V `--. \`. `.| | - * A645 0001001101000101 + * A645 1010011001000101 * 4-byte character "𠜎": * f0a09c8e 11110000101000001001110010001110 * V 000 100000 011100 001110 @@ -407,7 +407,7 @@ int utf8_in(int *c, const char *buf) int utf8_out(unsigned int c, char *buf) { - // write a unicode character into a buffer as utf8 + // write a UTF-16 character into a buffer as UTF-8 // returns the number of bytes written int n_bytes; From 18eeefca19d29905e64efa55b466753ca45abee6 Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Thu, 31 May 2018 00:05:39 +0300 Subject: [PATCH 16/17] Improve comments for character translation --- src/libespeak-ng/translate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libespeak-ng/translate.c b/src/libespeak-ng/translate.c index 422a89f2..cb4ba944 100644 --- a/src/libespeak-ng/translate.c +++ b/src/libespeak-ng/translate.c @@ -1788,6 +1788,7 @@ static int EmbeddedCommand(unsigned int *source_index_out) return 1; } +// handle .replace rule in xx_rules file static int SubstituteChar(Translator *tr, unsigned int c, unsigned int next_in, int *insert, int *wordflags) { int ix; @@ -1927,6 +1928,7 @@ static int TranslateChar(Translator *tr, char *ptr, int prev_in, unsigned int c, } break; } + // handle .replace rule in xx_rules file return SubstituteChar(tr, c, next_in, insert, wordflags); } @@ -2201,8 +2203,8 @@ void TranslateClause(Translator *tr, int *tone_out, char **voice_change) c = ' '; word_flags |= FLAG_COMMA_AFTER; } - - c = TranslateChar(tr, &source[source_index], prev_in, c, next_in, &char_inserted, &word_flags); // optional language specific function + // language specific character translations + c = TranslateChar(tr, &source[source_index], prev_in, c, next_in, &char_inserted, &word_flags); if (c == 8) continue; // ignore this character From c79ed73ad749e0c2ccf9b8aa00cab79e1b8c30eb Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Thu, 31 May 2018 00:25:06 +0300 Subject: [PATCH 17/17] docs: update explanation of .replace rule --- docs/dictionary.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/dictionary.md b/docs/dictionary.md index 900763fd..2ac9a731 100644 --- a/docs/dictionary.md +++ b/docs/dictionary.md @@ -509,11 +509,11 @@ each language. The number fragments are given in the `*_list` file. ## Character Substitution Character substitutions can be specified by using a `.replace` section -at the start of the `*_rules` file. Each line specified either one or -two alphabetic characters to be replaced by another one or two -alphabetic characters. This substitution is done to a word before word is searched +at the start of the `*_rules` file. In each line one character can be +replaced by one or two characters. (Source and target of replacement can consume +up to four bytes.) This substitution is done to a word _before_ word is searched in `*_list` or `*_listx` file and translated using the spelling-to-phoneme rules. -Only the lower-case version of the characters needs to be specified. e.g. +Only the lower-case version of the characters needs to be specified. e.g.: .replace ô   ő   // (Hungarian) allow the use of o-circumflex instead of o-double-accute