mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-11 08:30:31 +00:00
Merge branch 'development'
This commit is contained in:
@@ -986,6 +986,18 @@ static const char *M_Variant(int value)
|
||||
{//====================================
|
||||
// returns M, or perhaps MA for some cases
|
||||
|
||||
if(translator->translator_name == L('l','t'))
|
||||
{
|
||||
// Lithuanian
|
||||
if((value % 10) == 1)
|
||||
return("0MA");
|
||||
if(((value % 10) == 0) || ((value % 100) > 10) && ((value % 100) < 20))
|
||||
{
|
||||
return("0MB");
|
||||
}
|
||||
return("0M");
|
||||
}
|
||||
|
||||
if((translator->langopts.numbers2 & 0x100) && (value >= 2) && (value <= 4))
|
||||
return("0MA"); // Czech, Slovak
|
||||
else
|
||||
|
||||
+7
-9
@@ -69,12 +69,6 @@ static int ssml_ignore_l_angle = 0;
|
||||
//static const char *tone_punct_on = "\0016T"; // add reverberation, lower pitch
|
||||
//static const char *tone_punct_off = "\001T\001P";
|
||||
|
||||
// ignore these characters
|
||||
static const unsigned short chars_ignore[] = {
|
||||
0x200c, // zero width non-joiner
|
||||
0x200d, // zero width joiner
|
||||
0 };
|
||||
|
||||
// punctuations symbols that can end a clause
|
||||
static const unsigned short punct_chars[] = {',','.','?','!',':',';',
|
||||
0x2013, // en-dash
|
||||
@@ -2392,10 +2386,14 @@ f_input = f_in; // for GetC etc
|
||||
c2 = ' ';
|
||||
}
|
||||
|
||||
if(lookupwchar(chars_ignore,c1))
|
||||
if((j = lookupwchar2(tr->chars_ignore,c1)) != 0)
|
||||
{
|
||||
// ignore this character (eg. zero-width-non-joiner U+200C)
|
||||
continue;
|
||||
if(j == 1)
|
||||
{
|
||||
// ignore this character (eg. zero-width-non-joiner U+200C)
|
||||
continue;
|
||||
}
|
||||
c1 = j; // replace the character
|
||||
}
|
||||
|
||||
if(c1 == 0xf0b)
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.46.19 27.Jun.12";
|
||||
const char *version_string = "1.46.20 15.Jul.12";
|
||||
const int version_phdata = 0x014600;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
@@ -111,6 +111,18 @@ static void SetLetterBitsRange(Translator *tr, int group, int first, int last)
|
||||
}
|
||||
}
|
||||
|
||||
// ignore these characters
|
||||
static const unsigned short chars_ignore_default[] = {
|
||||
0x200c, 1, // zero width non-joiner
|
||||
0x200d, 1, // zero width joiner
|
||||
0, 0 };
|
||||
|
||||
// alternatively, ignore characters but allow zero-width-non-joiner (lang-fa)
|
||||
static const unsigned short chars_ignore_fa[] = {
|
||||
0x200c, 0x0605, // zero width non-joiner, replace with not-used Arabic character code
|
||||
0x200d, 1, // zero width joiner
|
||||
0, 0 };
|
||||
|
||||
|
||||
static Translator* NewTranslator(void)
|
||||
{//===================================
|
||||
@@ -122,6 +134,7 @@ static Translator* NewTranslator(void)
|
||||
static const wchar_t punct_in_word[2] = {'\'', 0}; // allow hyphen within words
|
||||
static const unsigned char default_tunes[6] = {0, 1, 2, 3, 0, 0};
|
||||
|
||||
|
||||
tr = (Translator *)Alloc(sizeof(Translator));
|
||||
if(tr == NULL)
|
||||
return(NULL);
|
||||
@@ -155,6 +168,7 @@ static Translator* NewTranslator(void)
|
||||
|
||||
tr->char_plus_apostrophe = empty_wstring;
|
||||
tr->punct_within_word = punct_in_word;
|
||||
tr->chars_ignore = chars_ignore_default;
|
||||
|
||||
for(ix=0; ix<8; ix++)
|
||||
{
|
||||
@@ -647,9 +661,13 @@ Translator *SelectTranslator(const char *name)
|
||||
|
||||
case L('f','a'): // Farsi
|
||||
{
|
||||
static const char fa_ZWNJ[] = {0x05, 0}; // use letter group G for ZWNJ U+200c
|
||||
tr->letter_bits_offset = OFFSET_ARABIC;
|
||||
tr->langopts.numbers = NUM_AND_UNITS | NUM_HUNDRED_AND;
|
||||
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
|
||||
|
||||
tr->chars_ignore = chars_ignore_fa;
|
||||
SetLetterBits(tr,LETTERGP_G,(char *)fa_ZWNJ);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -972,6 +990,20 @@ SetLengthMods(tr,3); // all equal
|
||||
}
|
||||
break;
|
||||
|
||||
case L('l','t'): // Lithuanian
|
||||
{
|
||||
tr->charset_a0 = charsets[4]; // ISO-8859-4
|
||||
tr->langopts.stress_rule = STRESSPOSN_2R;
|
||||
tr->langopts.stress_flags = 0x20;
|
||||
tr->langopts.unstressed_wd1 = 0;
|
||||
tr->langopts.unstressed_wd2 = 2;
|
||||
tr->langopts.param[LOPT_DIERESES] = 1;
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_4 | NUM_ORDINAL_DOT;
|
||||
tr->langopts.numbers2 = 0x100;
|
||||
tr->langopts.max_roman = 5000;
|
||||
}
|
||||
break;
|
||||
|
||||
case L('l','v'): // latvian
|
||||
{
|
||||
static const unsigned char stress_amps_lv[8] = {17,13, 20,20, 20,22, 22,21 };
|
||||
|
||||
@@ -392,6 +392,9 @@ int IsAlpha(unsigned int c)
|
||||
return(0);
|
||||
}
|
||||
|
||||
if(c == 0x0605)
|
||||
return(1);
|
||||
|
||||
if((c >= 0x64b) && (c <= 0x65e))
|
||||
return(1); // arabic vowel marks
|
||||
|
||||
@@ -467,6 +470,22 @@ int lookupwchar(const unsigned short *list,int c)
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int lookupwchar2(const unsigned short *list,int c)
|
||||
{//==============================================
|
||||
// Replace character c by another character.
|
||||
// Returns 0 = not found, 1 = delete character
|
||||
int ix;
|
||||
|
||||
for(ix=0; list[ix] != 0; ix+=2)
|
||||
{
|
||||
if(list[ix] == c)
|
||||
return(list[ix+1]);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int IsBracket(int c)
|
||||
{//=================
|
||||
if((c >= 0x2014) && (c <= 0x201f))
|
||||
|
||||
+3
-1
@@ -29,7 +29,7 @@
|
||||
#define N_RULE_GROUP2 120 // max num of two-letter rule chains
|
||||
#define N_HASH_DICT 1024
|
||||
#define N_CHARSETS 20
|
||||
#define N_LETTER_GROUPS 26
|
||||
#define N_LETTER_GROUPS 95 // maximum is 127-32
|
||||
|
||||
|
||||
/* dictionary flags, word 1 */
|
||||
@@ -520,6 +520,7 @@ typedef struct
|
||||
const unsigned short *charset_a0; // unicodes for characters 0xa0 to oxff
|
||||
const wchar_t *char_plus_apostrophe; // single chars + apostrophe treated as words
|
||||
const wchar_t *punct_within_word; // allow these punctuation characters within words
|
||||
const unsigned short *chars_ignore;
|
||||
|
||||
// holds properties of characters: vowel, consonant, etc for pronunciation rules
|
||||
unsigned char letter_bits[256];
|
||||
@@ -632,6 +633,7 @@ int utf8_in2(int *c, const char *buf, int backwards);
|
||||
int utf8_out(unsigned int c, char *buf);
|
||||
int utf8_nbytes(const char *buf);
|
||||
int lookupwchar(const unsigned short *list,int c);
|
||||
int lookupwchar2(const unsigned short *list,int c);
|
||||
int Eof(void);
|
||||
char *strchr_w(const char *s, int c);
|
||||
int IsBracket(int c);
|
||||
|
||||
Reference in New Issue
Block a user