[1.27.10] Added inverse conditional rules in *_list and *_rules. eg. ?!3 "if rule 3 is NOT set".

lang=en-r, adjusted vowels.
Moved single characters (eg. % @) from *_list to *_rules so they can be used in combinations (eg. %-).


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@65 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2007-07-15 16:02:08 +00:00
parent 0def252307
commit daaa9ddbb7
40 changed files with 295 additions and 160 deletions
+23 -2
View File
@@ -161,6 +161,7 @@ int compile_line(char *linebuf, char *dict_line, int *hash)
int ix;
int step;
int n_flag_codes = 0;
int flag_offset;
int length;
int multiple_words = 0;
char *multiple_string = NULL;
@@ -189,7 +190,17 @@ int compile_line(char *linebuf, char *dict_line, int *hash)
if((c == '?') && (step==0))
{
// conditional rule, allow only if the numbered condition is set for the voice
flag_offset = 100;
p++;
if(*p == '!')
{
// allow only if the numbered condition is NOT set
flag_offset = 132;
p++;
}
ix = 0;
if(isdigit(*p))
{
@@ -201,7 +212,7 @@ int compile_line(char *linebuf, char *dict_line, int *hash)
ix = ix*10 + (*p-'0');
p++;
}
flag_codes[n_flag_codes++] = ix+100;
flag_codes[n_flag_codes++] = ix + flag_offset;
c = *p;
}
@@ -859,7 +870,17 @@ char *compile_rule(char *input)
if(rule_cond[0] != 0)
{
ix = -1;
ix = atoi(rule_cond);
if(rule_cond[0] == '!')
{
// allow the rule only if the condition number is NOT set for the voice
ix = atoi(&rule_cond[1]) + 32;
}
else
{
// allow the rule only if the condition number is set for the voice
ix = atoi(rule_cond);
}
if((ix > 0) && (ix < 255))
{
output[len++] = RULE_CONDITION;
+27 -5
View File
@@ -666,7 +666,7 @@ int Translator::IsVowel(int letter)
void SetLetterVowel(Translator *tr, int c)
{//=======================================
tr->letter_bits[c] = 0x81; // group 0 only
tr->letter_bits[c] = (tr->letter_bits[c] & 0x40) | 0x81; // keep value for group 6 (front vowels e,i,y)
}
void ResetLetterBits(Translator *tr, int groups)
@@ -1773,9 +1773,21 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
case RULE_CONDITION:
/* conditional rule, next byte gives condition number */
condition_num = *rule++;
if((dict_condition & (1L << condition_num))==0)
failed = 1;
if(condition_num >= 32)
{
// allow the rule only if the condition number is NOT set
if((dict_condition & (1L << (condition_num-32))) != 0)
failed = 1;
}
else
{
// allow the rule only if the condition number is set
if((dict_condition & (1L << condition_num)) == 0)
failed = 1;
}
if(!failed)
match.points++; // add one point for a matched conditional rule
break;
}
@@ -2677,8 +2689,18 @@ int Translator::LookupDict2(char *word, char *word2, char *phonetic, unsigned in
if(flag >= 100)
{
// conditional rule
if((dict_condition & (1 << (flag-100))) == 0)
condition_failed = 1;
if(flag >= 132)
{
// fail if this condition is set
if((dict_condition & (1 << (flag-132))) != 0)
condition_failed = 1;
}
else
{
// allow only if this condition is set
if((dict_condition & (1 << (flag-100))) == 0)
condition_failed = 1;
}
}
else
if(flag > 64)
+1 -1
View File
@@ -389,7 +389,7 @@ void Translator::CalcLengths()
if(p->type == phLIQUID)
{
p->length = speed1;
p->pitch1 = p->pitch2 - 20; // post vocalic [r/]
//p->pitch1 = p->pitch2 - 20; // post vocalic [r/]
}
if(next->type == phVSTOP)
+1 -1
View File
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.27.09 12.Jul.07";
const char *version_string = "1.27.10 15.Jul.07";
const int version_phdata = 0x012701;
int option_device_number = -1;
+1 -2
View File
@@ -317,8 +317,7 @@ Translator *SelectTranslator(const char *name)
case L('h','u'): // Hungarian
{
static int stress_amps_hu[8] = {17,17, 19,19, 20,24, 24,22 };
static int stress_lengths_hu[8] = {185,190, 190,190, 0,0, 210,220};
// static int stress_lengths_hu[8] = {180,180, 200,190, 0,0, 210,225};
static int stress_lengths_hu[8] = {185,195, 195,190, 0,0, 210,220};
static const unsigned int replace_chars_hu[] = {0xd4,0xf4,0xdb,0xfb,0};
static const unsigned int replacement_chars_hu[] = {0x150,0x151,0x170,0x171,0}; // allow o,u-circumflex for o,u-double-acute
+9 -5
View File
@@ -713,6 +713,7 @@ if((wmark > 0) && (wmark < 8))
length = 999;
while(((length < 3) && (length > 0))|| (word_length > 1 && Unpronouncable(word)))
{
char *p;
// This word looks "unpronouncable", so speak letters individually until we
// find a remainder that we can pronounce.
word += TranslateLetter(word,phonemes,0);
@@ -722,13 +723,15 @@ if((wmark > 0) && (wmark < 8))
strcpy(word_phonemes,phonemes);
return(0);
}
if(memcmp(word,"'s ",3) == 0)
p = &word[word_length-3];
if(memcmp(p,"'s ",3) == 0)
{
// remove a 's suffix and pronounce this separately (not as an individual letter)
add_plural_suffix = 1;
word[0] = ' ';
word[1] = ' ';
break;
p[0] = ' ';
p[1] = ' ';
last_char = p[-1];
}
length=0;
@@ -1903,7 +1906,8 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
{
if(!IsAlpha(prev_out) || (langopts.ideographs && (c >= 0x3000)))
{
letter_count = 0;
if(prev_out != '\'')
letter_count = 0; // don't reset count for an apostrophy within a word
if((prev_out != ' ') && (prev_out != '\''))
{