Merge branch 'master' into android

This commit is contained in:
Reece H. Dunn
2013-07-27 11:16:46 +01:00
65 changed files with 5928 additions and 3744 deletions
+5 -5
View File
@@ -64,17 +64,17 @@ endif
endif
endif
CXXFLAGS = -O2 -Wall -c
CPPFLAGS = -pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\"
CXXFLAGS ?= -O2 -Wall
CPPFLAGS = -pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\"
.cpp.o:
$(CXX) $(CXXFLAGS) $(USE_AUDIO) -I. $(CPPFLAGS) $<
$(CXX) -c $(CXXFLAGS) $(USE_AUDIO) -I. $(CPPFLAGS) $<
e_%.o: %.cpp
$(CXX) $(CXXFLAGS) $(espeakedit_CXXFLAGS) $(USE_AUDIO) $(CPPFLAGS) -I. $< -o e_$*.o
$(CXX) -c $(CXXFLAGS) $(espeakedit_CXXFLAGS) $(USE_AUDIO) $(CPPFLAGS) -I. $< -o e_$*.o
x_%.o: %.cpp
$(CXX) $(CXXFLAGS) $(USE_AUDIO) -fpic -fvisibility=hidden \
$(CXX) -c $(CXXFLAGS) $(USE_AUDIO) -fpic -fvisibility=hidden \
-I. -D LIBRARY $(CPPFLAGS) $< -o x_$*.o
all: $(SPEAK) $(LIBESPEAK) $(STATIC_LIBESPEAK) $(ESPEAK) $(ESPEAKEDIT)
+1
View File
@@ -3672,6 +3672,7 @@ fprintf(f_errors,"\nRefs %d, Reused %d\n",count_references,duplicate_references
LoadVoice(voice_name2,0);
CompileReport();
if(gui_flag != 0)
report_dict = CompileAllDictionaries();
#ifdef MAKE_ENVELOPES
DrawEnvelopes();
+1
View File
@@ -1958,6 +1958,7 @@ int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, cha
fseek(f_out,4,SEEK_SET);
Write4Bytes(f_out,offset_rules);
fclose(f_out);
fflush(f_log);
LoadDictionary(translator, dict_name, 0);
+99 -97
View File
@@ -530,6 +530,10 @@ unsigned short ipa1[96] = {
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)
{//===================================================================================================
@@ -633,8 +637,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
to display the clause in phoneme mnemonic form.
@@ -644,7 +648,6 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int phoneme_mode
int ix;
unsigned int len;
unsigned int max_len;
int phon_out_ix=0;
int stress;
int c;
@@ -672,108 +675,107 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int phoneme_mode
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;
plist = &phoneme_list[ix];
WritePhMnemonic(phon_buf2, plist->ph, plist, use_ipa, &flags);
if(plist->newword)
*buf++ = ' ';
else
if((separate_phonemes != 0) && (ix > 1))
{
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);
if((c < 0x2b0) || (c > 0x36f)) // not if the phoneme starts with a superscript letter
{
*buf++ = separate_phonemes;
}
*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
-1
View File
@@ -144,7 +144,6 @@ if(argc > 1)
if(strcmp(param,"--compile")==0)
{
LoadPhData(NULL);
samplerate_native = samplerate = 22050;
CompilePhonemeData();
CompileIntonation();
+14
View File
@@ -1246,10 +1246,24 @@ void CalcPitches(Translator *tr, int clause_type)
}
count_pitch_vowels(st_start, ix, n_st);
if((ix < n_st) || (clause_type == 0))
{
calc_pitches(option, st_start, ix, group_tone); // split into > 1 tone groups
if((clause_type==1) || (clause_type==2))
group_tone = tr->langopts.tunes[1]; // , or ? remainder has comma-tone
else
group_tone = tr->langopts.tunes[0]; // . or ! remainder has statement tone
}
else
calc_pitches(option, st_start, ix, group_tone);
#ifdef deleted
if((ix < n_st) || (clause_type == 0))
calc_pitches(option, st_start, ix, group_tone_emph); // split into > 1 tone groups, use emphatic tone
else
calc_pitches(option, st_start, ix, group_tone);
#endif
st_start = ix;
}
+3 -3
View File
@@ -1090,7 +1090,7 @@ int Wavegen_Klatt(int resume)
}
for(ix=1; ix < 7; ix++)
{
kt_frame.Ap[ix] = 0;
kt_frame.Ap[ix] = peaks[ix].ap;
}
kt_frame.AVdb = klattp[KLATT_AV];
@@ -1333,12 +1333,12 @@ if(option_log_frames)
{
peaks[ix].bp1 = fr1->klatt_bp[ix] * 4; // parallel bandwidth
peaks[ix].bp = (int)peaks[ix].bp1;
next = fr2->klatt_bp[ix] * 2;
next = fr2->klatt_bp[ix] * 4;
peaks[ix].bp_inc = ((next - peaks[ix].bp1) * STEPSIZE) / length;
peaks[ix].ap1 = fr1->klatt_ap[ix]; // parallal amplitude
peaks[ix].ap = (int)peaks[ix].ap1;
next = fr2->klatt_ap[ix] * 2;
next = fr2->klatt_ap[ix];
peaks[ix].ap_inc = ((next - peaks[ix].ap1) * STEPSIZE) / length;
}
}
+44 -13
View File
@@ -1418,6 +1418,7 @@ static int LookupNum2(Translator *tr, int value, const int control, char *ph_out
// control bit 4: speak zero tens
// control bit 5: variant of ordinal number (lang=hu)
// bit 8 followed by decimal fraction
// bit 9: use #f form for both tens and units (lang=ml)
int found;
int ix;
@@ -1462,9 +1463,13 @@ static int LookupNum2(Translator *tr, int value, const int control, char *ph_out
// is there a special pronunciation for this 2-digit number
if(control & 8)
{
// is there a feminine form?
sprintf(string,"_%df",value);
found = Lookup(tr, string, ph_digits);
// is there a feminine or thousands-variant form?
sprintf(string,"_%dfx",value);
if((found = Lookup(tr, string, ph_digits)) == 0)
{
sprintf(string,"_%df",value);
found = Lookup(tr, string, ph_digits);
}
}
else if(is_ordinal)
{
@@ -1553,7 +1558,10 @@ static int LookupNum2(Translator *tr, int value, const int control, char *ph_out
}
if(found_ordinal == 0)
{
sprintf(string,"_%dX", tens);
if(control & 0x200)
sprintf(string, "_%dXf", tens);
else
sprintf(string,"_%dX", tens);
Lookup(tr, string, ph_tens);
}
@@ -1708,6 +1716,7 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
int ordinal;
int tplex;
int say_zero_hundred=0;
int say_one_hundred;
char string[12]; // for looking up entries in **_list
char buf1[100];
char buf2[100];
@@ -1776,6 +1785,8 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
x = 0;
if(tr->langopts.numbers2 & (1 << tplex))
x = 8; // use variant (feminine) for before thousands and millions
if(tr->translator_name == L('m','l'))
x = 0x208;
LookupNum2(tr, hundreds/10, x, ph_digits);
}
@@ -1788,6 +1799,7 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
if((hundreds == 0) && (say_zero_hundred == 0))
ph_100[0] = 0;
suppress_null = 1;
control |= 1;
}
ph_digits[0] = 0;
@@ -1823,17 +1835,24 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
}
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 ?
sprintf(string,"_%dC0",hundreds);
found = Lookup(tr, string, ph_digits);
// only look for special 100 if there are previous thousands
}
if(!found)
else
{
sprintf(string,"_%dC",hundreds);
found = Lookup(tr, string, ph_digits); // is there a specific pronunciation for n-hundred ?
if((!found) && (tensunits == 0))
{
// 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)
@@ -1842,7 +1861,14 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
}
else
{
if((hundreds > 1) || ((tr->langopts.numbers & NUM_OMIT_1_HUNDRED) == 0))
say_one_hundred = 1;
if(hundreds == 1)
{
if((tr->langopts.numbers & NUM_OMIT_1_HUNDRED) != 0)
say_one_hundred = 0;
}
if(say_one_hundred != 0)
{
LookupNum2(tr, hundreds, 0, ph_digits);
}
@@ -1898,6 +1924,11 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
x = 8; // use variant (feminine) for before thousands and millions
}
if((tr->translator_name == L('m','l')) && (thousandplex == 1))
{
x |= 0x208; // use #f form for both tens and units
}
if(LookupNum2(tr, tensunits, x | (control & 0x100), buf2) != 0)
{
if(tr->langopts.numbers & NUM_SINGLE_AND)
+2 -1
View File
@@ -509,9 +509,10 @@ void MakePhonemeList(Translator *tr, int post_pause, int start_sentence)
if((plist3+1)->synthflags & SFLAG_LENGTHEN)
{
static char types_double[] = {phFRICATIVE,phVFRICATIVE,phNASAL,phLIQUID,0};
if(strchr(types_double,next->type))
if((j > 0) && (strchr(types_double,next->type)))
{
// lengthen this consonant by doubling it
// BUT, can't insert a phoneme at position plist3[0] because it crashes PrevPh()
insert_ph = next->code;
(plist3+1)->synthflags ^= SFLAG_LENGTHEN;
}
+5 -2
View File
@@ -1601,6 +1601,7 @@ static int GetVoiceAttributes(wchar_t *pw, int tag_type)
wchar_t *name;
wchar_t *age;
wchar_t *variant;
int value;
const char *new_voice_id;
SSML_STACK *ssml_sp;
@@ -1646,7 +1647,9 @@ static int GetVoiceAttributes(wchar_t *pw, int tag_type)
attrcopy_utf8(ssml_sp->language,lang,sizeof(ssml_sp->language));
attrcopy_utf8(ssml_sp->voice_name,name,sizeof(ssml_sp->voice_name));
ssml_sp->voice_variant_number = attrnumber(variant,1,0)-1;
if((value = attrnumber(variant,1,0)) > 0)
value--; // variant='0' and variant='1' the same
ssml_sp->voice_variant_number = value;
ssml_sp->voice_age = attrnumber(age,0,0);
ssml_sp->voice_gender = attrlookup(gender,mnem_gender);
ssml_sp->tag_type = tag_type;
@@ -2293,7 +2296,7 @@ f_input = f_in; // for GetC etc
return(CLAUSE_EOF);
}
if((skip_characters > 0) && (count_characters > skip_characters))
if((skip_characters > 0) && (count_characters >= skip_characters))
{
// reached the specified start position
// don't break a word
+5 -4
View File
@@ -1164,14 +1164,15 @@ ESPEAK_API void espeak_SetPhonemeTrace(int value, FILE *stream)
} // 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
bits 4-7: 0=eSpeak phoneme names, 1=IPA
*/
option_multibyte = textmode & 7;
TranslateClause(translator, NULL, text, NULL, NULL);
GetTranslatedPhonemeString(buffer, size, phonememode);
*textptr = TranslateClause(translator, NULL, *textptr, NULL, NULL);
return(GetTranslatedPhonemeString(phonememode));
}
+10 -5
View File
@@ -34,7 +34,7 @@
#define ESPEAK_API
#endif
#define ESPEAK_API_REVISION 7
#define ESPEAK_API_REVISION 9
/*
Revision 2
Added parameter "options" to eSpeakInitialize()
@@ -58,6 +58,9 @@ Revision 7 24.Dec.2011
Revision 8 26.Apr.2013
Added function espeak_TextToPhonemes().
Revision 9 30.May.2013
Changed function espeak_TextToPhonemes().
*/
/********************/
/* Initialization */
@@ -481,13 +484,15 @@ ESPEAK_API void espeak_SetPhonemeTrace(int value, FILE *stream);
#ifdef __cplusplus
extern "C"
#endif
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);
/* Translates text into phonemes. Call espeak_SetVoiceByName() first, to select a language.
text: The text to translate, terminated by a zero character.
buffer: Output buffer for the phoneme translation.
It returns a pointer to a character string which contains the phonemes for the text up to
end of a sentence, or comma, semicolon, colon, or similar punctuation.
size: Size of the output buffer in bytes.
textptr: The address of a pointer to the input text which is terminated by a zero character.
On return, the pointer has been advanced past the text which has been translated, or else set
to NULL to indicate that the end of the text has been reached.
textmode: Type of character codes, one of:
espeakCHARS_UTF8 UTF8 encoding
+1 -1
View File
@@ -773,7 +773,7 @@ void SpectSeq::InterpolateAdjacent(void)
p->pkfreq = p1->pkfreq + int((p2->pkfreq - p1->pkfreq)*ratio);
p->pkheight=p1->pkheight+int((p2->pkheight-p1->pkheight)*ratio);
p->pkwidth = p1->pkwidth + int((p2->pkwidth - p1->pkwidth)*ratio);
p->pkright =p1->pkright + int((p2->pkright - p2->pkright)*ratio);
p->pkright =p1->pkright + int((p2->pkright - p1->pkright)*ratio);
}
frames[select]->keyframe = 1;
formantdlg->ShowFrame(this,select,1,0xff);
-1
View File
@@ -51,7 +51,6 @@
#endif
#ifdef _ESPEAKEDIT
#define USE_PORTAUDIO
#define USE_ASYNC
#define LOG_FRAMES // write keyframe info to log-espeakedit
#endif
+1 -1
View File
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.47.11 03.May.13";
const char *version_string = "1.47.11d 11.Jun.13";
const int version_phdata = 0x014709;
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;
static FILE *f_text=NULL;
static const void *p_text=NULL;
const char *phon_out;
if(control == 4)
{
@@ -1957,14 +1958,14 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control)
if(option_phonemes >= 3)
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)
{
fprintf(f_trans,"%s\n",translator->phon_out);
fprintf(f_trans,"%s\n",phon_out);
}
if(phoneme_callback != NULL)
{
phoneme_callback(translator->phon_out);
phoneme_callback(phon_out);
}
}
+13 -4
View File
@@ -237,6 +237,7 @@ static const char transpose_map_latin[] = {
tr->charset_a0 = charsets[1]; // ISO-8859-1, this is for when the input is not utf8
dictionary_name[0] = 0;
tr->dictionary_name[0] = 0;
tr->dict_condition=0;
tr->dict_min_size = 0;
tr->data_dictrules = NULL; // language_1 translation rules file
@@ -471,12 +472,13 @@ Translator *SelectTranslator(const char *name)
static const short stress_lengths_ta2[8] = {230, 230, 240, 240, 0, 0, 260, 260};
static const unsigned char stress_amps_ta[8] = {18,18, 18,18, 20,20, 22,22 };
tr = NewTranslator();
strcpy(tr->dictionary_name, name);
// convert name string into a word of up to 4 characters, for the switch()
while(*name != 0)
name2 = (name2 << 8) + *name++;
tr = NewTranslator();
switch(name2)
{
case L('a','f'):
@@ -898,6 +900,8 @@ SetupTranslator(tr,stress_lengths_equal,stress_amps_equal);
static const short stress_lengths_hr[8] = {180,160, 200,200, 0,0, 220,230};
static const short stress_lengths_sr[8] = {160,150, 200,200, 0,0, 250,260};
strcpy(tr->dictionary_name, "hbs");
if(name2 == L('s','r'))
SetupTranslator(tr,stress_lengths_sr,stress_amps_hr);
else
@@ -961,7 +965,8 @@ SetLengthMods(tr,3); // all equal
static const short stress_lengths_hy[8] = {250, 200, 250, 250, 0, 0, 250, 250};
static const char hy_vowels[] = {0x31, 0x35, 0x37, 0x38, 0x3b, 0x48, 0x55, 0};
static const char hy_consonants[] = {0x32,0x33,0x34,0x36,0x39,0x3a,0x3c,0x3d,0x3e,0x3f,
0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x56,0};
0x40,0x41,0x42,0x43,0x44, 0x46,0x47,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x56,0};
static const char hy_consonants2[] = {0x45,0};
SetupTranslator(tr,stress_lengths_hy,NULL);
tr->langopts.stress_rule = STRESSPOSN_1R; // default stress on final syllable
@@ -970,7 +975,9 @@ SetLengthMods(tr,3); // all equal
memset(tr->letter_bits,0,sizeof(tr->letter_bits));
SetLetterBits(tr,LETTERGP_A,hy_vowels);
SetLetterBits(tr,LETTERGP_VOWEL2,hy_vowels);
SetLetterBits(tr,LETTERGP_B,hy_consonants); // not including 'j'
SetLetterBits(tr,LETTERGP_C,hy_consonants);
SetLetterBits(tr,LETTERGP_C,hy_consonants2); // add 'j'
tr->langopts.max_initial_consonants = 6;
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_OMIT_1_HUNDRED;
// tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
@@ -1395,6 +1402,7 @@ SetLengthMods(tr,3); // all equal
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_SWAP_TENS | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ORDINAL_DOT | NUM_ROMAN;
tr->langopts.numbers2 = 0x100; // plural forms of millions etc
tr->langopts.thousands_sep = ' '; // don't allow dot as thousands separator
tr->langopts.replace_chars = replace_cyrillic_latin;
break;
case L('s','q'): // Albanian
@@ -1476,7 +1484,8 @@ SetLengthMods(tr,3); // all equal
if(name2 == L('m','l'))
{
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;
}
else
if(name2 == L('k','n'))
+11 -6
View File
@@ -1739,7 +1739,8 @@ int SetTranslator2(const char *new_language)
translator2->phoneme_tab_ix = new_phoneme_tab;
}
}
translator2->phonemes_repeat[0] = 0;
if(translator2 != NULL)
translator2->phonemes_repeat[0] = 0;
return(new_phoneme_tab);
} // end of SetTranslator2
@@ -2562,6 +2563,7 @@ void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *t
int dict_flags = 0; // returned from dictionary lookup
int word_flags; // set here
int next_word_flags;
int new_sentence2;
int embedded_count = 0;
int letter_count = 0;
int space_inserted = 0;
@@ -2642,16 +2644,19 @@ void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *t
if(clause_pause < 0)
clause_pause = 0;
terminator &= ~CLAUSE_BIT_SENTENCE; // clear sentence bit
if(new_sentence)
terminator |= CLAUSE_BIT_SENTENCE; // carry forward an end-of-sentence indicator
max_clause_pause += clause_pause;
new_sentence2 = 0;
}
else
{
max_clause_pause = clause_pause;
new_sentence2 = new_sentence;
}
tr->clause_terminator = terminator;
if(new_sentence)
if(new_sentence2)
{
count_sentences++;
if(skip_sentences > 0)
@@ -3040,7 +3045,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
c = ' ';
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'
sbuf[ix++] = ' ';
@@ -3138,7 +3143,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
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'
sbuf[ix++] = ' ';
@@ -3462,7 +3467,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
clause_pause = 10;
}
MakePhonemeList(tr, clause_pause, new_sentence);
MakePhonemeList(tr, clause_pause, new_sentence2);
phoneme_list[N_PHONEME_LIST].ph = NULL; // recognize end of phoneme_list array, in Generate()
phoneme_list[N_PHONEME_LIST].sourceix = 1;
+3 -2
View File
@@ -510,6 +510,7 @@ typedef struct {
#define NUM2_MYRIADS 0x4000
#define NUM2_ENGLISH_NUMERALS 0x8000
#define NUM2_PERCENT_BEFORE 0x10000
#define NUM2_OMIT_1_HUNDRED_ONLY 0x20000
// bits 1-4 use variant form of numbers before thousands,millions,etc.
// bits 6-8 use different forms of thousand, million, etc (M MA MB)
// bit9=(LANG=rw) say "thousand" and "million" before its number, not after
@@ -519,6 +520,7 @@ typedef struct {
// bit14=(LANG=ko) use myriads (groups of 4 digits) not thousands (groups of 3)
// bit15=(LANG=ne) speak (non-replaced) English numerals in English
// bit16=(LANG=si) say "%" before the number
// bit17=(LANG=ml) omit "one" before hundred only if there are no previous digits
int numbers2;
#define BREAK_THOUSANDS 0x49249248
@@ -579,7 +581,6 @@ typedef struct
const char *transpose_map;
char dictionary_name[40];
char phon_out[500];
char phonemes_repeat[20];
int phonemes_repeat_count;
int phoneme_tab_ix;
@@ -721,7 +722,7 @@ int iswlower2(int c);
int iswupper2(int c);
int towlower2(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);
ALPHABET *AlphabetFromChar(int c);
ALPHABET *AlphabetFromName(const char *name);
+4 -3
View File
@@ -406,6 +406,7 @@ void TranslDlg::OnCommand(wxCommandEvent& event)
int translate_text = 0;
char buf[1000];
char phon_out[N_PH_LIST*2];
const char *phon_out2;
int clause_tone;
int clause_count;
int use_ipa = 0;
@@ -495,11 +496,11 @@ void TranslDlg::OnCommand(wxCommandEvent& event)
CalcPitches(translator,clause_tone);
CalcLengths(translator);
GetTranslatedPhonemeString(translator->phon_out, sizeof(translator->phon_out), use_ipa);
phon_out2 = GetTranslatedPhonemeString(use_ipa);
if(clause_count++ > 0)
strcat(phon_out," ||");
strcat(phon_out,translator->phon_out);
t_phonetic->SetValue(wxString(translator->phon_out,wxConvUTF8));
strcat(phon_out, phon_out2);
t_phonetic->SetValue(wxString(phon_out2, wxConvUTF8));
if((n_ph_list + n_phoneme_list) >= N_PH_LIST)
{
+3 -2
View File
@@ -178,7 +178,7 @@ static MNEM_TAB keyword_tab[] = {
#define N_VOICE_VARIANTS 12
const char variants_either[N_VOICE_VARIANTS] = {1,2,12,3,13,4,14,5,11,0};
const char variants_male[N_VOICE_VARIANTS] = {1,2,3,4,5,0};
const char variants_male[N_VOICE_VARIANTS] = {1,2,3,4,5,6,7,0};
const char variants_female[N_VOICE_VARIANTS] = {11,12,13,14,0};
const char *variant_lists[3] = {variants_either, variants_male, variants_female};
@@ -301,7 +301,7 @@ static espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname, const char*lea
espeak_VOICE *voice_data;
int priority;
int age;
int n_variants = 3; // default, number of variants of this voice before using another voice
int n_variants = 4; // default, number of variants of this voice before using another voice
int gender;
#ifdef PLATFORM_WINDOWS
@@ -1068,6 +1068,7 @@ voice_t *LoadVoice(const char *vname, int control)
if((ix = SelectPhonemeTableName(phonemes_name)) < 0)
{
fprintf(stderr,"Unknown phoneme table: '%s'\n",phonemes_name);
ix = 0;
}
voice->phoneme_tab_ix = ix;
new_translator->phoneme_tab_ix = ix;