mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 21:39:47 +00:00
[1.47.07b]
Reinstate language "az" (Azerbaijani) as a test voice. Language changes: ga, hy, pt, sk. Generate character names for subscript and superscript letters and digits. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@347 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+29
-18
@@ -520,7 +520,7 @@ void DecodePhonemes(const char *inptr, char *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,0x29f,0x271,0x14b,0x254,
|
||||
0x259,0x251,0x3b2,0xe7,0xf0,0x25b,0x46,0x262,0x127,0x26a,0x25f,0x4b,0x26b,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
|
||||
@@ -629,10 +629,13 @@ char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int
|
||||
|
||||
|
||||
|
||||
void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa)
|
||||
{//=========================================================================
|
||||
/* Can be called after a clause has been translated into phonemes, in order
|
||||
void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int phoneme_mode)
|
||||
{//===============================================================================
|
||||
/* Called after a clause has been translated into phonemes, in order
|
||||
to display the clause in phoneme mnemonic form.
|
||||
|
||||
phoneme_mode bits 0-3: 0=only phoneme names, 1=ties, 2=ZWJ, 3=underscore separator
|
||||
bit 4: 0=eSpeak phoneme names, 1=IPA
|
||||
*/
|
||||
|
||||
int ix;
|
||||
@@ -645,6 +648,8 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa)
|
||||
char *buf;
|
||||
int count;
|
||||
int flags;
|
||||
int use_ipa;
|
||||
int use_tie;
|
||||
int separate_phonemes = 0;
|
||||
char phon_buf[30];
|
||||
char phon_buf2[30];
|
||||
@@ -653,15 +658,16 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa)
|
||||
static const char *stress_chars = "==,,''";
|
||||
static const int char_tie[] = {0x0361, 0x200d}; // combining-double-inverted-breve, zero-width-joiner
|
||||
|
||||
if(use_ipa >= 4)
|
||||
use_ipa = phoneme_mode & 0x10;
|
||||
use_tie = phoneme_mode & 0x0f;
|
||||
|
||||
if(use_tie >= 3)
|
||||
{
|
||||
// separate individual phonemes with underscores
|
||||
separate_phonemes = '_';
|
||||
if(use_ipa == 5)
|
||||
use_ipa = 0;
|
||||
else
|
||||
use_ipa = 1;
|
||||
use_tie = 0;
|
||||
}
|
||||
|
||||
if(phon_out != NULL)
|
||||
{
|
||||
for(ix=1; ix<(n_phoneme_list-2); ix++)
|
||||
@@ -669,13 +675,19 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa)
|
||||
buf = phon_buf;
|
||||
|
||||
plist = &phoneme_list[ix];
|
||||
|
||||
WritePhMnemonic(phon_buf2, plist->ph, plist, use_ipa, &flags);
|
||||
if(plist->newword)
|
||||
*buf++ = ' ';
|
||||
else
|
||||
{
|
||||
if((separate_phonemes != 0) && (ix > 1))
|
||||
{
|
||||
*buf++ = separate_phonemes;
|
||||
utf8_in(&c, phon_buf2);
|
||||
if((c < 0x2b0) || (c > 0x36f)) // not if the phoneme starts with a superscript letter
|
||||
{
|
||||
*buf++ = separate_phonemes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -707,17 +719,16 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa)
|
||||
}
|
||||
|
||||
flags = 0;
|
||||
WritePhMnemonic(phon_buf2, plist->ph, plist, use_ipa, &flags);
|
||||
count = 0;
|
||||
for(p=phon_buf2; *p != 0;)
|
||||
{
|
||||
p += utf8_in(&c, p);
|
||||
if(use_ipa > 1)
|
||||
if(use_tie > 0)
|
||||
{
|
||||
// look for non-inital alphabetic character, but not diacritic, superscript etc.
|
||||
if((count>0) && !(flags & (1 << (count-1))) && ((c < 0x2b0) || (c > 0x36f)) && iswalpha(c))
|
||||
if((count>0) && !(flags & (1 << (count-1))) && ((c < 0x2b0) || (c > 0x36f)) && iswalpha2(c))
|
||||
{
|
||||
buf += utf8_out(char_tie[use_ipa-2], buf);
|
||||
buf += utf8_out(char_tie[use_tie-1], buf);
|
||||
}
|
||||
}
|
||||
buf += utf8_out(c, buf);
|
||||
@@ -923,7 +934,7 @@ int Unpronouncable(Translator *tr, char *word, int posn)
|
||||
break;
|
||||
}
|
||||
|
||||
if((c != '\'') && !iswalpha(c))
|
||||
if((c != '\'') && !iswalpha2(c))
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -2102,7 +2113,7 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
break;
|
||||
|
||||
case RULE_NONALPHA:
|
||||
if(!iswalpha(letter_w))
|
||||
if(!iswalpha2(letter_w))
|
||||
{
|
||||
add_points = (21-distance_right);
|
||||
post_ptr += letter_xbytes;
|
||||
@@ -2346,7 +2357,7 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
break;
|
||||
|
||||
case RULE_NONALPHA:
|
||||
if(!iswalpha(letter_w))
|
||||
if(!iswalpha2(letter_w))
|
||||
{
|
||||
add_points = (21-distance_right);
|
||||
pre_ptr -= letter_xbytes;
|
||||
@@ -2663,7 +2674,7 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
if(tr->letter_bits_offset > 0)
|
||||
{
|
||||
// not a Latin alphabet, switch to the default Latin alphabet language
|
||||
if((letter <= 0x241) && iswalpha(letter))
|
||||
if((letter <= 0x241) && iswalpha2(letter))
|
||||
{
|
||||
sprintf(phonemes,"%c%s",phonSWITCH,tr->langopts.ascii_language);
|
||||
return(0);
|
||||
|
||||
Reference in New Issue
Block a user