[1.45.11]

lang=Turkish, fix pronunciation of suffixes, fix suffixes after names.

Windows: command option --stdout caused spurious 0x0d bytes to be included in speech output (CR/LF problem).

Fixed crash which could occur when a clause starts with a hyphen.

espeakedit: New input format for Bulgarian lexicon.

lang=de: Fix important pronunciation error (editing error) for "sage".


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@259 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2011-03-31 16:10:36 +00:00
parent 478fde1a20
commit 82b01c0336
29 changed files with 507 additions and 161 deletions
+3 -1
View File
@@ -75,7 +75,6 @@ CXXFLAGS=-O2
all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME)
mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG)
.cpp.o:
$(CXX) $(CXXFLAGS) $(USE_AUDIO) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -pedantic -I. -c -fno-exceptions $<
@@ -95,6 +94,9 @@ x_%.o: %.cpp
$(LIB_NAME): $(OBJS2)
$(CXX) $(LDFLAGS) -shared $(SONAME_OPT)$(LIB_NAME).$(LIB_VERSION) -o $@ \
$(OBJS2) $(LIBS2)
mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG)
$(LN_SF) $(LIB_NAME).$(LIBTAG) $(LIB_NAME).$(LIB_VERSION)
$(LN_SF) $(LIB_NAME).$(LIB_VERSION) $(LIB_NAME)
$(STATIC_LIB_NAME): $(OBJS2)
$(AR) cqs $(STATIC_LIB_NAME) $(OBJS2)
+8 -1
View File
@@ -114,6 +114,7 @@ static keywtab_t k_properties[] = {
{"isVowel", 0, phVOWEL},
{"isNasal", 0, phNASAL},
{"isLiquid", 0, phLIQUID},
{"isUStop", 0, phSTOP},
{"isVFricative", 0, phVFRICATIVE},
{"isPalatal", 0, i_isPalatal},
@@ -3205,7 +3206,10 @@ static void CompileEquivalents()
if((foreign_table = SelectPhonemeTableName(foreign_table_name)) < 0)
{
error("Unknown phoneme table '%s'", foreign_table_name);
if(strcmp(foreign_table_name, "NULL") != 0)
{
error("Unknown phoneme table '%s'", foreign_table_name);
}
foreign_error = 1;
foreign_phoneme = 0;
}
@@ -3234,6 +3238,9 @@ static void CompileEquivalents()
if(strcmp(names[0],"endphoneme") == 0)
break;
if(foreign_error)
continue;
if(strcmp(names[0],"remove_stress") == 0)
{
remove_stress = 1;
+1 -1
View File
@@ -1639,7 +1639,7 @@ static int compile_dictrules(FILE *f_in, FILE *f_out, char *fname_temp)
unsigned int char_code;
int compile_mode=0;
char *buf;
char buf1[200];
char buf1[500];
char *rules[N_RULES];
int n_rgroups = 0;
+3 -3
View File
@@ -781,8 +781,8 @@ static int Unpronouncable2(Translator *tr, char *word)
}
int Unpronouncable(Translator *tr, char *word)
{//===========================================
int Unpronouncable(Translator *tr, char *word, int posn)
{//=====================================================
/* Determines whether a word in 'unpronouncable', i.e. whether it should
be spoken as individual letters.
@@ -817,7 +817,7 @@ int Unpronouncable(Translator *tr, char *word)
if((c==0) || (c==' '))
break;
if((c=='\'') && (count > 1))
if((c=='\'') && ((count > 1) || (posn > 0)))
break; // "tv'" but not "l'"
if(count==0)
+20 -7
View File
@@ -913,6 +913,7 @@ void Lexicon_Bg()
char *pw;
char *pw1;
int cc;
int ix;
int vcount;
int lex_stress;
int input_length;
@@ -1006,22 +1007,27 @@ void Lexicon_Bg()
if(cc == 0xfeff)
continue; // ignore UTF-8 indication
pw1 += utf8_out(cc, pw1); // copy UTF-8 to 'word_in'
if(cc == '`')
cc = '\'';
pw1 += utf8_out(towlower(cc), pw1); // copy UTF-8 to 'word_in'
if(lookupwchar(bg_vowels, cc) != 0)
vcount++;
if((cc == 0x300) || (cc == 0x450) || (cc == 0x45d))
if((cc == '\'') || (cc == 0x300) || (cc == 0x450) || (cc == 0x45d))
{
// combining grave accent, of accented vowel character
lex_stress = vcount;
// backprime (before the vowel), combining grave accent, or accented vowel character
if(cc == '\'')
lex_stress = vcount+1;
else
lex_stress = vcount;
n_stress++;
if(vcount == 1)
stress_first = 1;
if(cc == 0x300)
continue; // discard combining accent
if((cc == '\'') || (cc == 0x300))
continue; // discard backprime or combining accent
if(cc == 0x450)
cc = 0x435; // remove accent from vowel
if(cc == 0x45d)
@@ -1062,7 +1068,14 @@ void Lexicon_Bg()
}
}
if(n_stress > 1) n_stress = 1;
done = 0;
if(vcount < 2)
{
// don't list words with only one vowel
}
else
if((lex_stress != max_stress_posn) || (n_stress != 1))
{
if((vcount > 0) && (lex_stress > 0) && (lex_stress <= 7))
@@ -1082,7 +1095,7 @@ void Lexicon_Bg()
if(done == 0)
{
n_wrong++;
fprintf(f_out,"%s\t$text %s\n", &word[2], word_in);
fprintf(f_out,"// %s\t$text %s\n", &word[2], word_in);
}
if(done)
+8
View File
@@ -27,6 +27,8 @@
#ifndef PLATFORM_DOS
#ifdef PLATFORM_WINDOWS
#include <fcntl.h>
#include <io.h>
#include <windows.h>
#include <winreg.h>
#else
@@ -234,7 +236,13 @@ static int OpenWaveFile(const char *path, int rate)
return(2);
if(strcmp(path,"stdout")==0)
{
#ifdef PLATFORM_WINDOWS
// prevent Windows adding 0x0d before 0x0a bytes
_setmode(_fileno(stdout), _O_BINARY);
#endif
f_wave = stdout;
}
else
f_wave = fopen(path,"wb");
+1 -1
View File
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.45.02 15.Mar.11";
const char *version_string = "1.45.11 31.Mar.11";
const int version_phdata = 0x014500;
int option_device_number = -1;
+28 -1
View File
@@ -308,14 +308,17 @@ void SetIndicLetters(Translator *tr)
memset(tr->letter_bits,0,sizeof(tr->letter_bits));
SetLetterBitsRange(tr,LETTERGP_A,0x04,0x14); // vowel letters
SetLetterBitsRange(tr,LETTERGP_A,0x3e,0x4d); // + vowel signs, and virama
SetLetterBitsRange(tr,LETTERGP_A,0x55,0x57); // + vowel signs
SetLetterBitsRange(tr,LETTERGP_B,0x3e,0x4d); // vowel signs, and virama
SetLetterBitsRange(tr,LETTERGP_B,0x55,0x57); // + vowel signs
SetLetterBitsRange(tr,LETTERGP_C,0x15,0x39); // the main consonant range
SetLetterBits(tr,LETTERGP_C,dev_consonants2); // + additional consonants
SetLetterBitsRange(tr,LETTERGP_Y,0x04,0x14); // vowel letters
SetLetterBitsRange(tr,LETTERGP_Y,0x3e,0x4c); // + vowel signs
SetLetterBitsRange(tr,LETTERGP_Y,0x55,0x57); // + vowel signs
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
tr->langopts.suffix_add_e = tr->letter_bits_offset + 0x4d; //virama
@@ -1090,6 +1093,30 @@ SetLengthMods(tr,3); // all equal
}
break;
case L('s','i'): // Sinhala
{
SetupTranslator(tr,stress_lengths_ta,stress_amps_ta);
tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
tr->langopts.stress_rule = STRESSPOSN_1L;
tr->langopts.stress_flags = S_FINAL_DIM | S_NO_AUTO_DIM | S_FINAL_NO_2;
tr->langopts.spelling_stress = 1;
tr->letter_bits_offset = OFFSET_SINHALA;
memset(tr->letter_bits,0,sizeof(tr->letter_bits));
SetLetterBitsRange(tr,LETTERGP_A,0x05,0x16); // vowel letters
SetLetterBitsRange(tr,LETTERGP_A,0x4a,0x73); // + vowel signs, and virama
SetLetterBitsRange(tr,LETTERGP_B,0x4a,0x73); // vowel signs, and virama
SetLetterBitsRange(tr,LETTERGP_C,0x1a,0x46); // the main consonant range
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
tr->langopts.suffix_add_e = tr->letter_bits_offset + 0x4a; //virama
tr->langopts.numbers = NUM_OMIT_1_THOUSAND ;
}
break;
case L('s','l'): // Slovenian
tr->charset_a0 = charsets[2]; // ISO-8859-2
tr->langopts.stress_rule = STRESSPOSN_2R; // Temporary
@@ -1223,7 +1250,7 @@ SetLengthMods(tr,3); // all equal
tr->langopts.stress_rule = 7; // stress on the last syllable, before any explicitly unstressed syllable
tr->langopts.stress_flags = 0x20; //no automatic secondary stress
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_2;
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_2;
tr->langopts.max_initial_consonants = 2;
}
break;
+36 -12
View File
@@ -386,6 +386,9 @@ int IsAlpha(unsigned int c)
return(1);
if(lookupwchar(extra_indic_alphas, c) != 0)
return(1);
if((c >= 0xd7a) && (c <= 0xd7f))
return(1); // malaytalam chillu characters
return(0);
}
@@ -577,6 +580,19 @@ char *strchr_w(const char *s, int c)
}
int IsAllUpper(const char *word)
{//=============================
int c;
while((*word != 0) && !isspace2(*word))
{
word += utf8_in(&c, word);
if(!iswupper(c))
return(0);
}
return(1);
}
static char *SpeakIndividualLetters(Translator *tr, char *word, char *phonemes, int spell_word)
{//============================================================================================
int posn = 0;
@@ -1022,7 +1038,7 @@ if((wmark > 0) && (wmark < 8))
length = 999;
wordx = word1;
while(((length < 3) && (length > 0))|| (word_length > 1 && Unpronouncable(tr,wordx)))
while(((length < 3) && (length > 0))|| (word_length > 1 && Unpronouncable(tr, wordx, posn)))
{
// This word looks "unpronouncable", so speak letters individually until we
// find a remainder that we can pronounce.
@@ -1176,20 +1192,26 @@ if((wmark > 0) && (wmark < 8))
if(prefix_type & SUFX_B)
{
// SUFX_B is used for Turkish, tr_rules contains "(Pb£
// retranslate the prefix part
// SUFX_B is used for Turkish, tr_rules contains " ' (Pb"
// examine the prefix part
char *wordpf;
char prefix_phonemes2[12];
strncpy0(prefix_phonemes2,end_phonemes,sizeof(prefix_phonemes2));
wordpf = &prefix_chars[1];
found = LookupDictList(tr, &wordpf, phonemes, dictionary_flags, SUFX_P, wtab); // without prefix
if(found == 0)
strcpy(prefix_phonemes, phonemes);
// look for stress marker or $abbrev
found = LookupDictList(tr, &wordpf, phonemes, dictionary_flags, 0, wtab);
if(found)
{
end_type = TranslateRules(tr, wordpf, phonemes, N_WORD_PHONEMES, end_phonemes, 0, dictionary_flags);
sprintf(prefix_phonemes,"%s%s%s",phonemes,end_phonemes,prefix_phonemes2);
strcpy(prefix_phonemes, phonemes);
}
if(dictionary_flags[0] & FLAG_ABBREV)
{
prefix_phonemes[0] = 0;
SpeakIndividualLetters(tr, wordpf, prefix_phonemes, 1);
}
prefix_flags = 1;
}
else
{
@@ -2772,7 +2794,8 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
{
// '-' between two letters is a hyphen, treat as a space
word_flags |= FLAG_HYPHEN;
words[word_count-1].flags |= FLAG_HYPHEN_AFTER;
if(word_count > 0)
words[word_count-1].flags |= FLAG_HYPHEN_AFTER;
c = ' ';
}
}
@@ -2809,7 +2832,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
space_inserted = 1;
}
else
if(!(words[word_count-1].flags & FLAG_NOSPACE) && IsAlpha(prev_in))
if((word_count > 0) && !(words[word_count-1].flags & FLAG_NOSPACE) && IsAlpha(prev_in))
{
// dot after a word, with space following, probably an abbreviation
words[word_count-1].flags |= FLAG_HAS_DOT;
@@ -2930,7 +2953,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
// end of 'word'
sbuf[ix++] = ' ';
if((ix > words[word_count].start) && (word_count < N_CLAUSE_WORDS-1))
if((word_count < N_CLAUSE_WORDS-1) && (ix > words[word_count].start))
{
if(embedded_count > 0)
{
@@ -3056,7 +3079,8 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
*pn++ = *pw++;
}
else
if((*pw == tr->langopts.thousands_sep) && (pw[1] == ' ') && iswdigit(pw[2]))
if((*pw == tr->langopts.thousands_sep) && (pw[1] == ' ')
&& iswdigit(pw[2]) && (pw[3] != ' ') && (pw[4] != ' ')) // don't allow only 1 or 2 digits in the final part
{
pw += 2;
ix++; // skip "word"
+1 -1
View File
@@ -658,7 +658,7 @@ void CalcLengths(Translator *tr);
void CalcPitches(Translator *tr, int clause_tone);
int RemoveEnding(Translator *tr, char *word, int end_type, char *word_copy);
int Unpronouncable(Translator *tr, char *word);
int Unpronouncable(Translator *tr, char *word, int posn);
void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags, int tonic, int prev_stress);
int TranslateRules(Translator *tr, char *p, char *phonemes, int size, char *end_phonemes, int end_flags, unsigned int *dict_flags);
int TranslateWord(Translator *tr, char *word1, int next_pause, WORD_TAB *wtab);
+4 -55
View File
@@ -80,9 +80,6 @@ static pa_context *context = NULL;
static pa_stream *stream = NULL;
static pa_threaded_mainloop *mainloop = NULL;
static pa_cvolume volume;
static int volume_valid = 0;
static int do_trigger = 0;
static uint64_t written = 0;
static int time_offset_msec = 0;
@@ -131,20 +128,7 @@ do { \
// SHOW("ti> read_index=0x%lx\n",the_time->read_index);
// }
static void info_cb(struct pa_context *c, const struct pa_sink_input_info *i, int is_last, void *userdata) {
ENTER(__FUNCTION__);
assert(c);
if (!i)
return;
volume = i->volume;
volume_valid = 1;
}
static void subscribe_cb(struct pa_context *c, enum pa_subscription_event_type t, uint32_t index, void *userdata) {
pa_operation *o;
ENTER(__FUNCTION__);
assert(c);
@@ -154,13 +138,6 @@ static void subscribe_cb(struct pa_context *c, enum pa_subscription_event_type t
(t != (PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE) &&
t != (PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_NEW)))
return;
if (!(o = pa_context_get_sink_input_info(c, index, info_cb, NULL))) {
SHOW("pa_context_get_sink_input_info() failed: %s\n", pa_strerror(pa_context_errno(c)));
return;
}
pa_operation_unref(o);
}
static void context_state_cb(pa_context *c, void *userdata) {
@@ -367,7 +344,7 @@ static void pulse_write(void* ptr, int length) {
SHOW("pulse_write > length=%d\n", length);
CHECK_CONNECTED();
CHECK_CONNECTED_NO_RETVAL();
pa_threaded_mainloop_lock(mainloop);
CHECK_DEAD_GOTO(fail, 1);
@@ -481,12 +458,6 @@ static int pulse_open()
if (!pa_sample_spec_valid(&ss))
return false;
/* if (!volume_valid) { */
pa_cvolume_reset(&volume, ss.channels);
volume_valid = 1;
/* } else if (volume.channels != ss.channels) */
/* pa_cvolume_set(&volume, ss.channels, pa_cvolume_avg(&volume)); */
SHOW_TIME("pa_threaded_mainloop_new (call)");
if (!(mainloop = pa_threaded_mainloop_new())) {
SHOW("Failed to allocate main loop\n","");
@@ -539,8 +510,6 @@ static int pulse_open()
pa_stream_set_write_callback(stream, stream_request_cb, NULL);
pa_stream_set_latency_update_callback(stream, stream_latency_update_cb, NULL);
pa_buffer_attr a_attr;
a_attr.maxlength = MAXLENGTH;
@@ -550,7 +519,7 @@ static int pulse_open()
a_attr.fragsize = 0;
SHOW_TIME("pa_connect_playback");
if (pa_stream_connect_playback(stream, NULL, &a_attr, (pa_stream_flags_t)(PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE), &volume, NULL) < 0) {
if (pa_stream_connect_playback(stream, NULL, &a_attr, (pa_stream_flags_t)(PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE), NULL, NULL) < 0) {
SHOW("Failed to connect stream: %s", pa_strerror(pa_context_errno(context)));
goto unlock_and_fail;
}
@@ -578,44 +547,24 @@ static int pulse_open()
pa_threaded_mainloop_wait(mainloop);
}
pa_operation_unref(o);
if (!success) {
SHOW("pa_context_subscribe() failed: %s", pa_strerror(pa_context_errno(context)));
goto unlock_and_fail;
}
pa_operation_unref(o);
/* Now request the initial stream info */
if (!(o = pa_context_get_sink_input_info(context, pa_stream_get_index(stream), info_cb, NULL))) {
SHOW("pa_context_get_sink_input_info() failed: %s", pa_strerror(pa_context_errno(context)));
goto unlock_and_fail;
}
SHOW_TIME("pa_threaded_mainloop_wait 2");
while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
CHECK_DEAD_GOTO(fail, 1);
pa_threaded_mainloop_wait(mainloop);
}
/* if (!volume_valid) { */
/* SHOW("pa_context_get_sink_input_info() failed: %s", pa_strerror(pa_context_errno(context))); */
/* goto unlock_and_fail; */
/* } */
do_trigger = 0;
written = 0;
time_offset_msec = 0;
just_flushed = 0;
connected = 1;
// volume_time_event = NULL;
pa_threaded_mainloop_unlock(mainloop);
SHOW_TIME("pulse_open (ret true)");
// return true;
return PULSE_OK;
unlock_and_fail:
if (o)
+1 -1
View File
@@ -1796,7 +1796,7 @@ if(option_log_frames)
next = (fr2->fheight[ix] * v->height[ix]) << 6;
peaks[ix].height_inc = ((next - peaks[ix].height1) * STEPSIZE) / length2;
if(ix <= wvoice->n_harmonic_peaks)
if((ix <= 5) && (ix <= wvoice->n_harmonic_peaks))
{
peaks[ix].left1 = (fr1->fwidth[ix] * v->width[ix]) << 10;
peaks[ix].left = int(peaks[ix].left1);