[1.46.01]

Improve error detection in *_list files.

Lang=hu, remove feature to unstress the second of two capitalized words at end of clause.


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@277 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2011-11-29 18:26:56 +00:00
parent f68774298b
commit 0617cc4750
46 changed files with 4297 additions and 2736 deletions
+22 -14
View File
@@ -373,6 +373,7 @@ static int compile_line(char *linebuf, char *dict_line, int *hash)
unsigned int ix;
int step;
unsigned int n_flag_codes = 0;
int flagnum;
int flag_offset;
int length;
int multiple_words = 0;
@@ -395,10 +396,6 @@ static char nullstring[] = {0};
text_not_phonemes = 0;
phonetic = word = nullstring;
if(memcmp(linebuf,"_-",2)==0)
{
step=1; // TEST
}
p = linebuf;
// while(isspace2(*p)) p++;
@@ -460,26 +457,26 @@ step=1; // TEST
while(!isspace2(c = *p)) p++;
*p = 0;
ix = LookupMnem(mnem_flags,mnemptr);
if(ix > 0)
flagnum = LookupMnem(mnem_flags,mnemptr);
if(flagnum > 0)
{
if(ix == 200)
if(flagnum == 200)
{
text_mode = 1;
}
else
if(ix == 201)
if(flagnum == 201)
{
text_mode = 0;
}
else
if(ix == BITNUM_FLAG_TEXTMODE)
if(flagnum == BITNUM_FLAG_TEXTMODE)
{
text_not_phonemes = 1;
}
else
{
flag_codes[n_flag_codes++] = ix;
flag_codes[n_flag_codes++] = flagnum;
}
}
else
@@ -539,11 +536,21 @@ step=1; // TEST
}
}
else
if((c == ')') && multiple_words)
if(c == ')')
{
p[0] = 0;
step = 3;
multiple_words = 0;
if(multiple_words)
{
p[0] = 0;
multiple_words = 0;
step = 3;
}
else
if(word[0] != '_')
{
fprintf(f_log, "%5d: Missing '('\n", linenum);
error_count++;
step = 3;
}
}
break;
@@ -720,6 +727,7 @@ step=1; // TEST
if(multiple_words > 10)
{
fprintf(f_log,"%5d: Two many parts in a multi-word entry: %d\n",linenum,multiple_words);
error_count++;
}
else
{
+3 -4
View File
@@ -776,7 +776,7 @@ static int IsLetter(Translator *tr, int letter, int group)
if(tr->letter_bits_offset > 0)
{
if(((letter2 = (letter - tr->letter_bits_offset)) > 0) && (letter2 < 0x80))
if(((letter2 = (letter - tr->letter_bits_offset)) > 0) && (letter2 < 0x100))
letter = letter2;
else
return(0);
@@ -787,7 +787,7 @@ static int IsLetter(Translator *tr, int letter, int group)
return(tr->letter_bits[remove_accent[letter-0xc0]] & (1L << group));
}
if((letter >= 0) && (letter < 0x80))
if((letter >= 0) && (letter < 0x100))
return(tr->letter_bits[letter] & (1L << group));
return(0);
@@ -1610,7 +1610,7 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
if(v_stress <= 1)
{
if((v > 1) && (max_stress >= 4) && (stressflags & 4) && (v == (vowel_count-1)))
if((v > 1) && (max_stress >= 2) && (stressflags & 4) && (v == (vowel_count-1)))
{
// option: mark unstressed final syllable as diminished
v_stress = 0;
@@ -2573,7 +2573,6 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
if((match1.points == 0) && ((option_sayas & 0x10) == 0))
{
n = utf8_in(&letter,p-1)-1;
if(tr->letter_bits_offset > 0)
{
// not a Latin alphabet, switch to the default Latin alphabet language
+9
View File
@@ -94,6 +94,9 @@ static const unsigned short punct_chars[] = {',','.','?','!',':',';',
0x0b1b, // Arabic ;
0x061f, // Arabic ?
0x0f0d, // Tibet Shad
0x0f0e,
0x1362, // Ethiopic period
0x1363,
0x1364,
@@ -137,6 +140,9 @@ static const unsigned int punct_attributes [] = { 0,
CLAUSE_SEMICOLON, // Arabic ;
CLAUSE_QUESTION, // Arabic question mark
CLAUSE_PERIOD+0x8000, // Tibet period
CLAUSE_PARAGRAPH,
CLAUSE_PERIOD, // Ethiopic period
CLAUSE_COMMA, // Ethiopic comma
CLAUSE_SEMICOLON, // Ethiopic semicolon
@@ -2391,6 +2397,9 @@ f_input = f_in; // for GetC etc
continue;
}
if(c1 == 0xf0b)
c1 = ' '; // Tibet inter-syllabic mark, ?? replace by space ??
if(iswspace(c1))
{
char *p_word;
+8
View File
@@ -218,6 +218,8 @@ static int GetMbrName(PHONEME_LIST *plist, PHONEME_TAB *ph, PHONEME_TAB *ph_prev
// bit 2 only at the start of a word
// bit 3 don't match two phonemes across a word boundary
// bit 4 add this phoneme name as a prefix to the next phoneme name (used for de4 phoneme prefix '?')
// bit 5 only in stressed syllable
// bit 6 only at the end of a word
*name2=0;
*split=0;
@@ -257,6 +259,12 @@ static int GetMbrName(PHONEME_LIST *plist, PHONEME_TAB *ph, PHONEME_TAB *ph_prev
if((pr->control & 4) && (plist->newword == 0)) // only at start of word
found = 0;
if((pr->control & 0x40) && (plist[1].newword == 0)) // only at the end of a word
found = 0;
if((pr->control & 0x20) && (plist->stresslevel < plist->wordstress))
found = 0; // only in stressed syllables
if(found)
{
*name2 = pr->mbr_name2;
+2 -2
View File
@@ -35,8 +35,8 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.45.47 24.Oct.11";
const int version_phdata = 0x014500;
const char *version_string = "1.46.01 22.Nov.11";
const int version_phdata = 0x014600;
int option_device_number = -1;
FILE *f_logespeak = NULL;
+25 -3
View File
@@ -60,9 +60,11 @@
#define OFFSET_KANNADA 0xc80
#define OFFSET_MALAYALAM 0xd00
#define OFFSET_SINHALA 0x0d80
#define OFFSET_TIBET 0x0f00
#define OFFSET_GEORGIAN 0x1080
#define OFFSET_KOREAN 0x1100
#define OFFSET_ETHIOPIC 0x1200
static void Translator_Russian(Translator *tr);
@@ -375,6 +377,7 @@ Translator *SelectTranslator(const char *name)
case L('a','m'): // Amharic, Ethiopia
{
SetupTranslator(tr,stress_lengths_fr,stress_amps_fr);
tr->letter_bits_offset = OFFSET_ETHIOPIC;
tr->langopts.stress_rule = STRESSPOSN_1L;
tr->langopts.stress_flags = 0x0024; // don't use secondary stress
tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
@@ -422,6 +425,19 @@ Translator *SelectTranslator(const char *name)
}
break;
case L('b','o'): // Tibet
{
tr->langopts.stress_rule = STRESSPOSN_1L;
tr->letter_bits_offset = OFFSET_TIBET;
SetLetterBitsRange(tr,LETTERGP_A,0x71,0x7d); // vowel signs
SetLetterBitsRange(tr,LETTERGP_B,0x71,0x81); // vowel signs and subjoined letters
SetLetterBitsRange(tr,LETTERGP_B,0x90,0xbc);
SetLetterBitsRange(tr,LETTERGP_C,0x40,0x6c); // consonant letters (not subjoined)
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
tr->langopts.numbers = 1;
}
break;
case L('c','y'): // Welsh
{
static const short stress_lengths_cy[8] = {170,220, 180,180, 0, 0, 250,270};
@@ -578,8 +594,7 @@ Translator *SelectTranslator(const char *name)
case L('c','a'): // Catalan
case L_pap: // Papiamento
{
static const short stress_lengths_es[8] = {180, 210, 190, 190, 0, 0, 230, 260};
// static const short stress_lengths_es[8] = {170, 200, 180, 180, 0, 0, 220, 250};
static const short stress_lengths_es[8] = {180, 190, 230, 180, 0, 0, 240, 270};
static const unsigned char stress_amps_es[8] = {16,12, 18,18, 20,20, 20,20 }; // 'diminished' is used to mark a quieter, final unstressed syllable
static const wchar_t ca_punct_within_word[] = {'\'',0xb7,0}; // ca: allow middle-dot within word
@@ -1276,6 +1291,13 @@ SetLengthMods(tr,3); // all equal
}
break;
case L('u','k'): // Ukrainian
{
SetCyrillicLetters(tr);
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 0x432; // [v] don't count this character at start of word
}
break;
case L('u','r'): // Urdu
tr->letter_bits_offset = OFFSET_ARABIC;
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
+7 -1
View File
@@ -401,6 +401,9 @@ int IsAlpha(unsigned int c)
if((c >= 0x780) && (c <= 0x7b1))
return(1); // taani/divehi (maldives)
if((c >= 0xf40) && (c <= 0xfbc))
return(1); // tibetan
if((c >= 0x1100) && (c <= 0x11ff))
return(1); //Korean jamo
@@ -1436,9 +1439,11 @@ if(dictionary_flags2[0] & FLAG_ABBREV)
dictionary_flags[0] &= ~FLAG_PAUSE1;
}
#ifdef deleted
// but it causes problems if these are not a person name
if(tr->translator_name == L('h','u'))
{
// lang=Hungarian, If the last two words of a clause have capital letters (eg. a person name), unstress the last word.
// lang=hu, If the last two words of a clause have capital letters (eg. a person name), unstress the last word.
if((wflags & (FLAG_LAST_WORD | FLAG_FIRST_UPPER | FLAG_ALL_UPPER | FLAG_FIRST_WORD)) == (FLAG_LAST_WORD | FLAG_FIRST_UPPER))
{
if(((wtab[-1].flags & (FLAG_FIRST_UPPER | FLAG_ALL_UPPER)) == FLAG_FIRST_UPPER) && ((tr->clause_terminator != 0x90028) || (wflags & FLAG_HAS_DOT)))
@@ -1447,6 +1452,7 @@ if(dictionary_flags2[0] & FLAG_ABBREV)
}
}
}
#endif
if((wflags & FLAG_HYPHEN) && (tr->langopts.stress_flags & S_HYPEN_UNSTRESS))
{