mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-11 00:26:08 +00:00
[1.47.03e]
lang=zh: Fix: was speaking Chinese character names as character codes. lang=hr, sr: Fix: speak Cyrillic character names in the local langauge. Phoneme definitions: add new statement type "LengthAdd <signed number>". git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@335 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+2
-2
@@ -2866,8 +2866,8 @@ int CompilePhoneme(int compile_phoneme)
|
||||
break;
|
||||
|
||||
case i_ADD_LENGTH:
|
||||
value = NextItem(tSIGNEDNUMBER);
|
||||
*prog_out++ = (i_ADD_LENGTH << 8) + value/2;
|
||||
value = NextItem(tSIGNEDNUMBER) / 2;
|
||||
*prog_out++ = (i_ADD_LENGTH << 8) + (value & 0xff);
|
||||
DecThenCount();
|
||||
break;
|
||||
|
||||
|
||||
+20
-2
@@ -3469,16 +3469,34 @@ int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *f
|
||||
} // end of LookupDictList
|
||||
|
||||
|
||||
extern char word_phonemes[N_WORD_PHONEMES]; // a word translated into phoneme codes
|
||||
|
||||
int Lookup(Translator *tr, const char *word, char *ph_out)
|
||||
{//===================================================
|
||||
int found;
|
||||
unsigned int flags[2];
|
||||
int say_as;
|
||||
char *word1 = (char *)word;
|
||||
char text[80];
|
||||
|
||||
flags[0] = 0;
|
||||
flags[1] = FLAG_LOOKUP_SYMBOL;
|
||||
char *word1 = (char *)word;
|
||||
return(LookupDictList(tr, &word1, ph_out, flags, 0, NULL));
|
||||
found = LookupDictList(tr, &word1, ph_out, flags, FLAG_ALLOW_TEXTMODE, NULL);
|
||||
|
||||
if(flags[0] & FLAG_TEXTMODE)
|
||||
{
|
||||
say_as = option_sayas;
|
||||
option_sayas = 0; // don't speak replacement word as letter names
|
||||
text[0] = 0;
|
||||
strncpy0(&text[1], word1, sizeof(text));
|
||||
found = TranslateWord(tr, &text[1], 0, NULL, NULL);
|
||||
strcpy(ph_out, word_phonemes);
|
||||
option_sayas = say_as;
|
||||
}
|
||||
return(found);
|
||||
}
|
||||
|
||||
|
||||
int LookupFlags(Translator *tr, const char *word)
|
||||
{//==============================================
|
||||
char buf[100];
|
||||
|
||||
+1
-1
@@ -651,7 +651,7 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
|
||||
current_alphabet = alphabet;
|
||||
if((alphabet != NULL) && !(al_flags & AL_DONT_NAME) && (al_offset != translator->letter_bits_offset))
|
||||
{
|
||||
if((al_flags & AL_DONT_NAME) || (al_offset == translator->langopts.alt_alphabet))
|
||||
if((al_flags & AL_DONT_NAME) || (al_offset == translator->langopts.alt_alphabet) || (al_offset == translator->langopts.our_alphabet))
|
||||
{
|
||||
// don't say the alphabet name
|
||||
}
|
||||
|
||||
+11
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.47.03d 26.Mar.13";
|
||||
const char *version_string = "1.47.03e 29.Mar.13";
|
||||
const int version_phdata = 0x014701;
|
||||
|
||||
int option_device_number = -1;
|
||||
@@ -1032,6 +1032,16 @@ void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_
|
||||
phdata->pd_param[i_APPEND_PHONEME] = data;
|
||||
}
|
||||
else
|
||||
if(instn2 == i_ADD_LENGTH)
|
||||
{
|
||||
if(data & 0x80)
|
||||
{
|
||||
// a negative value, do sign extension
|
||||
data = -(0x100 - data);
|
||||
}
|
||||
phdata->pd_param[i_SET_LENGTH] += data;
|
||||
}
|
||||
else
|
||||
if(instn2 == i_IPA_NAME)
|
||||
{
|
||||
// followed by utf-8 characters, 2 per instn word
|
||||
|
||||
@@ -654,10 +654,10 @@ Translator *SelectTranslator(const char *name)
|
||||
|
||||
// character codes offset by 0x380
|
||||
static const char el_vowels[] = {0x10,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x35,0x37,0x39,0x3f,0x45,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0};
|
||||
static const char el_fvowels[] = {0x2d,0x2e,0x2f,0x35,0x37,0x39,0x45,0x4d,0}; // ε η ι υ έ ή ί ύ
|
||||
static const char el_voiceless[]= {0x38,0x3a,0x3e,0x40,0x42,0x43,0x44,0x46,0x47,0}; // θ κ ξ π ς σ τ φ χ
|
||||
static const char el_fvowels[] = {0x2d,0x2e,0x2f,0x35,0x37,0x39,0x45,0x4d,0}; // ε η ι υ έ ή ί ύ _
|
||||
static const char el_voiceless[]= {0x38,0x3a,0x3e,0x40,0x42,0x43,0x44,0x46,0x47,0}; // θ κ ξ π ς σ τ φ χ _
|
||||
static const char el_consonants[]={0x32,0x33,0x34,0x36,0x38,0x3a,0x3b,0x3c,0x3d,0x3e,0x40,0x41,0x42,0x43,0x44,0x46,0x47,0x48,0};
|
||||
static const wchar_t el_char_apostrophe[] = {0x3c3,0}; // σ
|
||||
static const wchar_t el_char_apostrophe[] = {0x3c3,0}; // σ _
|
||||
|
||||
SetupTranslator(tr,stress_lengths_el,stress_amps_el);
|
||||
|
||||
@@ -670,7 +670,7 @@ Translator *SelectTranslator(const char *name)
|
||||
SetLetterBits(tr,LETTERGP_VOWEL2,el_vowels);
|
||||
SetLetterBits(tr,LETTERGP_B,el_voiceless);
|
||||
SetLetterBits(tr,LETTERGP_C,el_consonants);
|
||||
SetLetterBits(tr,LETTERGP_Y,el_fvowels); // front vowels: ε η ι υ
|
||||
SetLetterBits(tr,LETTERGP_Y,el_fvowels); // front vowels: ε η ι υ _
|
||||
|
||||
tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
|
||||
tr->langopts.stress_rule = STRESSPOSN_2R;
|
||||
@@ -912,6 +912,7 @@ SetupTranslator(tr,stress_lengths_equal,stress_amps_equal);
|
||||
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_DECIMAL_COMMA | NUM_THOUS_SPACE | NUM_DFRACTION_2 | NUM_ROMAN_CAPITALS;
|
||||
tr->langopts.numbers2 = 0xa + NUM2_THOUSANDS_VAR5; // variant numbers before thousands,milliards
|
||||
tr->langopts.replace_chars = replace_cyrillic_latin;
|
||||
tr->langopts.our_alphabet = OFFSET_CYRILLIC; // don't say "cyrillic" before letter names
|
||||
|
||||
SetLetterVowel(tr,'y');
|
||||
SetLetterVowel(tr,'r');
|
||||
@@ -1113,6 +1114,7 @@ SetLengthMods(tr,3); // all equal
|
||||
static const unsigned char ko_voiced[] = {0x02,0x05,0x06,0xab,0xaf,0xb7,0xbc,0}; // voiced consonants, l,m,n,N
|
||||
|
||||
tr->letter_bits_offset = OFFSET_KOREAN;
|
||||
tr->langopts.our_alphabet = 0xa700;
|
||||
memset(tr->letter_bits,0,sizeof(tr->letter_bits));
|
||||
SetLetterBitsRange(tr,LETTERGP_A,0x61,0x75);
|
||||
SetLetterBits(tr,LETTERGP_Y,ko_ivowels);
|
||||
@@ -1194,6 +1196,7 @@ SetLengthMods(tr,3); // all equal
|
||||
SetupTranslator(tr,stress_lengths_mk,stress_amps_mk);
|
||||
tr->charset_a0 = charsets[5]; // ISO-8859-5
|
||||
tr->letter_groups[0] = tr->letter_groups[7] = vowels_cyrillic;
|
||||
tr->letter_bits_offset = OFFSET_CYRILLIC;
|
||||
|
||||
tr->langopts.stress_rule = STRESSPOSN_3R; // antipenultimate
|
||||
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_AND_UNITS | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_2;
|
||||
@@ -1608,6 +1611,7 @@ SetLengthMods(tr,3); // all equal
|
||||
tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
|
||||
tr->langopts.tone_numbers = 1; // a number after letters indicates a tone number (eg. pinyin or jyutping)
|
||||
tr->langopts.ideographs = 1;
|
||||
tr->langopts.our_alphabet = 0x3100;
|
||||
tr->langopts.word_gap = 0x21; // length of a final vowel is less dependent on the next consonant, don't merge consonant with next word
|
||||
if(name2 == L('z','h'))
|
||||
{
|
||||
|
||||
@@ -546,6 +546,7 @@ typedef struct {
|
||||
int listx; // compile *_listx after *list
|
||||
const unsigned int *replace_chars; // characters to be substitutes
|
||||
char ascii_language[8]; // switch to this language for Latin characters
|
||||
int our_alphabet; // offset for main alphabet (if not set in letter_bits_offset)
|
||||
int alt_alphabet; // offset for another language to recognize
|
||||
int alt_alphabet_lang; // language for the alt_alphabet
|
||||
int max_lengthmod;
|
||||
|
||||
Reference in New Issue
Block a user