mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-03 22:26:48 +00:00
[1.47.03c]
Phoneme definition files: added prev2PhW() and next3PhW(). Added language: ms (Malay). git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@332 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+15
-5
@@ -104,9 +104,8 @@ static keywtab_t k_conditions[] = {
|
||||
{"next2PhW", tWHICH_PHONEME, 6},
|
||||
{"nextVowel",tWHICH_PHONEME, 7},
|
||||
{"prevVowel",tWHICH_PHONEME, 8},
|
||||
// {"next2PhW", tWHICH_PHONEME, 0x800},
|
||||
|
||||
// {"numVowels", tTEST, 0x000},
|
||||
{"next3PhW", tWHICH_PHONEME, 9},
|
||||
{"prev2PhW", tWHICH_PHONEME, 10},
|
||||
|
||||
{"PreVoicing", tTEST, 0xf01},
|
||||
{"KlattSynth", tTEST, 0xf02},
|
||||
@@ -1051,8 +1050,13 @@ static wxString CompileAllDictionaries()
|
||||
fclose(f_in);
|
||||
}
|
||||
|
||||
LoadVoice(voicename,0);
|
||||
|
||||
if(LoadVoice(voicename,1) == NULL)
|
||||
{
|
||||
wxLogError(wxString::Format(_T("Can't find voice '%s' for dictionary '%s'"), wxString(voicename, wxConvLocal).c_str(), dictstr.c_str()));
|
||||
report = report + dictstr + _T(" No Voice, ");
|
||||
errors ++;
|
||||
}
|
||||
else
|
||||
if((err = CompileDictionary(path_dsource, dictname,log,NULL,0)) > 0)
|
||||
{
|
||||
report = report + dictstr + wxString::Format(_T(" %d, "),err);
|
||||
@@ -2742,6 +2746,7 @@ int CompilePhoneme(int compile_phoneme)
|
||||
int count;
|
||||
int c;
|
||||
char *p;
|
||||
int vowel_length_factor = 100; // for testing
|
||||
char number_buf[12];
|
||||
char ipa_buf[N_ITEM_STRING+1];
|
||||
PHONEME_TAB phoneme_out2;
|
||||
@@ -2844,6 +2849,11 @@ int CompilePhoneme(int compile_phoneme)
|
||||
|
||||
case i_SET_LENGTH:
|
||||
value = NextItemMax(511);
|
||||
if(phoneme_out->type == phVOWEL)
|
||||
{
|
||||
value = (value * vowel_length_factor)/100;
|
||||
}
|
||||
|
||||
if(after_if == 0)
|
||||
{
|
||||
phoneme_out->std_length = value/2;
|
||||
|
||||
+5
-5
@@ -470,12 +470,12 @@ static int compile_line(char *linebuf, char *dict_line, int *hash)
|
||||
}
|
||||
|
||||
ix = 0;
|
||||
if(isdigit(*p))
|
||||
if(IsDigit09(*p))
|
||||
{
|
||||
ix += (*p-'0');
|
||||
p++;
|
||||
}
|
||||
if(isdigit(*p))
|
||||
if(IsDigit09(*p))
|
||||
{
|
||||
ix = ix*10 + (*p-'0');
|
||||
p++;
|
||||
@@ -542,7 +542,7 @@ static int compile_line(char *linebuf, char *dict_line, int *hash)
|
||||
case 1:
|
||||
if((c == '-') && multiple_words)
|
||||
{
|
||||
if(isdigit(word[0]))
|
||||
if(IsDigit09(word[0]))
|
||||
{
|
||||
multiple_numeric_hyphen = 1;
|
||||
}
|
||||
@@ -1156,7 +1156,7 @@ static void copy_rule_string(char *string, int &state)
|
||||
sxflags |= SUFX_M;
|
||||
break;
|
||||
default:
|
||||
if(isdigit(c))
|
||||
if(IsDigit09(c))
|
||||
value = (value*10) + (c - '0');
|
||||
break;
|
||||
}
|
||||
@@ -1575,7 +1575,7 @@ static int compile_lettergroup(char *input, FILE *f_out)
|
||||
char item_length[N_LETTERGP_ITEMS];
|
||||
|
||||
p = input;
|
||||
if(!isdigit(p[0]) || !isdigit(p[1]))
|
||||
if(!IsDigit09(p[0]) || !IsDigit09(p[1]))
|
||||
{
|
||||
fprintf(f_log,"%5d: Expected 2 digits after '.L'\n",linenum);
|
||||
error_count++;
|
||||
|
||||
+2
-2
@@ -607,7 +607,7 @@ char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int
|
||||
break; // # is subscript-h, but only for consonants
|
||||
|
||||
// ignore digits after the first character
|
||||
if(!first && isdigit(c))
|
||||
if(!first && IsDigit09(c))
|
||||
continue;
|
||||
|
||||
if((c >= 0x20) && (c < 128))
|
||||
@@ -3362,7 +3362,7 @@ int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *f
|
||||
if(((c = *word1++)==0) || (c == ' '))
|
||||
break;
|
||||
|
||||
if((c=='.') && (length > 0) && (isdigit(word[length-1])))
|
||||
if((c=='.') && (length > 0) && (IsDigit09(word[length-1])))
|
||||
break; // needed for lang=hu, eg. "december 2.-ig"
|
||||
|
||||
word[length] = c;
|
||||
|
||||
+18
-18
@@ -604,7 +604,7 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
|
||||
char ph_buf[80];
|
||||
char ph_buf2[80];
|
||||
char ph_alphabet[80];
|
||||
char hexbuf[6];
|
||||
char hexbuf[12];
|
||||
static char pause_string[] = {phonPAUSE, 0};
|
||||
|
||||
ph_buf[0] = 0;
|
||||
@@ -981,7 +981,7 @@ int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)
|
||||
flags[0] = 0;
|
||||
flags[1] = 0;
|
||||
|
||||
if(((tr->langopts.numbers & NUM_ROMAN_CAPITALS) && !(wtab[0].flags & FLAG_ALL_UPPER)) || isdigit(word[-2]))
|
||||
if(((tr->langopts.numbers & NUM_ROMAN_CAPITALS) && !(wtab[0].flags & FLAG_ALL_UPPER)) || IsDigit09(word[-2]))
|
||||
return(0); // not '2xx'
|
||||
|
||||
word_start = word;
|
||||
@@ -1020,7 +1020,7 @@ int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)
|
||||
n_digits++;
|
||||
}
|
||||
|
||||
if(isdigit(word[0]))
|
||||
if(IsDigit09(word[0]))
|
||||
return(0); // eg. 'xx2'
|
||||
|
||||
acc += prev;
|
||||
@@ -1756,12 +1756,12 @@ bool CheckThousandsGroup(char *word, int group_len)
|
||||
// Is this a group of 3 digits which looks like a thousands group?
|
||||
int ix;
|
||||
|
||||
if(isdigit(word[group_len]) || isdigit(-1))
|
||||
if(IsDigit09(word[group_len]) || IsDigit09(-1))
|
||||
return(false);
|
||||
|
||||
for(ix=0; ix < group_len; ix++)
|
||||
{
|
||||
if(!isdigit(word[ix]))
|
||||
if(!IsDigit09(word[ix]))
|
||||
return(false);
|
||||
}
|
||||
return(true);
|
||||
@@ -1812,7 +1812,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
digit_lookup = buf_digit_lookup;
|
||||
number_control = control;
|
||||
|
||||
for(ix=0; isdigit(word[ix]); ix++) ;
|
||||
for(ix=0; IsDigit09(word[ix]); ix++) ;
|
||||
n_digits = ix;
|
||||
value = this_value = atoi(word);
|
||||
|
||||
@@ -1821,14 +1821,14 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
group_len = 4;
|
||||
|
||||
// is there a previous thousands part (as a previous "word") ?
|
||||
if((n_digits == group_len) && (word[-2] == tr->langopts.thousands_sep) && isdigit(word[-3]))
|
||||
if((n_digits == group_len) && (word[-2] == tr->langopts.thousands_sep) && IsDigit09(word[-3]))
|
||||
{
|
||||
prev_thousands = 1;
|
||||
}
|
||||
else if((tr->langopts.thousands_sep == ' ') || (tr->langopts.numbers & NUM_ALLOW_SPACE))
|
||||
{
|
||||
// thousands groups can be separated by spaces
|
||||
if((n_digits == 3) && !(wtab->flags & FLAG_MULTIPLE_SPACES) && isdigit(word[-2]))
|
||||
if((n_digits == 3) && !(wtab->flags & FLAG_MULTIPLE_SPACES) && IsDigit09(word[-2]))
|
||||
{
|
||||
prev_thousands = 1;
|
||||
}
|
||||
@@ -1850,7 +1850,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
if((word[ix] == '.') && !isdigit(word[ix+1]) && !isdigit(word[ix+2]) && !(wtab[1].flags & FLAG_NOSPACE))
|
||||
if((word[ix] == '.') && !IsDigit09(word[ix+1]) && !IsDigit09(word[ix+2]) && !(wtab[1].flags & FLAG_NOSPACE))
|
||||
{
|
||||
// remove dot unless followed by another number
|
||||
word[ix] = 0;
|
||||
@@ -1879,7 +1879,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
{
|
||||
ordinal = 2;
|
||||
}
|
||||
else if(!isdigit(suffix[0])) // not _#9 (tab)
|
||||
else if(!IsDigit09(suffix[0])) // not _#9 (tab)
|
||||
{
|
||||
sprintf(string,"_#%s",suffix);
|
||||
if(Lookup(tr, string, ph_ordinal2))
|
||||
@@ -1904,7 +1904,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
|
||||
if((word[0] == '0') && (prev_thousands == 0) && (word[1] != ' ') && (word[1] != tr->langopts.decimal_sep))
|
||||
{
|
||||
if((n_digits == 2) && (word[3] == ':') && isdigit(word[5]) && isspace(word[7]))
|
||||
if((n_digits == 2) && (word[3] == ':') && IsDigit09(word[5]) && isspace(word[7]))
|
||||
{
|
||||
// looks like a time 02:30, omit the leading zero
|
||||
}
|
||||
@@ -1973,7 +1973,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
if((word[n_digits] == tr->langopts.decimal_sep) && isdigit(word[n_digits+1]))
|
||||
if((word[n_digits] == tr->langopts.decimal_sep) && IsDigit09(word[n_digits+1]))
|
||||
{
|
||||
// this "word" ends with a decimal point
|
||||
Lookup(tr, "_dpt", ph_append);
|
||||
@@ -2018,8 +2018,8 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
char *p2;
|
||||
// look for combinations of the number with the next word
|
||||
p = word;
|
||||
while(isdigit(p[1])) p++; // just use the last digit
|
||||
if(isdigit(p[-1]))
|
||||
while(IsDigit09(p[1])) p++; // just use the last digit
|
||||
if(IsDigit09(p[-1]))
|
||||
{
|
||||
p2 = p - 1;
|
||||
if(LookupDictList(tr, &p2, buf_digit_lookup, flags, FLAG_SUFX, wtab)) // lookup 2 digits
|
||||
@@ -2082,7 +2082,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
n_digits++;
|
||||
|
||||
decimal_count = 0;
|
||||
while(isdigit(word[n_digits+decimal_count]))
|
||||
while(IsDigit09(word[n_digits+decimal_count]))
|
||||
decimal_count++;
|
||||
|
||||
// if(decimal_count > 1)
|
||||
@@ -2101,7 +2101,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
decimal_count--;
|
||||
n_digits++;
|
||||
}
|
||||
if((decimal_count <= max_decimal_count) && isdigit(word[n_digits]))
|
||||
if((decimal_count <= max_decimal_count) && IsDigit09(word[n_digits]))
|
||||
{
|
||||
LookupNum3(tr, atoi(&word[n_digits]), buf1, 0,0,0);
|
||||
strcat(ph_out,buf1);
|
||||
@@ -2152,7 +2152,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
while(isdigit(c = word[n_digits]) && (strlen(ph_out) < (N_WORD_PHONEMES - 10)))
|
||||
while(IsDigit09(c = word[n_digits]) && (strlen(ph_out) < (N_WORD_PHONEMES - 10)))
|
||||
{
|
||||
// speak any remaining decimal fraction digits individually
|
||||
value = word[n_digits++] - '0';
|
||||
@@ -2165,7 +2165,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
if(Lookup(tr, "_dpt2", buf1))
|
||||
strcat(ph_out,buf1);
|
||||
|
||||
if((c == tr->langopts.decimal_sep) && isdigit(word[n_digits+1]))
|
||||
if((c == tr->langopts.decimal_sep) && IsDigit09(word[n_digits+1]))
|
||||
{
|
||||
Lookup(tr, "_dpt", buf1);
|
||||
strcat(ph_out,buf1);
|
||||
|
||||
+2
-2
@@ -1287,10 +1287,10 @@ static int attrnumber(const wchar_t *pw, int default_value, int type)
|
||||
{//==================================================================
|
||||
int value = 0;
|
||||
|
||||
if((pw == NULL) || !isdigit(*pw))
|
||||
if((pw == NULL) || !IsDigit09(*pw))
|
||||
return(default_value);
|
||||
|
||||
while(isdigit(*pw))
|
||||
while(IsDigit09(*pw))
|
||||
{
|
||||
value = value*10 + *pw++ - '0';
|
||||
}
|
||||
|
||||
+17
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.47.03b 22.Mar.13";
|
||||
const char *version_string = "1.47.03c 23.Mar.13";
|
||||
const int version_phdata = 0x014701;
|
||||
|
||||
int option_device_number = -1;
|
||||
@@ -615,6 +615,7 @@ static int CountVowelPosition(PHONEME_LIST *plist)
|
||||
static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist, USHORT *p_prog, WORD_PH_DATA *worddata)
|
||||
{//========================================================================================================================
|
||||
int which;
|
||||
int ix;
|
||||
unsigned int data;
|
||||
int instn;
|
||||
int instn2;
|
||||
@@ -705,6 +706,21 @@ static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist,
|
||||
return(false); // no previous vowel
|
||||
plist = &(worddata->prev_vowel);
|
||||
break;
|
||||
|
||||
case 9: // next3PhW
|
||||
for(ix=1; ix<=3; ix++)
|
||||
{
|
||||
if(plist[ix].sourceix)
|
||||
return(false);
|
||||
}
|
||||
plist = &plist[3];
|
||||
break;
|
||||
|
||||
case 10: // prev2PhW
|
||||
if((plist[0].sourceix) || (plist[-1].sourceix))
|
||||
return(false);
|
||||
plist-=2;
|
||||
break;
|
||||
}
|
||||
|
||||
if((which == 0) || (which == 5))
|
||||
|
||||
@@ -975,6 +975,7 @@ SetLengthMods(tr,3); // all equal
|
||||
break;
|
||||
|
||||
case L('i','d'): // Indonesian
|
||||
case L('m','s'): // Malay
|
||||
{
|
||||
static const short stress_lengths_id[8] = {160, 200, 180, 180, 0, 0, 220, 240};
|
||||
static const unsigned char stress_amps_id[8] = {16,18, 18,18, 20,22, 22,21 };
|
||||
@@ -1312,7 +1313,7 @@ SetLengthMods(tr,3); // all equal
|
||||
tr->langopts.stress_rule = STRESSPOSN_2R;
|
||||
tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2;
|
||||
tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
|
||||
|
||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words. Need to allow "bw'" prefix
|
||||
tr->langopts.numbers = NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_DFRACTION_2 | NUM_AND_HUNDRED;
|
||||
tr->langopts.numbers2 = 0x200; // say "thousands" before its number
|
||||
}
|
||||
@@ -1429,6 +1430,8 @@ SetLengthMods(tr,3); // all equal
|
||||
tr->langopts.vowel_pause = 1;
|
||||
tr->langopts.stress_rule = STRESSPOSN_2R;
|
||||
tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2;
|
||||
tr->langopts.max_initial_consonants = 4; // for example: mwngi
|
||||
|
||||
|
||||
tr->langopts.numbers = NUM_AND_UNITS | NUM_HUNDRED_AND | NUM_SINGLE_AND | NUM_OMIT_1_HUNDRED;
|
||||
tr->langopts.break_numbers = 0x49249268; // for languages which have numbers for 100,000 and 1,000,000
|
||||
|
||||
+6
-5
@@ -374,6 +374,7 @@ void SetLengthMods(Translator *tr, int value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
int IsAlpha(unsigned int c)
|
||||
{//========================
|
||||
// Replacement for iswalph() which also checks for some in-word symbols
|
||||
@@ -429,8 +430,8 @@ int IsAlpha(unsigned int c)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int IsDigit09(unsigned int c)
|
||||
{//=========================
|
||||
int IsDigit09(unsigned int c)
|
||||
{//============================
|
||||
if((c >= '0') && (c <= '9'))
|
||||
return(1);
|
||||
return(0);
|
||||
@@ -2311,10 +2312,10 @@ static int EmbeddedCommand(unsigned int &source_index)
|
||||
source_index++;
|
||||
}
|
||||
|
||||
if(isdigit(source[source_index]))
|
||||
if(IsDigit09(source[source_index]))
|
||||
{
|
||||
value = atoi(&source[source_index]);
|
||||
while(isdigit(source[source_index]))
|
||||
while(IsDigit09(source[source_index]))
|
||||
source_index++;
|
||||
}
|
||||
|
||||
@@ -3331,7 +3332,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
|
||||
|
||||
while(pn < &number_buf[sizeof(number_buf)-20])
|
||||
{
|
||||
if(!isdigit(c = *pw++) && (c != tr->langopts.decimal_sep))
|
||||
if(!IsDigit09(c = *pw++) && (c != tr->langopts.decimal_sep))
|
||||
break;
|
||||
|
||||
*pn++ = c;
|
||||
|
||||
@@ -709,6 +709,7 @@ void InitNamedata(void);
|
||||
void InitText(int flags);
|
||||
void InitText2(void);
|
||||
int IsDigit(unsigned int c);
|
||||
int IsDigit09(unsigned int c);
|
||||
int IsAlpha(unsigned int c);
|
||||
int IsVowel(Translator *tr, int c);
|
||||
int isspace2(unsigned int c);
|
||||
|
||||
+2
-2
@@ -601,7 +601,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
|
||||
// which directory to look for a named voice. List of voice names, must end in a space.
|
||||
static const char *voices_asia =
|
||||
"fa fa-pin hi hy hy-west id ka kn ku ml ne pa ta tr vi vi-hue zh zh-yue ";
|
||||
"fa fa-pin hi hy hy-west id ka kn ku ml ms ne pa ta tr vi vi-hue zh zh-yue ";
|
||||
static const char *voices_europe =
|
||||
"an bg bs ca cs cy da de el en en-us es et fi fr fr-be ga hr hu is it lt lv mk nl no pl pt-pt ro ru sk sq sr sv ";
|
||||
|
||||
@@ -1134,7 +1134,7 @@ static char *ExtractVoiceVariantName(char *vname, int variant_num, int add_dir)
|
||||
// The voice name has a +variant suffix
|
||||
variant_num = 0;
|
||||
*p++ = 0; // delete the suffix from the voice name
|
||||
if(isdigit(*p))
|
||||
if(IsDigit09(*p))
|
||||
{
|
||||
variant_num = atoi(p); // variant number
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user