Fix: crash with very long words. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@168 d46cf337-b52f-0410-862d-fd96e6ae7743master
@@ -5,7 +5,7 @@ | |||
// 2006-11-18 Gilles Casse <[email protected]> | |||
// | |||
// Updated 2008-03-05 Michel Such <[email protected]> | |||
// Updated 2008-03-12 Michel Such <[email protected]> | |||
// | |||
// * Numbers, a few abbreviations and exceptions. | |||
// | |||
@@ -42,13 +42,12 @@ m Em | |||
//n En // in fr_rules | |||
ñ $accent | |||
o o | |||
ô $accent | |||
_ô $accent | |||
ö $accent | |||
p pe | |||
q ky | |||
r ER | |||
s Es | |||
t te | |||
u y | |||
ù $accent | |||
û $accent | |||
@@ -56,8 +55,8 @@ u y | |||
v ve | |||
w dubl@v'e | |||
x iks | |||
z zEd | |||
_y i:gR'Ek | |||
z zEd | |||
@@ -274,6 +273,7 @@ toutefois $u | |||
comme $u | |||
dont dO~t2 $u | |||
lorsque $u | |||
parce $u | |||
puisque $u | |||
quand $u | |||
que $u | |||
@@ -347,7 +347,6 @@ sur $u | |||
par $u | |||
pour $u | |||
en $u | |||
(en effet) A~nEf'E $brk | |||
(en suspens) A~||sysp'A~ | |||
vers $u | |||
@@ -403,20 +402,20 @@ tout t'ut2 $u | |||
// Letters which can be words | |||
//=========================== | |||
à $atend $accent | |||
y $atend | |||
y igr'Ek $atend | |||
ô $atend $accent | |||
// pronunciation exceptions | |||
aspic aspik | |||
consent kO~s'A~t2 | |||
scient si | |||
coing kwE~ | |||
convent kO~vA~ | |||
couvent k'uvt2 $verb | |||
(couvent couvent) kuvA~||k'uvt2 | |||
dessus d@sy | |||
dessous d@su | |||
divers divErz2 | |||
hareng _!arA~ | |||
@@ -454,6 +453,7 @@ choeur k@r | |||
cocus coky | |||
estomac Estoma | |||
fils fis | |||
gars ga | |||
iris iris | |||
juin ZyE~ | |||
laser lazEr | |||
@@ -480,6 +480,8 @@ qu'à ka | |||
m'y mi $verbf | |||
t'y ti $verbf | |||
s'y si $verbf | |||
n'y ni $verbf | |||
l'y li $verbf | |||
qu'y ki $verbf | |||
(sud est) sydEst | |||
(nord est) nOREst | |||
@@ -672,3 +674,4 @@ vincent vE~sA~ | |||
@@ -4,7 +4,7 @@ | |||
// 2006-11-18 Gilles Casse <[email protected]> | |||
// | |||
// Updated: 2008-03-10 Michel Such <[email protected]> | |||
// Updated: 2008-03-12 Michel Such <[email protected]> | |||
// | |||
// * The rules are based on Cicero TTS. | |||
// Y | |||
@@ -163,6 +163,7 @@ | |||
_cl) ef (_ e // clef | |||
ein (C E~ // peindre | |||
ein (_ E~ | |||
eint (_ E~t2 | |||
e (il E // vieille | |||
ei E // neige | |||
ell El // selle | |||
@@ -254,7 +255,8 @@ | |||
ertin) en (t_ A~ // pertinent, impertinent | |||
ontin) en (t_ A~ // continent, incontinent | |||
erm) en (t_ A~ // ferment, serment | |||
_sArm) en (t_ A~ // sarment, serment | |||
erm) en (t_ A~ // ferment | |||
Vferm) en (t_ // ferment, referment (verbe) | |||
XArp) en (t_ A~ // arpent, serpent | |||
CArr) en (t_ A~ // conncurrent, torrent | |||
@@ -269,9 +271,11 @@ | |||
Cflu) en (t_ A~ // affluent, confluent | |||
VCflu) en (t_ // refluent, influent (verbe) | |||
al) en (t_ A~ // talent équivalent | |||
_tal) en (t_ A~ // talent | |||
ival) en (t_ A~ // équivalent | |||
Vival) en (t_ // équivalent (verbe) | |||
xcell) en (t_ A~ // excellent | |||
Vxcell) en (t_ // excellent | |||
nn) en (t_ t2 // prennent, viennent, sonnent | |||
iCam) en (t_ A~ | |||
@@ -301,7 +305,7 @@ | |||
qui_couv) en (t_ | |||
_couv) en (t_ A~ // le couvent | |||
en (t_ // étaient mangent | |||
en (t_ t2 // étaient mangent | |||
Ci) en (_ E~ // viendra | |||
Ci) en (C E~ // viendra | |||
@@ -334,9 +338,8 @@ | |||
er (_ e // parler léger | |||
er (s_ e | |||
i) ert (_t2 e // requiert | |||
i) e (rt_ E // requiert | |||
d) e (ssous_ @ // dessous | |||
d) e (ssus_ @ // dessus | |||
_d) es (bA e | |||
@@ -358,7 +361,6 @@ | |||
_r) e (ss @ // ressembler | |||
_r) e (ssu e // ressusciter | |||
_r) e (stra @ | |||
_r) e (stre @ | |||
_r) e (stro @ | |||
_r) e (stru @ // restructurer | |||
-) est (_ Est // -est | |||
@@ -368,18 +370,15 @@ | |||
dg) et (_ Et // Bridget, gadget | |||
') eu (_ y // eu | |||
eu (r_ @ // peur | |||
eu (rs_ @ // tracteurs | |||
eu (rX @ // peur | |||
// eu (rs_ @ // tracteurs | |||
eu (b @ // meuble | |||
eu (f @ // neuf | |||
eu (C @ | |||
eu (i @ | |||
eu (l @ // fieul | |||
eu (n @ // jeune | |||
eu (p @ | |||
eu (r @ | |||
eu (v @ | |||
eu (s Y // meute tueuse jeu gueuse | |||
eu (x_ Y | |||
eu (t_ Y | |||
eu Y // meute tueuse jeu gueuze | |||
_) eû y // eût | |||
eû Y // jeûne | |||
@@ -430,7 +429,7 @@ | |||
tr) e (CrA @ // entreprise | |||
e (CC E // infect pelle mettre | |||
e (CC E // infect pelle mettre | |||
_) e (ff e // effet, effectuer | |||
_s) e (cr @ // secret | |||
e (C_ E | |||
es (_ z2 | |||
@@ -631,8 +630,8 @@ _) half _^_en | |||
ie (ment i // remerciement balbutiement | |||
C) ien (t_ i | |||
dév) ien (t_ i | |||
t) ien (t_ jE~ // tient | |||
v) ien (t_ jE~ // vient | |||
t) ient (_ jE~t2 // tient | |||
v) ient (_ jE~t2 // vient | |||
at) ien (t_ jA~ // patient | |||
cip) ien (C jA~ // récipient | |||
cl) ien (C iA~ // client | |||
@@ -665,6 +664,7 @@ _) half _^_en | |||
in (C E~ // vingt | |||
in (_ W~ // vin | |||
ique (_ ik | |||
C) is (_ i | |||
// group i: English section | |||
iev _^_en | |||
@@ -982,8 +982,11 @@ e) s (_h z2 | |||
.group t | |||
t t // bataille | |||
_) t (_ te | |||
-) t (- t | |||
V) t (_ t2 // silent at end of verb unless next word starts with a vowel | |||
t (_ // silent at end of word | |||
t (-S1 t | |||
_) th (onX t // thon | |||
_) th (ymX t // shym | |||
ts (_S1 z2 // silent at end of word unless next word starts with a vowel |
@@ -35,7 +35,7 @@ | |||
#include "translate.h" | |||
#include "wave.h" | |||
const char *version_string = "1.36.01 11.Mar.08"; | |||
const char *version_string = "1.36.02 13.Mar.08"; | |||
const int version_phdata = 0x013400; | |||
int option_device_number = -1; |
@@ -107,6 +107,8 @@ static const unsigned short brackets[] = { | |||
// other characters which break a word, but don't produce a pause | |||
static const unsigned short breaks[] = {'_', 0}; | |||
// treat these characters as spaces, in addition to iswspace() | |||
static const wchar_t chars_space[] = {0x2500,0}; // box drawing horiz | |||
// Translate character codes 0xA0 to 0xFF into their unicode values | |||
@@ -389,6 +391,13 @@ int IsDigit(unsigned int c) | |||
return(0); | |||
} | |||
int IsSpace(unsigned int c) | |||
{//======================== | |||
if(wcschr(chars_space,c)) | |||
return(1); | |||
return(iswspace(c)); | |||
} | |||
Translator::Translator() | |||
{//===================== | |||
@@ -1332,7 +1341,7 @@ int Translator::TranslateWord2(char *word, WORD_TAB *wtab, int pre_pause, int ne | |||
const char *new_language; | |||
unsigned char bad_phoneme[4]; | |||
int word_copy_len; | |||
char word_copy[N_WORD_BYTES]; | |||
char word_copy[N_WORD_BYTES+1]; | |||
len = wtab->length; | |||
if(len > 31) len = 31; | |||
@@ -1441,7 +1450,7 @@ int Translator::TranslateWord2(char *word, WORD_TAB *wtab, int pre_pause, int ne | |||
{ | |||
int c2; | |||
ix = 0; | |||
while(((c2 = word_copy[ix] = word[ix]) != ' ') && (c2 != 0)) ix++; | |||
while(((c2 = word_copy[ix] = word[ix]) != ' ') && (c2 != 0) && (ix < N_WORD_BYTES)) ix++; | |||
word_copy_len = ix; | |||
flags = translator->TranslateWord(word, next_pause, wtab); | |||
@@ -2170,7 +2179,7 @@ if((c == '/') && (langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(prev_ou | |||
next_in = char_inserted; | |||
// allow certain punctuation within a word (usually only apostrophe) | |||
if(!IsAlpha(c) && !iswspace(c) && (wcschr(punct_within_word,c) == 0)) | |||
if(!IsAlpha(c) && !IsSpace(c) && (wcschr(punct_within_word,c) == 0)) | |||
{ | |||
if(IsAlpha(prev_out)) | |||
{ | |||
@@ -2348,7 +2357,7 @@ if((c == '/') && (langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(prev_ou | |||
} | |||
else | |||
{ | |||
if(iswspace(prev_out)) | |||
if(IsSpace(prev_out)) | |||
single_quoted = 1; | |||
else | |||
single_quoted = 0; | |||
@@ -2391,7 +2400,7 @@ if((c == '/') && (langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(prev_ou | |||
} | |||
} | |||
if(iswspace(c)) | |||
if(IsSpace(c)) | |||
{ | |||
if(space_inserted) | |||
{ |