mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 13:38:47 +00:00
[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:
+27
-5
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user