mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-21 11:31:00 +00:00
git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@96 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
@@ -1829,6 +1829,13 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
|
|||||||
match.points += (21-distance_right);
|
match.points += (21-distance_right);
|
||||||
post_ptr += letter_xbytes;
|
post_ptr += letter_xbytes;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if(langopts.tone_numbers)
|
||||||
|
{
|
||||||
|
// also match if there is no digit
|
||||||
|
match.points += (21-distance_right);
|
||||||
|
post_ptr--;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
failed = 1;
|
failed = 1;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+2
-2
@@ -105,12 +105,12 @@ void strncpy0(char *dest, const char *source, int size)
|
|||||||
void DisplayVoices(FILE *f_out, char *language)
|
void DisplayVoices(FILE *f_out, char *language)
|
||||||
{//============================================
|
{//============================================
|
||||||
int ix;
|
int ix;
|
||||||
char *p;
|
const char *p;
|
||||||
int len;
|
int len;
|
||||||
int count;
|
int count;
|
||||||
int scores = 0;
|
int scores = 0;
|
||||||
const espeak_VOICE *v;
|
const espeak_VOICE *v;
|
||||||
char *lang_name;
|
const char *lang_name;
|
||||||
char age_buf[12];
|
char age_buf[12];
|
||||||
const espeak_VOICE **voices;
|
const espeak_VOICE **voices;
|
||||||
espeak_VOICE voice_select;
|
espeak_VOICE voice_select;
|
||||||
|
|||||||
+10
-16
@@ -820,9 +820,9 @@ void Translator::CalcPitches_Tone(int clause_tone)
|
|||||||
PHONEME_TAB *prev2_tph; // 2 tones previous
|
PHONEME_TAB *prev2_tph; // 2 tones previous
|
||||||
PHONEME_LIST *prev_p;
|
PHONEME_LIST *prev_p;
|
||||||
|
|
||||||
int pitch_adjust = 13; // pitch gradient through the clause - inital value
|
int pitch_adjust = 10; // pitch gradient through the clause - inital value
|
||||||
int pitch_decrement = 3; // decrease by this for each stressed syllable
|
int pitch_decrement = 0; // decrease by this for each stressed syllable
|
||||||
int pitch_low = 0; // until it drops to this
|
int pitch_low = 10; // until it drops to this
|
||||||
int pitch_high = 10; // then reset to this
|
int pitch_high = 10; // then reset to this
|
||||||
|
|
||||||
p = &phoneme_list[0];
|
p = &phoneme_list[0];
|
||||||
@@ -912,7 +912,7 @@ void Translator::CalcPitches_Tone(int clause_tone)
|
|||||||
{
|
{
|
||||||
tone_ph = p->tone_ph;
|
tone_ph = p->tone_ph;
|
||||||
|
|
||||||
if(p->tone >= 0) // TEST, consider all syllables as stressed
|
if(p->tone != 1) // TEST, consider all syllables as stressed
|
||||||
{
|
{
|
||||||
if(ix == final_stressed)
|
if(ix == final_stressed)
|
||||||
{
|
{
|
||||||
@@ -925,21 +925,15 @@ void Translator::CalcPitches_Tone(int clause_tone)
|
|||||||
if(pitch_adjust <= pitch_low)
|
if(pitch_adjust <= pitch_low)
|
||||||
pitch_adjust = pitch_high;
|
pitch_adjust = pitch_high;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(tone_ph ==0)
|
if(tone_ph ==0)
|
||||||
{
|
|
||||||
tone_ph = phonDEFAULTTONE; // no tone specified, use default tone 1
|
|
||||||
p->tone_ph = tone_ph;
|
|
||||||
}
|
|
||||||
p->pitch1 = pitch_adjust + phoneme_tab[tone_ph]->start_type;
|
|
||||||
p->pitch2 = pitch_adjust + phoneme_tab[tone_ph]->end_type;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// what to do for unstressed syllables ?
|
tone_ph = phonDEFAULTTONE; // no tone specified, use default tone 1
|
||||||
p->pitch1 = 10; // temporary
|
p->tone_ph = tone_ph;
|
||||||
p->pitch2 = 14;
|
|
||||||
}
|
}
|
||||||
|
p->pitch1 = pitch_adjust + phoneme_tab[tone_ph]->start_type;
|
||||||
|
p->pitch2 = pitch_adjust + phoneme_tab[tone_ph]->end_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -135,12 +135,12 @@ void Free(void *ptr)
|
|||||||
void DisplayVoices(FILE *f_out, char *language)
|
void DisplayVoices(FILE *f_out, char *language)
|
||||||
{//============================================
|
{//============================================
|
||||||
int ix;
|
int ix;
|
||||||
char *p;
|
const char *p;
|
||||||
int len;
|
int len;
|
||||||
int count;
|
int count;
|
||||||
int scores = 0;
|
int scores = 0;
|
||||||
const espeak_VOICE *v;
|
const espeak_VOICE *v;
|
||||||
char *lang_name;
|
const char *lang_name;
|
||||||
char age_buf[12];
|
char age_buf[12];
|
||||||
const espeak_VOICE **voices;
|
const espeak_VOICE **voices;
|
||||||
espeak_VOICE voice_select;
|
espeak_VOICE voice_select;
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@
|
|||||||
#include "translate.h"
|
#include "translate.h"
|
||||||
#include "wave.h"
|
#include "wave.h"
|
||||||
|
|
||||||
const char *version_string = "1.29.15 01.Nov.07";
|
const char *version_string = "1.29.16 01.Nov.07";
|
||||||
const int version_phdata = 0x012901;
|
const int version_phdata = 0x012901;
|
||||||
|
|
||||||
int option_device_number = -1;
|
int option_device_number = -1;
|
||||||
|
|||||||
@@ -649,7 +649,7 @@ SetLengthMods(tr,3); // all equal
|
|||||||
case L('z','h'):
|
case L('z','h'):
|
||||||
{
|
{
|
||||||
static int stress_lengths_qaa[8] = {220,150, 230,230, 230,0, 230,250};
|
static int stress_lengths_qaa[8] = {220,150, 230,230, 230,0, 230,250};
|
||||||
static int stress_amps_qaa[] = {22,18, 22,22, 22,22, 22,22 };
|
static int stress_amps_qaa[] = {22,16, 22,22, 22,22, 22,22 };
|
||||||
tr = new Translator();
|
tr = new Translator();
|
||||||
SetupTranslator(tr,stress_lengths_qaa,stress_amps_qaa);
|
SetupTranslator(tr,stress_lengths_qaa,stress_amps_qaa);
|
||||||
|
|
||||||
|
|||||||
+21
-12
@@ -1664,6 +1664,7 @@ void *Translator::TranslateClause(FILE *f_text, const void *vp_input, int *tone_
|
|||||||
int next_word_flags;
|
int next_word_flags;
|
||||||
int embedded_count = 0;
|
int embedded_count = 0;
|
||||||
int letter_count = 0;
|
int letter_count = 0;
|
||||||
|
int space_inserted = 0;
|
||||||
char *word;
|
char *word;
|
||||||
char *p;
|
char *p;
|
||||||
int j, k;
|
int j, k;
|
||||||
@@ -1786,9 +1787,6 @@ void *Translator::TranslateClause(FILE *f_text, const void *vp_input, int *tone_
|
|||||||
utf8_in(&prev_in,&source[source_index-1],1); // prev_in = source[source_index-1];
|
utf8_in(&prev_in,&source[source_index-1],1); // prev_in = source[source_index-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prev_source_index == source_index)
|
|
||||||
char_inserted = 0; // have done an unget, so discard any character to be inserted
|
|
||||||
|
|
||||||
prev_source_index = source_index;
|
prev_source_index = source_index;
|
||||||
|
|
||||||
if(char_inserted)
|
if(char_inserted)
|
||||||
@@ -1846,7 +1844,7 @@ void *Translator::TranslateClause(FILE *f_text, const void *vp_input, int *tone_
|
|||||||
{
|
{
|
||||||
// break after the specified number of digits
|
// break after the specified number of digits
|
||||||
c = ' ';
|
c = ' ';
|
||||||
source_index = prev_source_index; // unget
|
space_inserted = 1;
|
||||||
count_sayas_digits = 0;
|
count_sayas_digits = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1856,13 +1854,16 @@ void *Translator::TranslateClause(FILE *f_text, const void *vp_input, int *tone_
|
|||||||
if(iswdigit(prev_out))
|
if(iswdigit(prev_out))
|
||||||
{
|
{
|
||||||
c = ' ';
|
c = ' ';
|
||||||
source_index = prev_source_index; // unget
|
space_inserted = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if((option_sayas2 & 0xf0) != 0x10)
|
if((option_sayas2 & 0xf0) != 0x10)
|
||||||
{
|
{
|
||||||
|
// speak as words
|
||||||
|
|
||||||
|
#ifdef deleted
|
||||||
if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out))
|
if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out))
|
||||||
{
|
{
|
||||||
// TESTING, explicit indication of stressed syllable by /2 after the word
|
// TESTING, explicit indication of stressed syllable by /2 after the word
|
||||||
@@ -1870,6 +1871,7 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
|
|||||||
source_index++;
|
source_index++;
|
||||||
c = ' ';
|
c = ' ';
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if((c == 0x92) || (c == 0xb4) || (c == 0x2019))
|
if((c == 0x92) || (c == 0xb4) || (c == 0x2019))
|
||||||
c = '\''; // 'microsoft' quote or sexed closing single quote - possibly used as apostrophe
|
c = '\''; // 'microsoft' quote or sexed closing single quote - possibly used as apostrophe
|
||||||
|
|
||||||
@@ -1897,7 +1899,7 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
c = ' '; // ensure we have an end-of-word terminator
|
c = ' '; // ensure we have an end-of-word terminator
|
||||||
source_index = prev_source_index;
|
space_inserted = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1906,7 +1908,7 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
|
|||||||
if(!iswdigit(c) && (c != '.') && (c != ','))
|
if(!iswdigit(c) && (c != '.') && (c != ','))
|
||||||
{
|
{
|
||||||
c = ' '; // terminate digit string with a space
|
c = ' '; // terminate digit string with a space
|
||||||
source_index = prev_source_index;
|
space_inserted = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1934,7 +1936,7 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
|
|||||||
{
|
{
|
||||||
// start of word, insert space if not one there already
|
// start of word, insert space if not one there already
|
||||||
c = ' ';
|
c = ' ';
|
||||||
source_index = prev_source_index; // unget
|
space_inserted = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1960,8 +1962,8 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
|
|||||||
if(iswlower(prev_in))
|
if(iswlower(prev_in))
|
||||||
{
|
{
|
||||||
c = ' '; // lower case followed by upper case, treat as new word
|
c = ' '; // lower case followed by upper case, treat as new word
|
||||||
|
space_inserted = 1;
|
||||||
prev_in2 = c;
|
prev_in2 = c;
|
||||||
source_index = prev_source_index; // unget
|
|
||||||
}
|
}
|
||||||
//#ifdef deleted
|
//#ifdef deleted
|
||||||
// changed to break after the last uppercase letter, not before. See below
|
// changed to break after the last uppercase letter, not before. See below
|
||||||
@@ -1970,8 +1972,8 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
|
|||||||
(memcmp(&source[source_index],"s ",2) != 0)) // ENGLISH specific plural
|
(memcmp(&source[source_index],"s ",2) != 0)) // ENGLISH specific plural
|
||||||
{
|
{
|
||||||
c = ' '; // change from upper to lower case, start new word at the last uppercase
|
c = ' '; // change from upper to lower case, start new word at the last uppercase
|
||||||
|
space_inserted = 1;
|
||||||
prev_in2 = c;
|
prev_in2 = c;
|
||||||
source_index = prev_source_index; // unget
|
|
||||||
next_word_flags |= FLAG_NOSPACE;
|
next_word_flags |= FLAG_NOSPACE;
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
@@ -1984,8 +1986,8 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
|
|||||||
{
|
{
|
||||||
// change to break after the last uppercase letter, not before.
|
// change to break after the last uppercase letter, not before.
|
||||||
c = ' '; // more than one upper case followed by lower case, treat as new word
|
c = ' '; // more than one upper case followed by lower case, treat as new word
|
||||||
|
space_inserted = 1;
|
||||||
prev_in2 = c;
|
prev_in2 = c;
|
||||||
source_index = prev_source_index; // unget
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if((all_upper_case) && (letter_count > 2))
|
if((all_upper_case) && (letter_count > 2))
|
||||||
@@ -2096,7 +2098,7 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
|
|||||||
if((prev_out != ' ') && !iswdigit(prev_out) && (prev_out != langopts.decimal_sep)) // TEST2
|
if((prev_out != ' ') && !iswdigit(prev_out) && (prev_out != langopts.decimal_sep)) // TEST2
|
||||||
{
|
{
|
||||||
c = ' ';
|
c = ' ';
|
||||||
source_index = prev_source_index;
|
space_inserted = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if((prev_out == ' ') && IsAlpha(sbuf[ix-2]) && !IsAlpha(prev_in))
|
if((prev_out == ' ') && IsAlpha(sbuf[ix-2]) && !IsAlpha(prev_in))
|
||||||
@@ -2110,6 +2112,13 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
|
|||||||
|
|
||||||
if(iswspace(c))
|
if(iswspace(c))
|
||||||
{
|
{
|
||||||
|
if(space_inserted)
|
||||||
|
{
|
||||||
|
source_index = prev_source_index; // rewind to the previous character
|
||||||
|
char_inserted = 0;
|
||||||
|
space_inserted = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(prev_out == ' ')
|
if(prev_out == ' ')
|
||||||
{
|
{
|
||||||
continue; // multiple spaces
|
continue; // multiple spaces
|
||||||
|
|||||||
Reference in New Issue
Block a user