Lang=hr, transliterate Cyrillic characters to Latin using TranslateChar().

TranslateChar() can now substitute a character by two replacement characters.
Lang=cs, more difference between long and short vowels, less length differnence beteeen stressed and unstressed syllables.


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@7 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2007-05-10 15:11:22 +00:00
parent 4a11084bd5
commit e24c5b339d
52 changed files with 448 additions and 198 deletions
+50 -10
View File
@@ -241,8 +241,8 @@ Translator *SelectTranslator(const char *name)
case L('h','i'):
{
static const char dev_consonants2[] = {0x02,0x03,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f};
static wchar_t replace_chars_hi[11] = {0x966,0x967,0x968,0x969,0x96a,0x96b,0x96c,0x96d,0x96e,0x96f,0}; // digits 0-9
static wchar_t replacement_chars_hi[11] = {0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0};
static const wchar_t replace_chars_hi[11] = {0x966,0x967,0x968,0x969,0x96a,0x96b,0x96c,0x96d,0x96e,0x96f,0}; // digits 0-9
static const unsigned int replacement_chars_hi[11] = {0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0};
static int stress_lengths_hi[8] = {190, 190, 210, 210, 0, 0, 230, 250};
static int stress_amps_hi[8] = {17,14, 20,20, 20,24, 24,22 };
@@ -269,8 +269,8 @@ Translator *SelectTranslator(const char *name)
{
static int stress_amps_hu[8] = {16,16, 20,20, 20,24, 24,22 };
static int stress_lengths_hu[8] = {180,150, 200,180, 0,0, 230,270};
static wchar_t replace_chars_hu[] = {0xd4,0xf4,0xdb,0xfb,0};
static wchar_t replacement_chars_hu[] = {0x150,0x151,0x170,0x171,0}; // allow o,u-circumflex for o,u-double-acute
static const wchar_t 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
tr = new Translator();
SetupTranslator(tr,stress_lengths_hu,stress_amps_hu);
@@ -290,6 +290,26 @@ Translator *SelectTranslator(const char *name)
}
break;
case L('i','s'): // Icelandic
{
static int stress_amps_is[] = {16,16, 20,20, 20,24, 24,22 };
static int stress_lengths_is[8] = {180,140, 200,200, 0,0, 240,260};
static const wchar_t is_L08[] = {'c','f','h','k','p','s','t','x',0xfe,0}; // voiceless conants, including 'þ'
tr = new Translator();
SetupTranslator(tr,stress_lengths_is,stress_amps_is);
tr->langopts.stress_rule = 1;
tr->langopts.param[LOPT_IT_LENGTHEN] = 0x11; // remove lengthen indicator from unstressed vowels
SetLetterBits(tr,4,"kpst"); // Letter group F
SetLetterBits(tr,3,"jvr"); // Letter group H
tr->letter_groups[8] = is_L08;
SetLetterVowel(tr,'y');
tr->langopts.numbers = 0xe9;
tr->langopts.numbers2 = 0x2;
}
break;
case L('i','t'): // Italian
{
static int stress_lengths_it[8] = {150, 140, 180, 180, 0, 0, 270, 320};
@@ -378,8 +398,8 @@ Translator *SelectTranslator(const char *name)
{
static int stress_lengths_ro[8] = {170, 170, 180, 180, 0, 0, 240, 260};
static int stress_amps_ro[8] = {15,13, 18,18, 20,22, 22,22 };
static wchar_t replace_chars_ro[5] = {0x218,0x219,0x21a,0x21b,0};
static wchar_t replacement_chars_ro[5] = {0x15e,0x15f,0x162,0x163,0}; // replace s-comma, t-comma by s-cedilla, t-cedilla
static const wchar_t replace_chars_ro[5] = {0x218,0x219,0x21a,0x21b,0};
static const unsigned int replacement_chars_ro[5] = {0x15e,0x15f,0x162,0x163,0}; // replace s-comma, t-comma by s-cedilla, t-cedilla
tr = new Translator();
SetupTranslator(tr,stress_lengths_ro,stress_amps_ro);
@@ -403,9 +423,24 @@ Translator *SelectTranslator(const char *name)
case L('c','s'): // Czech
case L('h','r'): // Croatian
{
static const wchar_t replace_chars_hr[] =
{0x430,0x431,0x446,0x45b,0x447,0x434,0x452,0x45f,
0x435,0x444,0x433,0x445,0x438,0x458,0x43a,0x43b,
0x459,0x43c,0x43d,0x45a,0x43e,0x43f,0x440,0x441,
0x448,0x442,0x443,0x432,0x437,0x436,
0x453,0x455,0x45c,0}; // ѓ ѕ ќ
static const unsigned int replacement_chars_hr[] =
{'a','b','c',0x107,0x10d,'d',0x111,'d'+(0x17e<<16),
'e','f','g','h','i','j','k','l',
'l'+('j'<<16),'m','n','n'+('j'<<16),'o','p','r','s',
0x161,'t','u','v','z',0x17e,
0x111,'d'+('z'<<16),0x107,0};
static int stress_amps_sk[8] = {16,16, 20,20, 20,24, 24,22 };
static int stress_lengths_sk[8] = {180,180, 200,180, 0,0, 220,230};
static char *sk_voiced = "bdgjlmnrvwzaeiouy";
// static int stress_lengths_sk[8] = {180,180, 200,200, 0,0, 210,220};
static int stress_lengths_sk[8] = {190,190, 210,210, 0,0, 210,210};
static char *sk_voiced = "bdgjlmnrvwzaeiouy";
tr = new Translator();
SetupTranslator(tr,stress_lengths_sk,stress_amps_sk);
@@ -420,7 +455,12 @@ Translator *SelectTranslator(const char *name)
tr->langopts.numbers = 0x1c0d + 0x84000;
if(name2 == L('h','r'))
{
tr->langopts.numbers2 = 0xa; // variant numbers before thousands,milliards
tr->langopts.replace_chars = replace_chars_hr;
tr->langopts.replacement_chars = replacement_chars_hr;
}
if(name2 == L('c','s'))
tr->langopts.numbers2 = 0x8; // variant numbers before milliards
@@ -835,8 +875,8 @@ Translator_Afrikaans::Translator_Afrikaans() : Translator()
}
int Translator_Afrikaans::TranslateChar(char *ptr, int prev_in, int c, int next_in)
{//===============================================================================
int Translator_Afrikaans::TranslateChar(char *ptr, int prev_in, int c, int next_in, int *insert)
{//=============================================================================================
// look for 'n and replace by a special character (unicode: schwa)
if(!iswalpha(prev_in))