[1.46.29]

Languages changes: it, pt.

Added experimental suffix option to allow multiple suffixes to be removed from a word (eg. (_S2m ).


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@295 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2012-11-23 10:40:38 +00:00
parent dfb316c05d
commit de97085d1e
8 changed files with 213 additions and 143 deletions
+1 -3
View File
@@ -1078,11 +1078,10 @@ cortes $2
cortile $2 cortile $2
cortisol $3 cortisol $3
cortocircuito kO@-*totSi@-*k'uito cortocircuito kO@-*totSi@-*k'uito
cosa $alt cos $alt
cosc $alt cosc $alt
coscia $alt coscia $alt
cosen $alt2 cosen $alt2
cosi $2
cosm $alt cosm $alt
cosmic $alt cosmic $alt
cosm $alt cosm $alt
@@ -3274,7 +3273,6 @@ rore $alt
ros $alt ros $alt
rosalia $3 rosalia $3
roseo $1 $alt roseo $1 $alt
rose $2
rosolia $3 rosolia $3
rospigliosi $alt2 rospigliosi $alt2
rosp $alt rosp $alt
+14 -1
View File
@@ -695,6 +695,7 @@ caractere $alt
careta $alt2 careta $alt2
carreta $alt2 carreta $alt2
casebre $alt casebre $alt
cateto $alt2
catorze $alt2 catorze $alt2
cefaleia $alt cefaleia $alt
cerca $alt $verb cerca $alt $verb
@@ -741,6 +742,7 @@ desfecho $alt2
desprezo $alt $verb desprezo $alt $verb
deva $alt2 deva $alt2
devo $alt2 devo $alt2
deveras $alt
dez $alt dez $alt
diarreia $alt diarreia $alt
discordo $alt discordo $alt
@@ -772,14 +774,17 @@ estiverdes $alt
estiveres $alt estiveres $alt
estrofe $alt estrofe $alt
etiqueta $alt2 etiqueta $alt2
europa $alt
exagero $alt $verb exagero $alt $verb
expeça $alt2 expeça $alt2
expeço $alt2 expeço $alt2
farofa $alt farofa $alt
febre $alt febre $alt
feitora $alt2
fera $alt fera $alt
fere $alt fere $alt
ferem $alt ferem $alt
ferozes $alt
fezes $alt fezes $alt
folga $alt folga $alt
fogos $alt fogos $alt
@@ -822,6 +827,8 @@ marreta $alt2
martelo $alt martelo $alt
merda $alt merda $alt
megera $alt megera $alt
mentora $alt2
metro $alt
mexa m'eS& mexa m'eS&
mexi meS'i mexi meS'i
mexo m'eSU mexo m'eSU
@@ -846,18 +853,20 @@ mutreta $alt2
naquele $alt2 naquele $alt2
negro $alt2 negro $alt2
novos $alt novos $alt
obstera $alt obstetra $alt
obsoleta $alt2 obsoleta $alt2
obsoleto $alt2 obsoleto $alt2
odisseia $alt odisseia $alt
onu $1 onu $1
opereta $alt2 opereta $alt2
ordens $alt
osso $alt2 osso $alt2
ovos $alt ovos $alt
padeceste $alt2 padeceste $alt2
paexa paeSa paexa paeSa
pangeia $alt pangeia $alt
palheta $alt2 palheta $alt2
paralelo $alt
parede $alt2 parede $alt2
pastora $alt2 pastora $alt2
pedra $alt pedra $alt
@@ -908,6 +917,7 @@ selo $alt $verb
selvagem seUv'aZeIN selvagem seUv'aZeIN
sincera $alt sincera $alt
sincero $alt sincero $alt
sinopse $alt
sobe $alt sobe $alt
sobem $alt sobem $alt
soco $alt2 soco $alt2
@@ -938,14 +948,17 @@ traqueia $alt
travesso $alt2 travesso $alt2
trevo $alt2 trevo $alt2
troco $alt2 $noun troco $alt2 $noun
tropa $alt
tropeço $alt2 $noun tropeço $alt2 $noun
trombeta $alt2 trombeta $alt2
valeta $alt2 valeta $alt2
vanessa $alt2 vanessa $alt2
velozes $alt
verbo $alt verbo $alt
verme $alt verme $alt
vierem $alt vierem $alt
violeta $alt2 violeta $alt2
voga $alt
vozes $alt vozes $alt
zelo $alt $verb zelo $alt $verb
zero $alt zero $alt
+17 -1
View File
@@ -20,6 +20,7 @@
.L03 a am o .L03 a am o
.L04 a am e em o ue uem .L04 a am e em o ue uem
.L05 r ra ram re rem rdes .L05 r ra ram re rem rdes
.L06 ra ram ste re rem
.group a .group a
@@ -337,6 +338,9 @@
?1 v) e (l_ ,E // eg: possível, amovível, disponível, etc... ?1 v) e (l_ ,E // eg: possível, amovível, disponível, etc...
?1 l) e (ta 'E // eg: bicicleta, atleta. ?1 l) e (ta 'E // eg: bicicleta, atleta.
sf) e (ra_ E // esfera, biosfera
//sort //sort
qu) e (brL04_ E qu) e (brL04_ E
_hosp) e (dL03_ E _hosp) e (dL03_ E
@@ -362,7 +366,7 @@ _comprom) e (tL03_ e
_atr) e (vL03_ e _atr) e (vL03_ e
_escr) e (vL03_ e _escr) e (vL03_ e
_descr) e (vL03_ e _descr) e (vL03_ e
_embel) e (zL01_ e _embel) e (zL04_ E
_pr) e (zL04_ E _pr) e (zL04_ E
_acont) e (çL01_ e _acont) e (çL01_ e
_ado) e (çL03_ e _ado) e (çL03_ e
@@ -383,6 +387,10 @@ _envaid) e (çL03_ e
_esclar) e (çL03_ e _esclar) e (çL03_ e
_reapar) e (çL03_ e _reapar) e (çL03_ e
_reconh) e (çL03_ e _reconh) e (çL03_ e
_coop) e (rL04_ E
_sup) e (rL04_ E
_imp) e (rL03_ E
_temp) e (rL04_ E
//endsort //endsort
_exag) e (L05_ E _exag) e (L05_ E
@@ -390,6 +398,12 @@ _reconh) e (çL03_ e
_houv) e (L05_ E _houv) e (L05_ E
_soub) e (L05_ E _soub) e (L05_ E
_compreend) e (L06_ e
_correspond) e (L06_ e
_entend) e (L06_ e
_estend) e (L06_ e
_respond)e (L06_ e
_vend) e (L06_ e
.group é .group é
é ''E é ''E
@@ -687,6 +701,7 @@ _reconh) e (çL03_ e
c) o (rrL01_ o // escorra, incorra, corra, recorra c) o (rrL01_ o // escorra, incorra, corra, recorra
_m) o (rrL01_ o _m) o (rrL01_ o
p) ostos (_ Ost=Us# // dispostos etc. p) ostos (_ Ost=Us# // dispostos etc.
_esn) o (bL04_ O
//endsort //endsort
.group ô .group ô
@@ -824,6 +839,7 @@ _reconh) e (çL03_ e
r) u (_A u r) u (_A u
u (A_ 'u u (A_ 'u
u (em_ 'u
ui uI ui uI
u (iu w u (iu w
u (iCK u u (iCK u
+1 -1
View File
@@ -1831,7 +1831,7 @@ _அகாலி_) த (ள dV
_) த (ீரரை d _) த (ீரரை d
_) த (ீர்க d _) த (ீர்க d
_) த (ீர்க்க t _) த (ீர்க்க t
_) தீர்க்க (_சுமங்கலி dirggV _) தீர்க்க (_சுமங்கலி di:rggV
_) தீர்க்க (தரிச di:rggV _) தீர்க்க (தரிச di:rggV
_) தீர்க்க (த்துடன di:rggV# _) தீர்க்க (த்துடன di:rggV#
_) த (ீர்க்கமா d _) த (ீர்க்கமா d
+3
View File
@@ -1126,6 +1126,9 @@ static void copy_rule_string(char *string, int &state)
case 'a': case 'a':
sxflags |= SUFX_A; sxflags |= SUFX_A;
break; break;
case 'm':
sxflags |= SUFX_M;
break;
default: default:
if(isdigit(c)) if(isdigit(c))
value = (value*10) + (c - '0'); value = (value*10) + (c - '0');
+6 -2
View File
@@ -3497,8 +3497,12 @@ int RemoveEnding(Translator *tr, char *word, int end_type, char *word_copy)
*word_end = 'e'; *word_end = 'e';
} }
i = word_end - word; i = word_end - word;
memcpy(word_copy,word,i);
word_copy[i] = 0; if(word_copy != NULL)
{
memcpy(word_copy,word,i);
word_copy[i] = 0;
}
// look for multibyte characters to increase the number of bytes to remove // look for multibyte characters to increase the number of bytes to remove
for(len_ending = i = (end_type & 0x3f); i>0 ;i--) // num.of characters of the suffix for(len_ending = i = (end_type & 0x3f); i>0 ;i--) // num.of characters of the suffix
+112 -77
View File
@@ -819,24 +819,28 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
unsigned int dictionary_flags[2]; unsigned int dictionary_flags[2];
unsigned int dictionary_flags2[2]; unsigned int dictionary_flags2[2];
int end_type=0; int end_type=0;
int end_type1=0;
int prefix_type=0; int prefix_type=0;
int prefix_stress; int prefix_stress;
char *wordx; char *wordx;
char phonemes[N_WORD_PHONEMES]; char phonemes[N_WORD_PHONEMES];
char phonemes2[N_WORD_PHONEMES];
char prefix_phonemes[N_WORD_PHONEMES]; char prefix_phonemes[N_WORD_PHONEMES];
char unpron_phonemes[N_WORD_PHONEMES]; char unpron_phonemes[N_WORD_PHONEMES];
char end_phonemes[N_WORD_PHONEMES]; char end_phonemes[N_WORD_PHONEMES];
char end_phonemes2[N_WORD_PHONEMES];
char word_copy[N_WORD_BYTES]; char word_copy[N_WORD_BYTES];
char word_copy2[N_WORD_BYTES]; char word_copy2[N_WORD_BYTES];
int word_copy_length; int word_copy_length;
char prefix_chars[0x3f + 2]; char prefix_chars[0x3f + 2];
int found=0; int found=0;
int end_flags; int end_flags;
char c_temp; // save a character byte while we temporarily replace it with space char c_temp; // save a character byte while we temporarily replace it with space
int first_char; int first_char;
int last_char = 0; int last_char = 0;
int add_plural_suffix = 0; int add_plural_suffix = 0;
int prefix_flags = 0; int prefix_flags = 0;
int more_suffixes;
int confirm_prefix; int confirm_prefix;
int spell_word; int spell_word;
int stress_bits; int stress_bits;
@@ -1157,7 +1161,6 @@ if((wmark > 0) && (wmark < 8))
if(confirm_prefix && !(end_type & SUFX_B)) if(confirm_prefix && !(end_type & SUFX_B))
{ {
int end2; int end2;
char phonemes2[N_WORD_PHONEMES];
char end_phonemes2[N_WORD_PHONEMES]; char end_phonemes2[N_WORD_PHONEMES];
// remove any standard suffix and confirm that the prefix is still recognised // remove any standard suffix and confirm that the prefix is still recognised
@@ -1276,93 +1279,121 @@ if((wmark > 0) && (wmark < 8))
} }
} }
if((end_type != 0) && !(end_type & SUFX_P)) if((end_type != 0) && !(end_type & SUFX_P))
{ {
char phonemes2[N_WORD_PHONEMES]; end_type1 = end_type;
strcpy(phonemes2,phonemes); strcpy(phonemes2,phonemes);
// The word has a standard ending, re-translate without this ending // The word has a standard ending, re-translate without this ending
end_flags = RemoveEnding(tr, wordx, end_type, word_copy); end_flags = RemoveEnding(tr, wordx, end_type, word_copy);
more_suffixes = 1;
phonemes[0] = 0; while(more_suffixes)
{
more_suffixes = 0;
phonemes[0] = 0;
if(prefix_phonemes[0] != 0) if(prefix_phonemes[0] != 0)
{ {
// lookup the stem without the prefix removed // lookup the stem without the prefix removed
wordx[-1] = c_temp; wordx[-1] = c_temp;
found = LookupDictList(tr, &word1, phonemes, dictionary_flags2, end_flags, wtab); // include prefix, but not suffix found = LookupDictList(tr, &word1, phonemes, dictionary_flags2, end_flags, wtab); // include prefix, but not suffix
wordx[-1] = ' '; wordx[-1] = ' ';
if(phonemes[0] == phonSWITCH) if(phonemes[0] == phonSWITCH)
{ {
// change to another language in order to translate this word // change to another language in order to translate this word
memcpy(wordx,word_copy,strlen(word_copy)); memcpy(wordx,word_copy,strlen(word_copy));
strcpy(word_phonemes,phonemes); strcpy(word_phonemes,phonemes);
return(0); return(0);
} }
if(dictionary_flags[0]==0) if(dictionary_flags[0]==0)
{ {
dictionary_flags[0] = dictionary_flags2[0]; dictionary_flags[0] = dictionary_flags2[0];
dictionary_flags[1] = dictionary_flags2[1]; dictionary_flags[1] = dictionary_flags2[1];
} }
if(found) if(found)
prefix_phonemes[0] = 0; // matched whole word, don't need prefix now prefix_phonemes[0] = 0; // matched whole word, don't need prefix now
if((found==0) && (dictionary_flags2[0] != 0)) if((found==0) && (dictionary_flags2[0] != 0))
prefix_flags = 1; prefix_flags = 1;
} }
if(found == 0) if(found == 0)
{ {
found = LookupDictList(tr, &wordx, phonemes, dictionary_flags2, end_flags, wtab); // without prefix and suffix found = LookupDictList(tr, &wordx, phonemes, dictionary_flags2, end_flags, wtab); // without prefix and suffix
if(phonemes[0] == phonSWITCH) if(phonemes[0] == phonSWITCH)
{ {
// change to another language in order to translate this word // change to another language in order to translate this word
memcpy(wordx,word_copy,strlen(word_copy)); memcpy(wordx,word_copy,strlen(word_copy));
strcpy(word_phonemes,phonemes); strcpy(word_phonemes,phonemes);
return(0); return(0);
} }
if(dictionary_flags2[0] & FLAG_ABBREV) if(dictionary_flags2[0] & FLAG_ABBREV)
{ {
// Removing the suffix leaves a word which should be spoken as individual letters // Removing the suffix leaves a word which should be spoken as individual letters
// Not yet implemented // Not yet implemented
} }
if(dictionary_flags[0]==0) if(dictionary_flags[0]==0)
{ {
dictionary_flags[0] = dictionary_flags2[0]; dictionary_flags[0] = dictionary_flags2[0];
dictionary_flags[1] = dictionary_flags2[1]; dictionary_flags[1] = dictionary_flags2[1];
} }
} }
if(found == 0) if(found == 0)
{ {
if(end_type & SUFX_Q) if(end_type & SUFX_Q)
{ {
// don't retranslate, use the original lookup result // don't retranslate, use the original lookup result
strcpy(phonemes,phonemes2); strcpy(phonemes,phonemes2);
// language specific changes // language specific changes
ApplySpecialAttribute(tr,phonemes,dictionary_flags[0]); ApplySpecialAttribute(tr,phonemes,dictionary_flags[0]);
} }
else else
{ {
if(end_flags & FLAG_SUFX) if(end_flags & FLAG_SUFX)
wflags |= FLAG_SUFFIX_REMOVED; wflags |= FLAG_SUFFIX_REMOVED;
if(end_type & SUFX_A) if(end_type & SUFX_A)
wflags |= FLAG_SUFFIX_VOWEL; wflags |= FLAG_SUFFIX_VOWEL;
TranslateRules(tr, wordx, phonemes, N_WORD_PHONEMES, NULL, wflags, dictionary_flags); if(end_type & SUFX_M)
{
// allow more suffixes before this suffix
strcpy(end_phonemes2, end_phonemes);
end_type = TranslateRules(tr, wordx, phonemes, N_WORD_PHONEMES, end_phonemes, wflags, dictionary_flags);
strcat(end_phonemes, end_phonemes2); // add the phonemes for the previous suffixes after this one
if(phonemes[0] == phonSWITCH) if((end_type != 0) && !(end_type & SUFX_P))
{ {
// change to another language in order to translate this word // there is another suffix
strcpy(word_phonemes,phonemes); end_flags = RemoveEnding(tr, wordx, end_type, NULL);
memcpy(wordx,word_copy,strlen(word_copy)); more_suffixes = 1;
wordx[-1] = c_temp; }
return(0); }
} else
} {
} // don't remove any previous suffix
TranslateRules(tr, wordx, phonemes, N_WORD_PHONEMES, NULL, wflags, dictionary_flags);
end_type = 0;
}
if((end_type & SUFX_T) == 0) if(phonemes[0] == phonSWITCH)
{
// change to another language in order to translate this word
strcpy(word_phonemes,phonemes);
memcpy(wordx,word_copy,strlen(word_copy));
wordx[-1] = c_temp;
return(0);
}
}
}
}
if((end_type1 & SUFX_T) == 0)
{ {
// the default is to add the suffix and then determine the word's stress pattern // the default is to add the suffix and then determine the word's stress pattern
AppendPhonemes(tr,phonemes, N_WORD_PHONEMES, end_phonemes); AppendPhonemes(tr,phonemes, N_WORD_PHONEMES, end_phonemes);
@@ -1370,6 +1401,10 @@ if(dictionary_flags2[0] & FLAG_ABBREV)
} }
memcpy(wordx,word_copy,strlen(word_copy)); memcpy(wordx,word_copy,strlen(word_copy));
} }
wordx[-1] = c_temp; wordx[-1] = c_temp;
} }
} }
@@ -1511,7 +1546,7 @@ if(dictionary_flags2[0] & FLAG_ABBREV)
// dictionary flags for this word give a clue about which alternative pronunciations of // dictionary flags for this word give a clue about which alternative pronunciations of
// following words to use. // following words to use.
if(end_type & SUFX_F) if(end_type1 & SUFX_F)
{ {
// expect a verb form, with or without -s suffix // expect a verb form, with or without -s suffix
tr->expect_verb = 2; tr->expect_verb = 2;
+1
View File
@@ -129,6 +129,7 @@
#define SUFX_T 0x10000 // don't affect the stress position in the stem #define SUFX_T 0x10000 // don't affect the stress position in the stem
#define SUFX_B 0x20000 // break, this character breaks the word into stem and suffix (used with SUFX_P) #define SUFX_B 0x20000 // break, this character breaks the word into stem and suffix (used with SUFX_P)
#define SUFX_A 0x40000 // remember that the suffix starts with a vowel #define SUFX_A 0x40000 // remember that the suffix starts with a vowel
#define SUFX_M 0x80000 // bit 19, allow multiple suffixes
#define SUFX_UNPRON 0x8000 // used to return $unpron flag from *_rules #define SUFX_UNPRON 0x8000 // used to return $unpron flag from *_rules