[1.31.13]

Error message if accented letters are not recognized as alphabetic.
"speak" program.  Don't finish when an empty sentence is found.
Compile dictionary: compile *_listx after *_list, not before.


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@146 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2008-02-21 18:47:23 +00:00
parent 134f750277
commit 897d6ba81e
22 changed files with 238 additions and 93 deletions
+1 -1
View File
@@ -1510,8 +1510,8 @@ int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, cha
fprintf(f_log,"Using phonemetable: '%s'\n",PhonemeTabName());
compile_dictlist_file(path,"roots");
compile_dictlist_file(path,"listx");
compile_dictlist_file(path,"list");
compile_dictlist_file(path,"listx");
compile_dictlist_file(path,"extra");
compile_dictlist_end(f_out);
+8 -5
View File
@@ -233,7 +233,7 @@ typedef struct {
int *body_drops;
unsigned char body_max_steps;
unsigned char body_lower_u;
char body_lower_u;
char n_overflow;
short *overflow;
@@ -270,8 +270,8 @@ static TONE_HEAD tone_head_table[N_TONE_HEAD_TABLE] = {
{20, 25, 34, 22, drops_0, 3, 3, 5, oflow}, // 8 pitch raises at end of sentence
{20, 25, 34, 20, drops_0, 3, 3, 5, oflow}, // 9 comma
{20, 25, 34, 22, drops_0, 3, 3, 5, oflow}, // 10 question
{20, 25, 24, 22, drops_0, 3, 3, 5, oflow_less}, // 11 test
{19, 26, 36, 20, drops_0, 2, 4, 5, oflow_test2}, // 12 test
{15, 18, 18, 14, drops_0, 3, 3, 5, oflow_less}, // 11 test
{20, 25, 24, 22, drops_0, 3, 3, 5, oflow_less}, // 12 test
};
static TONE_NUCLEUS tone_nucleus_table[N_TONE_NUCLEUS_TABLE] = {
@@ -1069,6 +1069,10 @@ void Translator::CalcPitches(int clause_type)
{
p->env = PITCHrise;
}
else
if(p->tone > 5)
p->env = syl->env;
if(p->pitch1 > p->pitch2)
{
// swap so that pitch2 is the higher
@@ -1076,8 +1080,7 @@ void Translator::CalcPitches(int clause_type)
p->pitch1 = p->pitch2;
p->pitch2 = x;
}
if(p->tone > 5)
p->env = syl->env;
if(syl->flags & SYL_EMPHASIS)
{
+8 -4
View File
@@ -37,8 +37,8 @@
void Translator::LookupLetter(int letter, int next_byte, char *ph_buf1)
{//==================================================================
void Translator::LookupLetter(unsigned int letter, int next_byte, char *ph_buf1)
{//=============================================================================
int len;
unsigned char *p;
static char single_letter[10] = {0,0};
@@ -643,6 +643,7 @@ int Translator::TranslateNumber_1(char *word, char *ph_out, unsigned int *flags,
int this_value;
static int prev_value;
int decimal_count;
int max_decimal_count;
char string[12]; // for looking up entries in de_list
char buf1[100];
char ph_append[50];
@@ -783,8 +784,11 @@ int Translator::TranslateNumber_1(char *word, char *ph_out, unsigned int *flags,
if(decimal_count > 1)
{
switch(langopts.numbers & 0x6000)
max_decimal_count = 2;
switch(langopts.numbers & 0xe000)
{
case 0x8000:
max_decimal_count = 5;
case 0x4000:
// French/Polish decimal fraction
while(word[n_digits] == '0')
@@ -794,7 +798,7 @@ int Translator::TranslateNumber_1(char *word, char *ph_out, unsigned int *flags,
decimal_count--;
n_digits++;
}
if(decimal_count < 6)
if(decimal_count <= max_decimal_count)
{
LookupNum3(atoi(&word[n_digits]),buf1,0,0,0);
strcat(ph_out,buf1);
+10 -3
View File
@@ -59,7 +59,7 @@ int (* uri_callback)(int, const char *, const char *) = NULL;
int (* phoneme_callback)(const char *) = NULL;
FILE *f_wave = NULL;
int quiet = 0;
int quiet = 0;
unsigned int samples_total = 0;
unsigned int samples_split = 0;
unsigned int wavefile_count = 0;
@@ -304,6 +304,9 @@ static int WavegenFile(void)
finished = WavegenFill(0);
if(quiet)
return(finished);
if(f_wave == NULL)
{
sprintf(fname,"%s_%.2d%s",wavefile,++wavefile_count,filetype);
@@ -794,15 +797,19 @@ int main (int argc, char **argv)
InitText(0);
SpeakNextClause(f_text,p_text,0);
ix = 1;
for(;;)
{
if(WavegenFile() != 0)
{
break; // finished, wavegen command queue is empty
if(ix == 0)
break; // finished, wavegen command queue is empty
}
if(Generate(phoneme_list,&n_phoneme_list,1)==0)
SpeakNextClause(NULL,NULL,1);
{
ix = SpeakNextClause(NULL,NULL,1);
}
}
CloseWaveFile();
+1 -1
View File
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.31.12 16.Feb.08";
const char *version_string = "1.31.13 21.Feb.08";
const int version_phdata = 0x013105;
int option_device_number = -1;
+6
View File
@@ -100,6 +100,12 @@ void SynthesizeInit()
// next_pause.ph = phoneme_tab[phonPAUSE]; // this must be done after voice selection
next_pause.type = phPAUSE;
next_pause.newword = 0;
if(!iswalpha(0x010d))
{
// check that c-caron is recognized as an alphabetic character
fprintf(stderr,"iswalpha() Accented letters are not recognized\n");
}
}
+4 -4
View File
@@ -277,7 +277,7 @@ Translator *SelectTranslator(const char *name)
tr->langopts.stress_flags = 0x0024; // don't use secondary stress
tr->langopts.param[LOPT_IT_LENGTHEN] = 1; // remove lengthen indicator from unstressed syllables
tr->langopts.numbers = 0x1509 + 0x4000 + NUM_NOPAUSE | NUM_ROMAN;
tr->langopts.numbers = 0x1509 + 0x8000 + NUM_NOPAUSE | NUM_ROMAN;
SetLetterVowel(tr,'y');
}
break;
@@ -642,7 +642,7 @@ SetLengthMods(tr,3); // all equal
}
break;
case L('t','a'):
case L('t','a'): // Tamil
{
static const short stress_lengths_ta[8] = {190, 190, 200, 200, 0, 0, 220, 220};
static const unsigned char stress_amps_ta[8] = {18,18, 18,18, 20,20, 22,22 };
@@ -693,7 +693,7 @@ SetLengthMods(tr,3); // all equal
tr->langopts.stress_rule = 7; // stress on the last syllable, before any explicitly unstressed syllable
tr->langopts.numbers = 0x1d09;
tr->langopts.numbers = 0x1d09 + 0x4000;
tr->langopts.max_initial_consonants = 2;
}
break;
@@ -734,7 +734,7 @@ SetLengthMods(tr,3); // all equal
case L('z','h'):
case L_zhy:
{
static const short stress_lengths_zh[8] = {230,150, 230,230, 230,0, 240,290};
static const short stress_lengths_zh[8] = {230,150, 230,230, 230,0, 240,250}; // 1=tone5. end-of-sentence, 6=tone 1&4, 7=tone 2&3
static const unsigned char stress_amps_zh[] = {22,16, 22,22, 22,22, 22,22 };
tr = new Translator;
+2 -2
View File
@@ -363,7 +363,7 @@ int IsAlpha(unsigned int c)
return(1); // Devanagari vowel signs and other signs
if((c >= 0xb81) && (c <= 0xbe5))
return(1); // Devanagari vowel signs and other signs
return(1); // Tamil vowel signs and other signs
if((c >= 0x300) && (c <= 0x36f))
return(1); // combining accents
@@ -2049,7 +2049,7 @@ if((c == '/') && (langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(prev_ou
else
if(IsAlpha(c))
{
if(!IsAlpha(prev_out) || (langopts.ideographs && ((c >= 0x3000) || (prev_out >= 0x3000))))
if(!IsAlpha(prev_out) || (langopts.ideographs && ((c > 0x3040) || (prev_out > 0x3040))))
{
if(wcschr(punct_within_word,prev_out) == 0)
letter_count = 0; // don't reset count for an apostrophy within a word
+1 -1
View File
@@ -428,7 +428,7 @@ private:
const char *LookupDict2(const char *word, const char *word2, char *phonetic, unsigned int *flags, int end_flags, WORD_TAB *wtab);
const char *LookupSpecial(const char *string);
const char *LookupCharName(int c);
void LookupLetter(int letter, int next_byte, char *ph_buf);
void LookupLetter(unsigned int letter, int next_byte, char *ph_buf);
int LookupNum2(int value, int control, char *ph_out);
int LookupNum3(int value, char *ph_out, int suppress_null, int thousandplex, int prev_thousands);
int LookupThousands(int value, int thousandplex, char *ph_out);