mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-10 08:13:55 +00:00
[1.26.03] Priority stress [''] reduces other primary stress to secondary not unstressed (except lang=pt).
Add short pause between [*] and a fricative. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@44 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+6
-2
@@ -3,12 +3,15 @@
|
||||
// This file is UTF-8 encoded
|
||||
// all words lower case
|
||||
|
||||
// Alphabet
|
||||
// Α α, Β β, Γ γ, Δ δ, Ε ε, Ζ ζ, Η η, Θ θ, Ι ι, Κ κ, Λ λ, Μ μ, Ν ν, Ξ ξ,
|
||||
// Ο ο, Π π, Ρ ρ, Σ σ ς (word-final form), Τ τ, Υ υ, Φ φ, Χ χ, Ψ ψ, Ω ω.
|
||||
|
||||
// Letter group B: θ κ ξ π ς σ τ φ χ (voiceless consonants)
|
||||
// Letter group Y: ε η ι υ έ ή ί ύ (front vowels).
|
||||
|
||||
.L01 αι ε ι η υ οι ει αί έ ί ή ύ οί εί
|
||||
|
||||
|
||||
.group α
|
||||
α a
|
||||
@@ -32,13 +35,14 @@
|
||||
A) γγ Ng
|
||||
A) γκ Ng
|
||||
γ (χ N
|
||||
γ (L01 j
|
||||
γαι (A j
|
||||
γε (A j
|
||||
γει (A j
|
||||
γη (A j
|
||||
γι (A j
|
||||
γη (A j
|
||||
γυ (A j
|
||||
γοι (A j
|
||||
γει (A j
|
||||
|
||||
.group δ
|
||||
δ D
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -646,6 +646,7 @@ endphoneme
|
||||
|
||||
phoneme * // flap
|
||||
vcd alv flp
|
||||
brkafter
|
||||
vowelout f1=3 f2=1500 -400 300 f3=-200 80 rms=35 len=50
|
||||
vowelin f1=0 f2=1500 -300 300 f3=-200 80 rms=20
|
||||
formants d/tap3+r3/rx%200
|
||||
|
||||
@@ -239,6 +239,7 @@ static keywtab_t keywords[] = {
|
||||
{"vowel2", 0x2000000+phVOWEL2},
|
||||
{"palatal", 0x2000000+phPALATAL},
|
||||
{"long", 0x2000000+phLONG},
|
||||
{"brkafter", 0x2000000+phBRKAFTER},
|
||||
|
||||
// voiced / unvoiced
|
||||
{"vcd", 0x2000000+phVOICED},
|
||||
|
||||
+29
-12
@@ -715,8 +715,8 @@ void SetLetterBitsRange(Translator *tr, int group, int first, int last)
|
||||
|
||||
|
||||
|
||||
int GetVowelStress(unsigned char *phonemes, unsigned char *vowel_stress, int &vowel_count, int &stressed_syllable)
|
||||
{//===============================================================================================================
|
||||
static int GetVowelStress(Translator *tr, unsigned char *phonemes, unsigned char *vowel_stress, int &vowel_count, int &stressed_syllable)
|
||||
{//======================================================================================================================================
|
||||
|
||||
unsigned char phcode;
|
||||
PHONEME_TAB *ph;
|
||||
@@ -825,7 +825,12 @@ int GetVowelStress(unsigned char *phonemes, unsigned char *vowel_stress, int &vo
|
||||
for(ix=1; ix<count; ix++)
|
||||
{
|
||||
if(vowel_stress[ix] == 4)
|
||||
vowel_stress[ix] = 0;
|
||||
{
|
||||
if(tr->langopts.stress_flags & 0x20000)
|
||||
vowel_stress[ix] = 0;
|
||||
else
|
||||
vowel_stress[ix] = 3;
|
||||
}
|
||||
|
||||
if(vowel_stress[ix] == 5)
|
||||
{
|
||||
@@ -847,8 +852,8 @@ static char stress_phonemes[] = {phonSTRESS_U, phonSTRESS_D, phonSTRESS_2, phonS
|
||||
phonSTRESS_P, phonSTRESS_TONIC, phonSTRESS_TONIC};
|
||||
|
||||
|
||||
void ChangeWordStress(char *word, int new_stress)
|
||||
{//==============================================
|
||||
void ChangeWordStress(Translator *tr, char *word, int new_stress)
|
||||
{//==============================================================
|
||||
int ix;
|
||||
unsigned char *p;
|
||||
int max_stress;
|
||||
@@ -858,7 +863,7 @@ void ChangeWordStress(char *word, int new_stress)
|
||||
unsigned char vowel_stress[N_WORD_PHONEMES/2];
|
||||
|
||||
strcpy((char *)phonetic,word);
|
||||
max_stress = GetVowelStress(phonetic,vowel_stress,vowel_count,stressed_syllable);
|
||||
max_stress = GetVowelStress(tr, phonetic,vowel_stress,vowel_count,stressed_syllable);
|
||||
|
||||
if(new_stress >= 4)
|
||||
{
|
||||
@@ -971,7 +976,7 @@ void Translator::SetWordStress(char *output, unsigned int dictionary_flags, int
|
||||
unstressed_word = 1;
|
||||
}
|
||||
|
||||
max_stress = GetVowelStress(phonetic,vowel_stress,vowel_count,stressed_syllable);
|
||||
max_stress = GetVowelStress(this,phonetic,vowel_stress,vowel_count,stressed_syllable);
|
||||
|
||||
// heavy or light syllables
|
||||
ix = 1;
|
||||
@@ -2159,8 +2164,8 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
|
||||
|
||||
|
||||
|
||||
int Translator::TranslateRules(char *p, char *phonemes, int ph_size, char *end_phonemes, int word_flags, int dict_flags)
|
||||
{//=====================================================================================================================
|
||||
int Translator::TranslateRules(char *p_start, char *phonemes, int ph_size, char *end_phonemes, int word_flags, int dict_flags)
|
||||
{//===========================================================================================================================
|
||||
/* Translate a word bounded by space characters
|
||||
Append the result to 'phonemes' and any standard prefix/suffix in 'end_phonemes' */
|
||||
|
||||
@@ -2175,11 +2180,13 @@ int Translator::TranslateRules(char *p, char *phonemes, int ph_size, char *end_p
|
||||
int g1; /* first group for this letter */
|
||||
int n;
|
||||
int letter;
|
||||
int ix;
|
||||
int digit_count=0;
|
||||
char *p_start;
|
||||
char *p;
|
||||
MatchRecord match1;
|
||||
MatchRecord match2;
|
||||
char ph_buf[40];
|
||||
char word_copy[N_WORD_BYTES];
|
||||
static const char str_pause[2] = {phonPAUSE_NOLINK,0};
|
||||
|
||||
char group_name[4];
|
||||
@@ -2187,13 +2194,21 @@ int Translator::TranslateRules(char *p, char *phonemes, int ph_size, char *end_p
|
||||
if(data_dictrules == NULL)
|
||||
return(0);
|
||||
|
||||
for(ix=0; ix<(N_WORD_BYTES-1);)
|
||||
{
|
||||
c = p_start[ix];
|
||||
word_copy[ix++] = c;
|
||||
}
|
||||
word_copy[ix] = 0;
|
||||
|
||||
|
||||
#ifdef LOG_TRANSLATE
|
||||
if((option_phonemes == 2) && ((word_flags & FLAG_NO_TRACE)==0))
|
||||
{
|
||||
char wordbuf[120];
|
||||
int ix;
|
||||
|
||||
for(ix=0; ((c = p[ix]) != ' ') && (c != 0); ix++)
|
||||
for(ix=0; ((c = p_start[ix]) != ' ') && (c != 0); ix++)
|
||||
{
|
||||
wordbuf[ix] = c;
|
||||
}
|
||||
@@ -2202,7 +2217,7 @@ int Translator::TranslateRules(char *p, char *phonemes, int ph_size, char *end_p
|
||||
}
|
||||
#endif
|
||||
|
||||
p_start = p;
|
||||
p = p_start;
|
||||
word_vowel_count = 0;
|
||||
word_stressed_count = 0;
|
||||
|
||||
@@ -2357,6 +2372,7 @@ int Translator::TranslateRules(char *p, char *phonemes, int ph_size, char *end_p
|
||||
match1.end_type |= p - p_start;
|
||||
}
|
||||
strcpy(end_phonemes,match1.phonemes);
|
||||
memcpy(p_start,word_copy,strlen(word_copy));
|
||||
return(match1.end_type);
|
||||
}
|
||||
}
|
||||
@@ -2368,6 +2384,7 @@ int Translator::TranslateRules(char *p, char *phonemes, int ph_size, char *end_p
|
||||
|
||||
// any language specific changes ?
|
||||
ApplySpecialAttribute(phonemes,dict_flags);
|
||||
memcpy(p_start,word_copy,strlen(word_copy));
|
||||
return(0);
|
||||
} /* end of TranslateRules */
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#define phPALATAL 0x200
|
||||
#define phLONG 0x1000
|
||||
#define phAPPENDPH 0x2000 // always insert another phoneme (link_out) after this one
|
||||
#define phBRKAFTER 0x4000 // [*] add a post-pause
|
||||
|
||||
#define phALTERNATIVE 0x0c00 // bits 10,11 specifying use of alternative_ph
|
||||
#define phBEFOREVOWEL 0x0000
|
||||
|
||||
+4
-1
@@ -300,7 +300,7 @@ void Translator::CalcLengths()
|
||||
if(next->type==phVOWEL)
|
||||
{
|
||||
pre_voiced = 1;
|
||||
}
|
||||
} // drop through
|
||||
case phFRICATIVE:
|
||||
if(p->newword)
|
||||
p->prepause = 15;
|
||||
@@ -308,6 +308,9 @@ void Translator::CalcLengths()
|
||||
if(next->type==phPAUSE && prev->type==phNASAL && !(p->ph->phflags&phFORTIS))
|
||||
p->prepause = 25;
|
||||
|
||||
if(prev->ph->phflags & phBRKAFTER)
|
||||
p->prepause = 30;
|
||||
|
||||
if((p->ph->phflags & phSIBILANT) && next->type==phSTOP && !next->newword)
|
||||
{
|
||||
if(prev->type == phVOWEL)
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.26.02 11.Jun.07";
|
||||
const char *version_string = "1.26.03 12.Jun.07";
|
||||
const int version_phdata = 0x012601;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
@@ -451,7 +451,7 @@ Translator *SelectTranslator(const char *name)
|
||||
|
||||
// tr->langopts.vowel_pause = 1;
|
||||
tr->langopts.stress_rule = 3; // stress on final syllable
|
||||
tr->langopts.stress_flags = 0x6 | 0x10;
|
||||
tr->langopts.stress_flags = 0x6 | 0x10 | 0x20000;
|
||||
tr->langopts.numbers = 0xa69 + 0x2000;
|
||||
tr->punct_to_tone[0][3] = 2; // use exclamation intonation
|
||||
SetLetterVowel(tr,'y');
|
||||
|
||||
+2
-2
@@ -965,11 +965,11 @@ strcpy(phonemes2,phonemes);
|
||||
{
|
||||
// the word has attribute to stress or unstress when at end of clause
|
||||
if(dictionary_flags & (FLAG_STRESS_END | FLAG_STRESS_END2))
|
||||
ChangeWordStress(word_phonemes,4);
|
||||
ChangeWordStress(this,word_phonemes,4);
|
||||
// SetWordStress(word_phonemes,0,4,prev_last_stress);
|
||||
else
|
||||
if(dictionary_flags & FLAG_UNSTRESS_END)
|
||||
ChangeWordStress(word_phonemes,3);
|
||||
ChangeWordStress(this,word_phonemes,3);
|
||||
// SetWordStress(word_phonemes,0,3,prev_last_stress);
|
||||
}
|
||||
if(wflags & FLAG_STRESSED_WORD)
|
||||
|
||||
+2
-1
@@ -263,6 +263,7 @@ typedef struct {
|
||||
// bit13= If there is only one syllable before the primary stress, give it a secondary stress
|
||||
// bit15= Give stress to the first unstressed syllable
|
||||
// bit16= Don't diminish consecutive syllables within a word.
|
||||
// bit17= "priority" stress reduces other primary stress to "unstressed" not "secondary"
|
||||
|
||||
int stress_flags;
|
||||
int unstressed_wd1; // stress for $u word of 1 syllable
|
||||
@@ -498,7 +499,7 @@ Translator *SelectTranslator(const char *name);
|
||||
int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, char *err_name);
|
||||
void LoadConfig(void);
|
||||
int PhonemeCode(unsigned int mnem);
|
||||
void ChangeWordStress(char *word, int new_stress);
|
||||
void ChangeWordStress(Translator *tr, char *word, int new_stress);
|
||||
int TransposeAlphabet(char *text, int offset, int min, int max);
|
||||
int utf8_in(int *c, char *buf, int backwards);
|
||||
int utf8_out(unsigned int c, char *buf);
|
||||
|
||||
Reference in New Issue
Block a user