[1.47.11c]

Change API function: espeak_TextToPhonemes().
Fix bug: number following a non-ascii character could cause crash.


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@361 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2013-05-31 19:18:18 +00:00
parent 500d2c9525
commit b5035d73f8
19 changed files with 215 additions and 164 deletions
+4 -4
View File
@@ -148,7 +148,7 @@ p Q r R s s; t T
ts v x z ts v x z
Dictionary en_dict 2013-05-29 Dictionary en_dict 2013-05-31
0 0# 3 3: @ @- @2 @5 0 0# 3 3: @ @- @2 @5
@L a a# A: A@ aa aI aI3 @L a a# A: A@ aa aI aI3
@@ -463,7 +463,7 @@ N n^ p r R s S t
tS ts tS; v x z Z tS ts tS; v x z Z
Dictionary ml_dict 2013-05-19 Dictionary ml_dict 2013-05-30
@ a a# a: aI aU e E @ a a# a: aI aU e E
e: i I i: o o: r- u e: i I i: o o: r- u
@@ -575,7 +575,7 @@ S s; S; t t; tS ts tS;
ts; v w x z Z Z; ts; v w x z Z Z;
Dictionary pt_dict 2013-05-29 Dictionary pt_dict 2013-05-31
& &/ &U~ &~ @ @- a A & &/ &U~ &~ @ @- a A
aI aU e E eI EI eU EU aI aU e E eI EI eU EU
@@ -643,7 +643,7 @@ s S t t; tS ts v w
x z Z x z Z
Dictionary sl_dict 2013-05-22 Dictionary sl_dict 2013-05-31
@ @- a e E E# i o @ @- a e E E# i o
O o+ u y O o+ u y
+24 -17
View File
@@ -682,7 +682,7 @@ accouchement a#ku:SmO~
accusation akju:z'eIS@n accusation akju:z'eIS@n
acer eIs3 acer eIs3
acetylene a#sEt@li:n acetylene a#sEt@li:n
accurate akjUr@t accurate $alt2
accursed a#k3:sI#d accursed a#k3:sI#d
?5 accursed a#kVRsI#d ?5 accursed a#kVRsI#d
achille a#kIli: achille a#kIli:
@@ -837,6 +837,7 @@ apparatus ap@r'eIt@s
apprentice a#prEnt2Is apprentice a#prEnt2Is
approximate a#pr0ksIm@t $only approximate a#pr0ksIm@t $only
approximate a#pr0ksImeIt $verb approximate a#pr0ksImeIt $verb
approximately a#pr0ksIm@tli
aqueduct akwI#dVkt aqueduct akwI#dVkt
arab ar@b arab ar@b
arabic $1 arabic $1
@@ -1129,6 +1130,7 @@ chimera kaIm'i@r@
chimpanzee $3 chimpanzee $3
chipotle tSI2poUtleI chipotle tSI2poUtleI
chisel tSIz@L chisel tSIz@L
chivalrous SIv@Lr@s
chloroplast $1 chloroplast $1
chocolate tS0kl@t chocolate tS0kl@t
cholera k0l@r@ cholera k0l@r@
@@ -1185,7 +1187,6 @@ coliseum k0l@s'i:@m
collage k0l'A:Z collage k0l'A:Z
collarbone k0l3boUn collarbone k0l3boUn
college k0lI2dZ college k0lI2dZ
collegiate k@li:dZI@t
colloquial k@loUkwI@L colloquial k@loUkwI@L
colon koUl@n colon koUl@n
color kVl3 color kVl3
@@ -1276,7 +1277,7 @@ coronet k0r@nEt
corolla k@roUl@ corolla k@roUl@
corollary $2 corollary $2
corporal kO@pr@L corporal kO@pr@L
corporate kO@p@r@t corporate $alt2
corps kO@ $only corps kO@ $only
corral k@r'al corral k@r'al
corsage kO@s'A:Z corsage kO@s'A:Z
@@ -1348,8 +1349,8 @@ deity deI@ti
?3 deity di:@t2i ?3 deity di:@t2i
deja deIZA: $only deja deIZA: $only
deli dElI deli dElI
deliberate dI2lIb@r@t deliberate $alt2
delicate dElI2k@t delicate $alt2
delimit dI2lImIt // delimited delimit dI2lImIt // delimited
delivery $alt2 delivery $alt2
demolish dI2m0lIS demolish dI2m0lIS
@@ -1587,6 +1588,7 @@ fetus fi:t@s
fi f,aI // as in "hi-fi" fi f,aI // as in "hi-fi"
fiasco fi:'askoU fiasco fi:'askoU
fiat fi:@t fiat fi:@t
ficus fIk@s
fiery faI3rI fiery faI3rI
?3 fillet fI2leI ?3 fillet fI2leI
finagle fI#neIg@L finagle fI#neIg@L
@@ -1625,7 +1627,7 @@ foyer fOIeI
freelance fri:laans freelance fri:laans
freon fri:0n freon fri:0n
fricassee frIka#seI fricassee frIka#seI
frigate frIg@t frigate $alt2
fringer frIndZ3 // infringer fringer frIndZ3 // infringer
fringing frIndZIN fringing frIndZIN
frisson fri:s'O~ frisson fri:s'O~
@@ -1691,7 +1693,7 @@ gossamer g0s@m3
goto goUtu: goto goUtu:
gourmand gU@mA:nd gourmand gU@mA:nd
gourmet gU@meI gourmet gU@meI
graduate gradju:@t graduate $alt2
graduate gradju:eIt $verb graduate gradju:eIt $verb
graffiti $alt3 graffiti $alt3
grandson gr'andsVn grandson gr'andsVn
@@ -1708,7 +1710,7 @@ guinea gIni
gurus gu:ru:z gurus gu:ru:z
habitual $alt3 habitual $alt3
hacienda hasI'End@ hacienda hA:sI'End@
haggis hagIs haggis hagIs
haha hA:h'A: haha hA:h'A:
halation $alt3 // in- halation $alt3 // in-
@@ -1811,20 +1813,20 @@ impi $1
impinging Imp'IndZIN impinging Imp'IndZIN
implacable Impl'ak@b@L implacable Impl'ak@b@L
imprecise ImprIs'aIs imprecise ImprIs'aIs
inanimate In'anIm@t inanimate $alt2
inappropriate ,Ina#proUpri@t inappropriate Ina#pr'oUpri@t
incense Ins'Ens $verb incense Ins'Ens $verb
incoming InkVmIN incoming InkVmIN
increase Inkr'i:s $verb increase Inkr'i:s $verb
indefine $3 indefine $3
indeterminate IndI2t'3:mI2n@t indeterminate $alt2
indicative $2 indicative $2
indices IndI2si:z indices IndI2si:z
indict Ind'aIt indict Ind'aIt
indie Indi indie Indi
indirect $3 indirect $3
?3 indirect Ind3r'Ekt ?3 indirect Ind3r'Ekt
indiscriminate IndI2skr'ImI2n@t indiscriminate $alt2
indo IndoU indo IndoU
indoor $1 $only indoor $1 $only
industry IndVstrI industry IndVstrI
@@ -1882,7 +1884,6 @@ iris aIrIs
iron aI3n iron aI3n
irony aIr@nI irony aIr@nI
isosceles aIs'0s@li:z isosceles aIs'0s@li:z
itinerary aIt'In@r@rI
ja jA: ja jA:
jagged dZagI#d jagged dZagI#d
@@ -1928,7 +1929,9 @@ labored leIb@d
laborer leIb@r3 laborer leIb@r3
laborious $alt3 laborious $alt3
labyrinth lab3rInT labyrinth lab3rInT
lascivious $alt3
lager lA:g3 lager lA:g3
lagoon $alt3
laity leI@ti laity leI@ti
landowner l'and,oUn3 landowner l'and,oUn3
lapel $alt3 lapel $alt3
@@ -2077,7 +2080,7 @@ mercedes m3:s'eIdi:z
//mercenary m3:s@n@rI //mercenary m3:s@n@rI
merest mi@r@st merest mi@r@st
meringue m@raN meringue m@raN
merlot me@l'oU merlot m3:l'oU
mesa meIs@ mesa meIs@
meson mi:z0n meson mi:z0n
metabolic mEt@b'0lIk metabolic mEt@b'0lIk
@@ -2214,7 +2217,7 @@ obelisk 0b@lI2sk
obesity oUb'i:s@ti obesity oUb'i:s@ti
obey oUb'eI obey oUb'eI
obituary 0b'ItSU@i obituary 0b'ItSU@i
?3 obituary oUb'ItSUe@i ?3 obituary oUb'ItSu:e@i
object $1 $onlys object $1 $onlys
object $verb object $verb
obsolete 0bs@li:t obsolete 0bs@li:t
@@ -2251,6 +2254,7 @@ oregano 0rIg'A:noU
orion 0r'aI@n orion 0r'aI@n
ornate $2 ornate $2
orphan O@f@n // orphaned orphan O@f@n // orphaned
ottoman 0t@m@n
outage aUtI2dZ outage aUtI2dZ
outback $1 outback $1
outcome $1 outcome $1
@@ -2796,6 +2800,7 @@ spinal spaIn@L
spoonfed spu:nfEd spoonfed spu:nfEd
squirrel skwIr@L squirrel skwIr@L
staccato $alt3 staccato $alt3
stasis steIsI#s
standby standbaI standby standbaI
stagnate $2 stagnate $2
?3 stalagmite $alt3 ?3 stalagmite $alt3
@@ -2894,7 +2899,7 @@ testes tEsti:z
telephon tElI2foUn // for telephoning telephon tElI2foUn // for telephoning
temperature tEmprI2tS3 temperature tEmprI2tS3
?!3 temporary tEmpr@rI ?!3 temporary tEmpr@rI
?3 template tEmpl@t ?3 template $alt2
tetanus tEt@n@s tetanus tEt@n@s
therefore $1 therefore $1
thereof De@r'0v thereof De@r'0v
@@ -3209,6 +3214,7 @@ Aires aIrIz
Alamo al@moU Alamo al@moU
Albuquerque alb@k3:ki Albuquerque alb@k3:ki
Algiers $2 Algiers $2
Altura O:lt'U@r@
Amman a#m'A:n Amman a#m'A:n
Andes andi:z Andes andi:z
Angeles andZ@li:s Angeles andZ@li:s
@@ -3394,6 +3400,7 @@ Montana m0nt'an@
Monte m0nt2i Monte m0nt2i
Munich mju:nIk Munich mju:nIk
Myanmar mjA:nmA@ Myanmar mjA:nmA@
Niagara naI'agr@
Nairobi naIr'oUbi Nairobi naIr'oUbi
Naples neIp@Lz Naples neIp@Lz
Nauru naUru: Nauru naUru:
@@ -4016,7 +4023,7 @@ unto ,VntU
upon @p0n $u2 upon @p0n $u2
from fr0m $u from fr0m $u
?3 from frVm $u ?3 from frVm $u
(from the) fr,VmD@ (from the) %frVmD@2
(from where) %frVm||w'e@ $pause (from where) %frVm||w'e@ $pause
(from which) %frVm||w'ItS $pause (from which) %frVm||w'ItS $pause
up ,Vp $strend2 up ,Vp $strend2
+9 -3
View File
@@ -1117,7 +1117,6 @@
_s) ata (n eIt@ _s) ata (n eIt@
_g) ator eIt3 _g) ator eIt3
&) ate (_$w_alt2 @t &) ate (_$w_alt2 @t
&) ately (_ @tli
der) ated (_ eItI#d der) ated (_ eItI#d
pal) ate (_ @t pal) ate (_ @t
consul) ate (_ @t consul) ate (_ @t
@@ -1214,6 +1213,7 @@
g) au (s aU g) au (s aU
?!3 s) au (s 0 ?!3 s) au (s 0
?!3 au (str 0 ?!3 au (str 0
au (sch aU
au (_ aU au (_ aU
_) auch %O:x _) auch %O:x
aud (_ 'O:d aud (_ 'O:d
@@ -1641,10 +1641,11 @@
_) co (nw k0 _) co (nw k0
_) copy k0pI _) copy k0pI
_) copoly k'oUp,0lI _) copoly k'oUp,0lI
?!3 _) co (rL03 k0#
coro (ll k0#r0 coro (ll k0#r0
co (rrect k@ co (rrect k@
correspo k,0rIsp'0 correspo k,0rIsp'0
_) co (rri k0 _) co (rr k0
co (rro k@ co (rro k@
co (rrup k@ co (rrup k@
_) co (sm k0 _) co (sm k0
@@ -3610,6 +3611,7 @@
l) ith (er ID l) ith (er ID
_t) ith aID _t) ith aID
it (i_ 'i:t it (i_ 'i:t
_) it (iner %aIt
itius (_ 'IS@s itius (_ 'IS@s
itis (_ 'aItIs itis (_ 'aItIs
&) it (ive_ =I2t &) it (ive_ =I2t
@@ -3883,6 +3885,7 @@
&) name (_S4 neIm &) name (_S4 neIm
_) nano (P4 n,anoU _) nano (P4 n,anoU
nause nO:sI nause nO:sI
_) navig navIg
necessit n@sEsIt necessit n@sEsIt
&) ness (_S4im n@s &) ness (_S4im n@s
?8 &) ness (_S4im nEs ?8 &) ness (_S4im nEs
@@ -4983,7 +4986,7 @@
rEr (_ r3 rEr (_ r3
C) rh r C) rh r
rheu ru: rheu ru:
rhi (n raI rhi (n# raI
rhi (z raI rhi (z raI
_) rho (d roU _) rho (d roU
_) rhodo (@ roUd@ _) rhodo (@ roUd@
@@ -5385,6 +5388,7 @@
th (ill th th (ill th
ee) thing DI2N ee) thing DI2N
the (_ D the (_ D
&) th (L03_ =T
ou) thed (_ Dd ou) thed (_ Dd
th (en_ D th (en_ D
g) th (en_ T g) th (en_ T
@@ -5872,6 +5876,8 @@
%B) y (_S1d I %B) y (_S1d I
_C) y (Ce aI _C) y (Ce aI
C) y (i I C) y (i I
&C) y (an_ =I
&C) y (en_ =I
y (iC_ j y (iC_ j
sf) y (_ aI sf) y (_ aI
Cf) y (_ %I Cf) y (_ %I
+4
View File
@@ -126,6 +126,8 @@ _9X t'on.n.u:t.t.i
_0C0 n'u:r:y _0C0 n'u:r:y
_0C nu:t.t.i _0C nu:t.t.i
_1C0 orynu:ry
_1C orynu:t.t.i
_2C0 iRynn'u:ry _2C0 iRynn'u:ry
_2C irunnu:t.t.i _2C irunnu:t.t.i
_3C0 munn'u:ry _3C0 munn'u:ry
@@ -164,6 +166,8 @@ _1Xf p'at
_12f p'antran.t _12f p'antran.t
_13f p'atimu:v _13f p'atimu:v
_14f p'atina:l _14f p'atina:l
_15f patin'ai:j
_18f patin'enn
_19f p'attomp'atin _19f p'attomp'atin
_20f 'iruvatin _20f 'iruvatin
_2Xf 'iruvatt _2Xf 'iruvatt
+5 -2
View File
@@ -340,7 +340,7 @@ elas $u+ $verbf
me $u $verbf // reflexive me $u $verbf // reflexive
te $u $verbf te $u $verbf
nos $u $nounf nos $u $nounf
vos vus $u vos $u
la $u la $u
lo lU $u lo lU $u
las $u las $u
@@ -1060,6 +1060,7 @@ proveta $alt2
quarteto $alt2 quarteto $alt2
queda $alt queda $alt
quede $alt2 quede $alt2
quimera $alt
quitinete $alt quitinete $alt
quinteto $alt2 quinteto $alt2
ramalhete $alt2 ramalhete $alt2
@@ -1069,7 +1070,8 @@ reconstroem $alt
recordo $alt recordo $alt
recorto $alt recorto $alt
rede $alt2 rede $alt2
reembolso $alt $verb reembolso $alt2
reembolso $alt $verb
reforço $alt $verb reforço $alt $verb
reforços $alt reforços $alt
refresco $alt $verb refresco $alt $verb
@@ -1111,6 +1113,7 @@ sinopse $alt
soco $alt2 soco $alt2
soco $alt $verb soco $alt $verb
sogra $alt sogra $alt
sopa $alt2
sopro $alt2 $noun sopro $alt2 $noun
soro $alt2 soro $alt2
sorvete $alt2 sorvete $alt2
+14 -10
View File
@@ -210,7 +210,6 @@
ib) e (rL04_ E ib) e (rL04_ E
d) e (rL04_ E d) e (rL04_ E
ed) e (rL04_ e ed) e (rL04_ e
m) e (rL04_ E
iv) e (rL04_ E iv) e (rL04_ E
pod) e (rA_ e pod) e (rA_ e
@@ -343,13 +342,14 @@
êCC) e (C@ e êCC) e (C@ e
ôC) e (C@ e ôC) e (C@ e
áC) e (C@ e áC) e (C@ e
áCC) e (C@ e áCC) e (CA_ e
éCC) e (CA_ e
éCCC) e (C@ e éCCC) e (C@ e
íC) el (_ eU íC) el (_ eU
íC) e (C@ e íC) e (C@ e
íCC) e (C@ e íCC) e (C@ e
óC) e (C@ e óC) e (C@ e
óCC) e (C@ e óCC) e (CA_ e
úC) e (C@ e úC) e (C@ e
úC) el (_ eU úC) el (_ eU
ection (_ 'EkS&~N ection (_ 'EkS&~N
@@ -427,6 +427,7 @@ _enver) e (dL03_ E
ad) e (quL04_ E ad) e (quL04_ E
_dig) e (rL02_ E _dig) e (rL02_ E
_ing) e (rL02_ E _ing) e (rL02_ E
_m) e (rL03_ E
_sev) e (rL03_ E _sev) e (rL03_ E
_reit) e (rL03_ E _reit) e (rL03_ E
_sinc) e (rL03_ E _sinc) e (rL03_ E
@@ -438,6 +439,8 @@ _enver) e (dL03_ E
gen) e (rL04_ E // de- re- gen) e (rL04_ E // de- re-
_alt) e (rL04_ E _alt) e (rL04_ E
_enc) e (rL04_ E _enc) e (rL04_ E
_esm) e (rL04_ E
_esm) e (rL04_ E
_imp) e (rL04_ E _imp) e (rL04_ E
_min) e (rL04_ E _min) e (rL04_ E
_sug) e (rL04_ E _sug) e (rL04_ E
@@ -448,9 +451,11 @@ _enver) e (dL03_ E
eson) e (rL04_ E eson) e (rL04_ E
_apod) e (rL04_ E _apod) e (rL04_ E
_coop) e (rL04_ E _coop) e (rL04_ E
_enum) e (rL04_ E
_exub) e (rL04_ E _exub) e (rL04_ E
_temp) e (rL04_ E _temp) e (rL04_ E
_adult) e (rL04_ E _adult) e (rL04_ E
_aglom) e (rL04_ E
_dilac) e (rL04_ E _dilac) e (rL04_ E
_encarc) e (rL04_ E _encarc) e (rL04_ E
_incin) e (rL04_ E _incin) e (rL04_ E
@@ -512,7 +517,6 @@ _entorp) e (çL03_ e
//endsort //endsort
.group é .group é
é ''E é ''E
éi ''EI éi ''EI
@@ -727,6 +731,9 @@ _entorp) e (çL03_ e
?2 _) os (_ Us ?2 _) os (_ Us
?2 _) os (_A Uz ?2 _) os (_A Uz
?2 _) os (_G Uz ?2 _) os (_G Uz
?2 _v) os (_ us
?2 _v) os (_A uz
?2 _v) os (_G uz
ou ow ou ow
oi oI oi oI
oi ($w_alt OI oi ($w_alt OI
@@ -825,6 +832,7 @@ _entorp) e (çL03_ e
v) o (re_ o v) o (re_ o
b) o (rL04_ O b) o (rL04_ O
o (p_ O o (p_ O
C) o (pL04_ O
?1 _) o (C O // eg: olá, orla, opção, etc... ?1 _) o (C O // eg: olá, orla, opção, etc...
?1 _C) o (CACAC u // Documento, documentação, localizar, etc. ?1 _C) o (CACAC u // Documento, documentação, localizar, etc.
?1 f) o (rmat u // formatar, formato. ?1 f) o (rmat u // formatar, formato.
@@ -862,6 +870,7 @@ _pormen) o (L05_ O
_engl) o (bL04_ O _engl) o (bL04_ O
_sal) o (brL03_ o _sal) o (brL03_ o
_) o (cL03_ o _) o (cL03_ o
_barr) o (cL03_ o
_m) o (fL01_ O _m) o (fL01_ O
_m) o (fL02_ O _m) o (fL02_ O
_af) o (fL04_ O _af) o (fL04_ O
@@ -874,13 +883,8 @@ _pormen) o (L05_ O
_emp) o (lgL04_ O _emp) o (lgL04_ O
_) o (lhL04_ O _) o (lhL04_ O
m) o (lhL04_ O m) o (lhL04_ O
emb) o (lsL02_ O emb) o (lsL04_ O
_env) o (ltL03_ o _env) o (ltL03_ o
ent) o (pL02_ O
_c) o (pL03_ O
_t) o (pL04_ O
_ens) o (pL04_ O
_gal) o (pL04_ O
_s) o (prL04_ O _s) o (prL04_ O
_al) o (prL04_ O _al) o (prL04_ O
_ass) o (prL04_ O _ass) o (prL04_ O
+9
View File
@@ -206,6 +206,15 @@ bom bo+m $u // example of unstressed [o]
skozi sko+zi $u+ skozi sko+zi $u+
za $u+ za $u+
le lE
// conjunctions
če tSE $u
ker kER
ter tER $u+
vseeno us'E:Eno
// verb: to be // verb: to be
sem s@m $u sem s@m $u
+7 -2
View File
@@ -38,8 +38,12 @@
.group e .group e
e e: e e:
e (X$w_alt3+ 'E e (X$w_alt3+ 'E
ee i:
ee i:
_n) ee E:E
_r) ee E:E
_pr) ee E:E
e (X$w_alt4 @ e (X$w_alt4 @
@) e (n_ E# @) e (n_ E#
@C) e (r_ E# @C) e (r_ E#
@@ -119,7 +123,8 @@
o (č_ 'o: o (č_ 'o:
o (j_ 'o: o (j_ 'o:
o (l_ 'o: o (l_ 'o:
oo u: o (oč o:
.group p .group p
p p p p
+3 -1
View File
@@ -119,7 +119,9 @@ phoneme k
Vowelout f1=0 f2=2300 200 300 f3=-200 80 rms=20 Vowelout f1=0 f2=2300 200 300 f3=-200 80 rms=20
ENDIF ENDIF
IF nextPh(isPause2) AND prevPhW(isVowel) THEN IF thisPh(isWordEnd) THEN
WAV(ustop/k)
ELIF nextPh(isPause2) THEN
WAV(ustop/k_) WAV(ustop/k_)
ELIF nextPh(r) OR nextPh(R) OR nextPh(R2) THEN ELIF nextPh(r) OR nextPh(R) OR nextPh(R2) THEN
WAV(ustop/kr) WAV(ustop/kr)
+99 -97
View File
@@ -526,6 +526,10 @@ unsigned short ipa1[96] = {
0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x303,0x7f 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x303,0x7f
}; };
#define N_PHON_OUT 500
static char *phon_out_buf = NULL;
static int phon_out_size = 0;
char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int use_ipa, int *flags) char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int use_ipa, int *flags)
{//=================================================================================================== {//===================================================================================================
@@ -629,8 +633,8 @@ char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int
void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int phoneme_mode) const char *GetTranslatedPhonemeString(int phoneme_mode)
{//=============================================================================== {//=======================================================
/* Called after a clause has been translated into phonemes, in order /* Called after a clause has been translated into phonemes, in order
to display the clause in phoneme mnemonic form. to display the clause in phoneme mnemonic form.
@@ -640,7 +644,6 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int phoneme_mode
int ix; int ix;
unsigned int len; unsigned int len;
unsigned int max_len;
int phon_out_ix=0; int phon_out_ix=0;
int stress; int stress;
int c; int c;
@@ -668,108 +671,107 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int phoneme_mode
use_tie = 0; use_tie = 0;
} }
if(phon_out != NULL) for(ix=1; ix<(n_phoneme_list-2); ix++)
{ {
for(ix=1; ix<(n_phoneme_list-2); ix++) buf = phon_buf;
plist = &phoneme_list[ix];
WritePhMnemonic(phon_buf2, plist->ph, plist, use_ipa, &flags);
if(plist->newword)
*buf++ = ' ';
else
{ {
buf = phon_buf; if((separate_phonemes != 0) && (ix > 1))
plist = &phoneme_list[ix];
WritePhMnemonic(phon_buf2, plist->ph, plist, use_ipa, &flags);
if(plist->newword)
*buf++ = ' ';
else
{ {
if((separate_phonemes != 0) && (ix > 1)) utf8_in(&c, phon_buf2);
if((c < 0x2b0) || (c > 0x36f)) // not if the phoneme starts with a superscript letter
{ {
utf8_in(&c, phon_buf2); *buf++ = separate_phonemes;
if((c < 0x2b0) || (c > 0x36f)) // not if the phoneme starts with a superscript letter
{
*buf++ = separate_phonemes;
}
} }
} }
if(plist->synthflags & SFLAG_SYLLABLE)
{
if((stress = plist->stresslevel) > 1)
{
c = 0;
if(stress > 5) stress = 5;
if(use_ipa)
{
c = 0x2cc; // ipa, secondary stress
if(stress > 3)
c = 0x02c8; // ipa, primary stress
}
else
{
c = stress_chars[stress];
}
if(c != 0)
{
buf += utf8_out(c, buf);
// if(separate_phonemes)
// *buf++ = separate_phonemes;
}
}
}
flags = 0;
count = 0;
for(p=phon_buf2; *p != 0;)
{
p += utf8_in(&c, p);
if(use_tie > 0)
{
// look for non-inital alphabetic character, but not diacritic, superscript etc.
if((count>0) && !(flags & (1 << (count-1))) && ((c < 0x2b0) || (c > 0x36f)) && iswalpha2(c))
{
buf += utf8_out(char_tie[use_tie-1], buf);
}
}
buf += utf8_out(c, buf);
count++;
}
if(plist->ph->code != phonSWITCH)
{
if(plist->synthflags & SFLAG_LENGTHEN)
{
buf = WritePhMnemonic(buf, phoneme_tab[phonLENGTHEN], NULL, use_ipa, NULL);
}
if((plist->synthflags & SFLAG_SYLLABLE) && (plist->type != phVOWEL))
{
// syllablic consonant
buf = WritePhMnemonic(buf, phoneme_tab[phonSYLLABIC], NULL, use_ipa, NULL);
}
if(plist->tone_ph > 0)
{
buf = WritePhMnemonic(buf, phoneme_tab[plist->tone_ph], NULL, use_ipa, NULL);
}
}
len = buf - phon_buf;
max_len = (n_phon_out - phon_out_ix - 5); // allow for " ..." and zero byte terminator
if(len > max_len)
{
strcpy(&phon_buf[max_len], " ...");
len = max_len + 4;
}
phon_buf[len] = 0;
strcpy(&phon_out[phon_out_ix], phon_buf);
phon_out_ix += len;
if(len > max_len)
{
break;
}
} }
phon_out[phon_out_ix] = 0;
if(plist->synthflags & SFLAG_SYLLABLE)
{
if((stress = plist->stresslevel) > 1)
{
c = 0;
if(stress > 5) stress = 5;
if(use_ipa)
{
c = 0x2cc; // ipa, secondary stress
if(stress > 3)
c = 0x02c8; // ipa, primary stress
}
else
{
c = stress_chars[stress];
}
if(c != 0)
{
buf += utf8_out(c, buf);
// if(separate_phonemes)
// *buf++ = separate_phonemes;
}
}
}
flags = 0;
count = 0;
for(p=phon_buf2; *p != 0;)
{
p += utf8_in(&c, p);
if(use_tie > 0)
{
// look for non-inital alphabetic character, but not diacritic, superscript etc.
if((count>0) && !(flags & (1 << (count-1))) && ((c < 0x2b0) || (c > 0x36f)) && iswalpha2(c))
{
buf += utf8_out(char_tie[use_tie-1], buf);
}
}
buf += utf8_out(c, buf);
count++;
}
if(plist->ph->code != phonSWITCH)
{
if(plist->synthflags & SFLAG_LENGTHEN)
{
buf = WritePhMnemonic(buf, phoneme_tab[phonLENGTHEN], NULL, use_ipa, NULL);
}
if((plist->synthflags & SFLAG_SYLLABLE) && (plist->type != phVOWEL))
{
// syllablic consonant
buf = WritePhMnemonic(buf, phoneme_tab[phonSYLLABIC], NULL, use_ipa, NULL);
}
if(plist->tone_ph > 0)
{
buf = WritePhMnemonic(buf, phoneme_tab[plist->tone_ph], NULL, use_ipa, NULL);
}
}
len = buf - phon_buf;
if((phon_out_ix + len) >= phon_out_size)
{
// enlarge the phoneme buffer
phon_out_size = phon_out_ix + len + N_PHON_OUT;
if((phon_out_buf = (char *)realloc(phon_out_buf, phon_out_size)) == NULL)
{
phon_out_size = 0;
return("");
}
}
phon_buf[len] = 0;
strcpy(&phon_out_buf[phon_out_ix], phon_buf);
phon_out_ix += len;
} }
phon_out_buf[phon_out_ix] = 0;
return(phon_out_buf);
} // end of GetTranslatedPhonemeString } // end of GetTranslatedPhonemeString
+15 -11
View File
@@ -1831,17 +1831,24 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
} }
else else
{ {
if((!found) && (tensunits == 0)) if((hundreds==1) && (tr->langopts.numbers2 & NUM2_OMIT_1_HUNDRED_ONLY) && ((control & 1)==0))
{ {
// is there a special pronunciation for exactly n00 ? // only look for special 100 if there are previous thousands
sprintf(string,"_%dC0",hundreds);
found = Lookup(tr, string, ph_digits);
} }
else
if(!found)
{ {
sprintf(string,"_%dC",hundreds); if((!found) && (tensunits == 0))
found = Lookup(tr, string, ph_digits); // is there a specific pronunciation for n-hundred ? {
// is there a special pronunciation for exactly n00 ?
sprintf(string,"_%dC0",hundreds);
found = Lookup(tr, string, ph_digits);
}
if(!found)
{
sprintf(string,"_%dC",hundreds);
found = Lookup(tr, string, ph_digits); // is there a specific pronunciation for n-hundred ?
}
} }
if(found) if(found)
@@ -1855,9 +1862,6 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
{ {
if((tr->langopts.numbers & NUM_OMIT_1_HUNDRED) != 0) if((tr->langopts.numbers & NUM_OMIT_1_HUNDRED) != 0)
say_one_hundred = 0; say_one_hundred = 0;
if(((tr->langopts.numbers2 & NUM2_OMIT_1_HUNDRED_ONLY) != 0) && ((control & 1)==0))
say_one_hundred = 0;
} }
if(say_one_hundred != 0) if(say_one_hundred != 0)
+5 -4
View File
@@ -1164,14 +1164,15 @@ ESPEAK_API void espeak_SetPhonemeTrace(int value, FILE *stream)
} // end of espeak_SetPhonemes } // end of espeak_SetPhonemes
ESPEAK_API void espeak_TextToPhonemes(const void *text, char *buffer, int size, int textmode, int phonememode) ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode, int phonememode)
{//============================================================================================================== {//=================================================================================================
/* phoneme_mode bits 0-3: 0=only phoneme names, 1=ties, 2=ZWJ, 3=underscore separator /* phoneme_mode bits 0-3: 0=only phoneme names, 1=ties, 2=ZWJ, 3=underscore separator
bits 4-7: 0=eSpeak phoneme names, 1=IPA bits 4-7: 0=eSpeak phoneme names, 1=IPA
*/ */
option_multibyte = textmode & 7; option_multibyte = textmode & 7;
TranslateClause(translator, NULL, text, NULL, NULL); *textptr = TranslateClause(translator, NULL, *textptr, NULL, NULL);
GetTranslatedPhonemeString(buffer, size, phonememode); return(GetTranslatedPhonemeString(phonememode));
} }
+4 -1
View File
@@ -34,7 +34,7 @@
#define ESPEAK_API #define ESPEAK_API
#endif #endif
#define ESPEAK_API_REVISION 7 #define ESPEAK_API_REVISION 9
/* /*
Revision 2 Revision 2
Added parameter "options" to eSpeakInitialize() Added parameter "options" to eSpeakInitialize()
@@ -58,6 +58,9 @@ Revision 7 24.Dec.2011
Revision 8 26.Apr.2013 Revision 8 26.Apr.2013
Added function espeak_TextToPhonemes(). Added function espeak_TextToPhonemes().
Revision 9 30.May.2013
Changed function espeak_TextToPhonemes().
*/ */
/********************/ /********************/
/* Initialization */ /* Initialization */
+1 -1
View File
@@ -35,7 +35,7 @@
#include "translate.h" #include "translate.h"
#include "wave.h" #include "wave.h"
const char *version_string = "1.47.11b 28.May.13"; const char *version_string = "1.47.11c 31.May.13";
const int version_phdata = 0x014709; const int version_phdata = 0x014709;
int option_device_number = -1; int option_device_number = -1;
+4 -3
View File
@@ -1865,6 +1865,7 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control)
char *voice_change; char *voice_change;
static FILE *f_text=NULL; static FILE *f_text=NULL;
static const void *p_text=NULL; static const void *p_text=NULL;
const char *phon_out;
if(control == 4) if(control == 4)
{ {
@@ -1957,14 +1958,14 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control)
if(option_phonemes >= 3) if(option_phonemes >= 3)
phoneme_mode = 0x10 + option_phonemes-3; // 0x10=ipa, 0x11=ipa with tie, 0x12=ipa with ZWJ, 0x13=ipa with separators phoneme_mode = 0x10 + option_phonemes-3; // 0x10=ipa, 0x11=ipa with tie, 0x12=ipa with ZWJ, 0x13=ipa with separators
GetTranslatedPhonemeString(translator->phon_out, sizeof(translator->phon_out), phoneme_mode); phon_out = GetTranslatedPhonemeString(phoneme_mode);
if(option_phonemes > 0) if(option_phonemes > 0)
{ {
fprintf(f_trans,"%s\n",translator->phon_out); fprintf(f_trans,"%s\n",phon_out);
} }
if(phoneme_callback != NULL) if(phoneme_callback != NULL)
{ {
phoneme_callback(translator->phon_out); phoneme_callback(phon_out);
} }
} }
+1 -1
View File
@@ -1484,7 +1484,7 @@ SetLengthMods(tr,3); // all equal
if(name2 == L('m','l')) if(name2 == L('m','l'))
{ {
tr->letter_bits_offset = OFFSET_MALAYALAM; tr->letter_bits_offset = OFFSET_MALAYALAM;
tr->langopts.numbers = NUM_OMIT_1_THOUSAND; tr->langopts.numbers = NUM_OMIT_1_THOUSAND | NUM_OMIT_1_HUNDRED;
tr->langopts.numbers2 = NUM2_OMIT_1_HUNDRED_ONLY; tr->langopts.numbers2 = NUM2_OMIT_1_HUNDRED_ONLY;
} }
else else
+2 -2
View File
@@ -3041,7 +3041,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
c = ' '; c = ' ';
pre_pause_add = 4; pre_pause_add = 4;
} }
else if((prev_out == ' ') && IsAlpha(sbuf[ix-2]) && !IsAlpha(prev_in)) else if((prev_out == ' ') && IsAlpha(prev_out2) && !IsAlpha(prev_in))
{ {
// insert extra space between a word + space + hyphen, to distinguish 'a -2' from 'a-2' // insert extra space between a word + space + hyphen, to distinguish 'a -2' from 'a-2'
sbuf[ix++] = ' '; sbuf[ix++] = ' ';
@@ -3139,7 +3139,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
decimal_sep_count = 1; decimal_sep_count = 1;
} }
} }
else if((prev_out == ' ') && IsAlpha(sbuf[ix-2]) && !IsAlpha(prev_in)) else if((prev_out == ' ') && IsAlpha(prev_out2) && !IsAlpha(prev_in))
{ {
// insert extra space between a word and a number, to distinguish 'a 2' from 'a2' // insert extra space between a word and a number, to distinguish 'a 2' from 'a2'
sbuf[ix++] = ' '; sbuf[ix++] = ' ';
+1 -2
View File
@@ -581,7 +581,6 @@ typedef struct
const char *transpose_map; const char *transpose_map;
char dictionary_name[40]; char dictionary_name[40];
char phon_out[500];
char phonemes_repeat[20]; char phonemes_repeat[20];
int phonemes_repeat_count; int phonemes_repeat_count;
int phoneme_tab_ix; int phoneme_tab_ix;
@@ -723,7 +722,7 @@ int iswlower2(int c);
int iswupper2(int c); int iswupper2(int c);
int towlower2(unsigned int c); int towlower2(unsigned int c);
int towupper2(unsigned int c); int towupper2(unsigned int c);
void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int phoneme_mode); const char *GetTranslatedPhonemeString(int phoneme_mode);
const char *WordToString2(unsigned int word); const char *WordToString2(unsigned int word);
ALPHABET *AlphabetFromChar(int c); ALPHABET *AlphabetFromChar(int c);
ALPHABET *AlphabetFromName(const char *name); ALPHABET *AlphabetFromName(const char *name);
+4 -3
View File
@@ -406,6 +406,7 @@ void TranslDlg::OnCommand(wxCommandEvent& event)
int translate_text = 0; int translate_text = 0;
char buf[1000]; char buf[1000];
char phon_out[N_PH_LIST*2]; char phon_out[N_PH_LIST*2];
const char *phon_out2;
int clause_tone; int clause_tone;
int clause_count; int clause_count;
int use_ipa = 0; int use_ipa = 0;
@@ -495,11 +496,11 @@ void TranslDlg::OnCommand(wxCommandEvent& event)
CalcPitches(translator,clause_tone); CalcPitches(translator,clause_tone);
CalcLengths(translator); CalcLengths(translator);
GetTranslatedPhonemeString(translator->phon_out, sizeof(translator->phon_out), use_ipa); phon_out2 = GetTranslatedPhonemeString(use_ipa);
if(clause_count++ > 0) if(clause_count++ > 0)
strcat(phon_out," ||"); strcat(phon_out," ||");
strcat(phon_out,translator->phon_out); strcat(phon_out, phon_out2);
t_phonetic->SetValue(wxString(translator->phon_out,wxConvUTF8)); t_phonetic->SetValue(wxString(phon_out2, wxConvUTF8));
if((n_ph_list + n_phoneme_list) >= N_PH_LIST) if((n_ph_list + n_phoneme_list) >= N_PH_LIST)
{ {