mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-05 14:47:26 +00:00
[1.46.25]
Changes to: pt, tt, ko. Phoneme definitions: added NOT operator, eg: IF NOT nextPh(isVowel) THEN git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@290 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+16
-2
@@ -71,6 +71,7 @@ typedef struct {
|
||||
#define k_AND 1
|
||||
#define k_OR 2
|
||||
#define k_THEN 3
|
||||
#define k_NOT 4
|
||||
|
||||
#define kTHISSTRESS 0x800
|
||||
|
||||
@@ -90,6 +91,7 @@ static keywtab_t k_conditions[] = {
|
||||
{"AND", 0, k_AND},
|
||||
{"OR", 0, k_OR},
|
||||
{"THEN", 0, k_THEN},
|
||||
{"NOT", 0, k_NOT},
|
||||
{"prevPh", tWHICH_PHONEME, 0},
|
||||
{"prevPhW", tWHICH_PHONEME, 5},
|
||||
{"thisPh", tWHICH_PHONEME, 1},
|
||||
@@ -2257,10 +2259,11 @@ int CompileIf(int elif)
|
||||
int key;
|
||||
int finish = 0;
|
||||
int word = 0;
|
||||
int word2 = 0;
|
||||
int word2;
|
||||
int data;
|
||||
int bitmap;
|
||||
int brackets;
|
||||
int not_flag;
|
||||
USHORT *prog_last_if = NULL;
|
||||
|
||||
then_count = 2;
|
||||
@@ -2268,6 +2271,8 @@ int CompileIf(int elif)
|
||||
|
||||
while(!finish)
|
||||
{
|
||||
not_flag = 0;
|
||||
word2 = 0;
|
||||
if(prog_out >= prog_out_max)
|
||||
{
|
||||
error("Phoneme program too large", NULL);
|
||||
@@ -2277,6 +2282,13 @@ int CompileIf(int elif)
|
||||
if((key = NextItem(tCONDITION)) < 0)
|
||||
error("Expected a condition, not '%s'",item_string);
|
||||
|
||||
if((item_type == 0) && (key == k_NOT))
|
||||
{
|
||||
not_flag = 1;
|
||||
if((key = NextItem(tCONDITION)) < 0)
|
||||
error("Expected a condition, not '%s'",item_string);
|
||||
}
|
||||
|
||||
if(item_type == tWHICH_PHONEME)
|
||||
{
|
||||
// prevPh(), thisPh(), nextPh(), next2Ph() etc
|
||||
@@ -2331,7 +2343,9 @@ int CompileIf(int elif)
|
||||
*prog_out++ = word | i_CONDITION;
|
||||
|
||||
if(word2 != 0)
|
||||
*prog_out++ = word2;
|
||||
*prog_out++ = word2;
|
||||
if(not_flag)
|
||||
*prog_out++ = i_NOT;
|
||||
|
||||
// expect AND, OR, THEN
|
||||
switch(NextItem(tCONDITION))
|
||||
|
||||
+1
-1
@@ -521,7 +521,7 @@ sprintf(outptr,"* ");
|
||||
unsigned short ipa1[96] = {
|
||||
0x20,0x21,0x22,0x2b0,0x24,0x25,0x0e6,0x2c8,0x28,0x27e,0x2a,0x2b,0x2cc,0x2d,0x2e,0x2f,
|
||||
0x252,0x31,0x32,0x25c,0x34,0x35,0x36,0x37,0x275,0x39,0x2d0,0x2b2,0x3c,0x3d,0x3e,0x294,
|
||||
0x259,0x251,0x3b2,0xe7,0xf0,0x25b,0x46,0x262,0x127,0x26a,0x25f,0x4b,0x4c,0x271,0x14b,0x254,
|
||||
0x259,0x251,0x3b2,0xe7,0xf0,0x25b,0x46,0x262,0x127,0x26a,0x25f,0x4b,0x29f,0x271,0x14b,0x254,
|
||||
0x3a6,0x263,0x280,0x283,0x3b8,0x28a,0x28c,0x153,0x3c7,0xf8,0x292,0x32a,0x5c,0x5d,0x5e,0x5f,
|
||||
0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x261,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,
|
||||
0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x303,0x7f
|
||||
|
||||
+14
-7
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.46.24 11.Sep.12";
|
||||
const char *version_string = "1.46.25 14.Sep.12";
|
||||
const int version_phdata = 0x014624;
|
||||
|
||||
int option_device_number = -1;
|
||||
@@ -929,6 +929,7 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_
|
||||
int instn2;
|
||||
int or_flag;
|
||||
bool truth;
|
||||
bool truth2;
|
||||
int data;
|
||||
int end_flag;
|
||||
int ix;
|
||||
@@ -1044,14 +1045,20 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_
|
||||
while((instn & 0xe000) == 0x2000)
|
||||
{
|
||||
// process a sequence of conditions, using boolean accumulator
|
||||
if(or_flag)
|
||||
truth = (truth || InterpretCondition(tr, control, plist, prog, worddata));
|
||||
else
|
||||
truth = (truth && InterpretCondition(tr, control, plist, prog, worddata));
|
||||
or_flag = instn & 0x1000;
|
||||
truth2 = InterpretCondition(tr, control, plist, prog, worddata);
|
||||
prog += NumInstnWords(prog);
|
||||
if(*prog == i_NOT)
|
||||
{
|
||||
truth2 = truth2 ^ 1;
|
||||
prog++;
|
||||
}
|
||||
|
||||
if(or_flag)
|
||||
truth = truth || truth2;
|
||||
else
|
||||
truth = truth && truth2;
|
||||
or_flag = instn & 0x1000;
|
||||
instn = *prog;
|
||||
// instn = *(++prog);
|
||||
}
|
||||
|
||||
if(truth == false)
|
||||
|
||||
@@ -273,6 +273,7 @@ typedef struct {
|
||||
|
||||
#define i_RETURN 0x0001
|
||||
#define i_CONTINUE 0x0002
|
||||
#define i_NOT 0x0003
|
||||
|
||||
// Group 0 instrcutions with 8 bit operand. These values go into bits 8-15 of the instruction
|
||||
#define i_CHANGE_PHONEME 0x01
|
||||
|
||||
@@ -957,6 +957,8 @@ SetLengthMods(tr,3); // all equal
|
||||
tr->langopts.stress_rule = 8; // ?? 1st syllable if it is heavy, else 2nd syllable
|
||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
|
||||
tr->langopts.numbers = NUM_OMIT_1_HUNDRED;
|
||||
tr->langopts.break_numbers = 0x9999998;
|
||||
tr->langopts.max_digits = 20;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
+2
-1
@@ -3206,7 +3206,8 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
|
||||
break;
|
||||
|
||||
*pn++ = c;
|
||||
if((--nx > 0) && (tr->langopts.break_numbers & (1 << nx)))
|
||||
nx--;
|
||||
if((nx > 0) && (tr->langopts.break_numbers & (1 << nx)))
|
||||
{
|
||||
memcpy(&num_wtab[nw++], &words[ix], sizeof(WORD_TAB)); // copy the 'words' entry for each word of numbers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user