mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-20 19:21:57 +00:00
[1.40.13]
lang=it, added dictsource/it_listx with corrections for stress position and open/close vowel type. Changes to allow compilation on WinCE (Windows Mobile), with notes in platforms/windowsMobile. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@219 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+52
-7
@@ -696,7 +696,7 @@ static int Unpronouncable_en(Translator *tr, char *word)
|
||||
0x00, 0x88, 0x22, 0x04, 0x00, 0x02, 0x00, 0x04, // 32
|
||||
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x28, 0x8a, 0x03, 0x00, 0x00, 0x40, 0x00, // 48
|
||||
0x02, 0x00, 0x41, 0xca, 0x9b, 0x06, 0x20, 0x80,
|
||||
0x02, 0x00, 0x41, 0xca, 0xbb, 0x06, 0x20, 0x80,
|
||||
0x91, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x00, // 64
|
||||
0x08, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x22, 0x00, 0x01, 0x00, };
|
||||
@@ -1408,7 +1408,7 @@ void SetWordStress(Translator *tr, char *output, unsigned int &dictionary_flags,
|
||||
stress = 3; /* use secondary stress for remaining syllables */
|
||||
}
|
||||
else
|
||||
if((vowel_stress[v-1] <= 1) && (vowel_stress[v+1] <= 1))
|
||||
if((vowel_stress[v-1] <= 1) && ((vowel_stress[v+1] <= 1) || ((stress == 4) && (vowel_stress[v+1] <= 2))))
|
||||
{
|
||||
/* trochaic: give stress to vowel surrounded by unstressed vowels */
|
||||
|
||||
@@ -1558,7 +1558,7 @@ void SetWordStress(Translator *tr, char *output, unsigned int &dictionary_flags,
|
||||
max_stress = vowel_stress[v];
|
||||
}
|
||||
|
||||
if((*p == phonLENGTHEN) && ((opt_length = tr->langopts.param[LOPT_IT_LENGTHEN]) != 0))
|
||||
if((*p == phonLENGTHEN) && ((opt_length = tr->langopts.param[LOPT_IT_LENGTHEN]) & 1))
|
||||
{
|
||||
// remove lengthen indicator from non-stressed syllables
|
||||
int shorten=0;
|
||||
@@ -1576,13 +1576,20 @@ void SetWordStress(Translator *tr, char *output, unsigned int &dictionary_flags,
|
||||
shorten = 1;
|
||||
}
|
||||
|
||||
if(((opt_length & 0xf)==2) && (v != (vowel_count - 2)))
|
||||
shorten = 1; // LANG=Italian, remove lengthen indicator from non-penultimate syllables
|
||||
|
||||
if(shorten)
|
||||
p++;
|
||||
}
|
||||
|
||||
if((v_stress >= 4) && (tr->langopts.param[LOPT_IT_LENGTHEN] == 2))
|
||||
{
|
||||
// LANG=Italian, lengthen penultimate stressed vowels, unless followed by 2 consonants
|
||||
if((v == (vowel_count - 2)) && (syllable_weight[v] == 0))
|
||||
{
|
||||
*output++ = phcode;
|
||||
phcode = phonLENGTHEN;
|
||||
}
|
||||
}
|
||||
|
||||
v++;
|
||||
}
|
||||
|
||||
@@ -2193,7 +2200,7 @@ static void MatchRule(Translator *tr, char *word[], const char *group, char *rul
|
||||
|
||||
case RULE_LETTERGP2: // match against a list of utf-8 strings
|
||||
letter_group = *rule++ - 'A';
|
||||
if((n_bytes = IsLetterGroup(tr, pre_ptr-letter_xbytes,letter_group,1)) >0)
|
||||
if((n_bytes = IsLetterGroup(tr, pre_ptr,letter_group,1)) >0)
|
||||
{
|
||||
add_points = (20-distance_right);
|
||||
pre_ptr -= (n_bytes-1);
|
||||
@@ -2683,6 +2690,44 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
} /* end of TranslateRules */
|
||||
|
||||
|
||||
void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags)
|
||||
{//========================================================================
|
||||
// apply after the translation is complete
|
||||
int ix;
|
||||
int len;
|
||||
char *p;
|
||||
|
||||
len = strlen(phonemes);
|
||||
|
||||
switch(tr->translator_name)
|
||||
{
|
||||
case L('i','t'):
|
||||
for(ix=0; ix<(len-1); ix++)
|
||||
{
|
||||
if(phonemes[ix] == phonSTRESS_P)
|
||||
{
|
||||
p = &phonemes[ix+1];
|
||||
if((dict_flags & FLAG_ALT2_TRANS) != 0)
|
||||
{
|
||||
if(*p == PhonemeCode('E'))
|
||||
*p = PhonemeCode('e');
|
||||
if(*p == PhonemeCode('O'))
|
||||
*p = PhonemeCode('o');
|
||||
}
|
||||
else
|
||||
{
|
||||
if(*p == PhonemeCode('e'))
|
||||
*p = PhonemeCode('E');
|
||||
if(*p == PhonemeCode('o'))
|
||||
*p = PhonemeCode('O');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} // end of ApplySpecialAttribute2
|
||||
|
||||
|
||||
void ApplySpecialAttribute(Translator *tr, char *phonemes, int dict_flags)
|
||||
{//=======================================================================
|
||||
|
||||
@@ -658,5 +658,8 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
espeak_Synchronize();
|
||||
|
||||
if(f_phonemes_out != stdout)
|
||||
fclose(f_phonemes_out); // needed for WinCE
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -204,6 +204,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxMDIParentFrame)
|
||||
EVT_MENU(MENU_VOWELCHART3, MyFrame::OnTools)
|
||||
EVT_MENU(MENU_LEXICON_RU, MyFrame::OnTools)
|
||||
EVT_MENU(MENU_LEXICON_DE, MyFrame::OnTools)
|
||||
EVT_MENU(MENU_LEXICON_IT, MyFrame::OnTools)
|
||||
EVT_MENU(MENU_LEXICON_IT2, MyFrame::OnTools)
|
||||
EVT_MENU(MENU_TO_UTF8, MyFrame::OnTools)
|
||||
EVT_MENU(MENU_COUNT_WORDS, MyFrame::OnTools)
|
||||
EVT_MENU(MENU_TEST, MyFrame::OnTools)
|
||||
@@ -457,6 +459,8 @@ void MyFrame::OnTools(wxCommandEvent& event)
|
||||
|
||||
case MENU_LEXICON_RU:
|
||||
case MENU_LEXICON_DE:
|
||||
case MENU_LEXICON_IT:
|
||||
case MENU_LEXICON_IT2:
|
||||
CompareLexicon(event.GetId()); // Compare a lexicon with _rules translation
|
||||
break;
|
||||
|
||||
|
||||
+315
@@ -288,6 +288,315 @@ static void DecodePhonemes2(const char *inptr, char *outptr)
|
||||
} // end of DecodePhonemes2
|
||||
|
||||
|
||||
void Lexicon_It(int pass)
|
||||
{//======================
|
||||
int count=0;
|
||||
int matched=0;
|
||||
int ix;
|
||||
int c;
|
||||
char *p;
|
||||
int len;
|
||||
int vowel_ix;
|
||||
int stress_posn1;
|
||||
int stress_posn2;
|
||||
int stress_vowel1;
|
||||
int stress_vowel2;
|
||||
int use_phonemes;
|
||||
FILE *f_in;
|
||||
FILE *f_out;
|
||||
FILE *f_listx;
|
||||
FILE *f_list_in;
|
||||
long int displ;
|
||||
const char *alt_string;
|
||||
char buf[200];
|
||||
char word[80];
|
||||
char word1[80];
|
||||
char word2[80];
|
||||
char word_stem[80];
|
||||
char temp[80];
|
||||
char phonemes[80];
|
||||
char phonemes2[80];
|
||||
char buf_out[120];
|
||||
WORD_TAB winfo;
|
||||
static const char *vowels1 = "aeiou";
|
||||
static const char *vowels2 = "aeou";
|
||||
|
||||
static const char ex1[] = {'a',0xc3,0xac,0}; // aì
|
||||
static const char ex2[] = {'e',0xc3,0xac,0}; // eì
|
||||
static const char ex3[] = {0xc3,0xb9,'a',0}; // ùa
|
||||
static const char ex4[] = {0xc3,0xb9,'e',0}; // ùe
|
||||
static const char ex5[] = {0xc3,0xb9,'i',0}; // ùi
|
||||
static const char ex6[] = {0xc3,0xb9,'o',0}; // ùo
|
||||
static const char ex7[] = {'c',0xc3,0xac,'a',0}; // cìa
|
||||
static const char ex8[] = {'c',0xc3,0xac,'o',0}; // cìo
|
||||
static const char ex9[] = {'c',0xc3,0xac,'u',0}; // cìu
|
||||
static const char ex10[] = {'g','l',0xc3,0xac,0}; // glì
|
||||
|
||||
|
||||
static const char *exceptions[] = {ex1, ex2, ex3, ex4, ex5, ex6, ex7, ex8, ex9, ex10, NULL};
|
||||
|
||||
wxString fname = wxFileSelector(_T("Italian Lexicon"),path_dir1,_T(""),_T(""),_T("*"),wxOPEN);
|
||||
|
||||
strcpy(buf,fname.mb_str(wxConvLocal));
|
||||
if((f_in = fopen(buf,"r")) == NULL)
|
||||
{
|
||||
wxLogError(_T("Can't read file ")+fname);
|
||||
return;
|
||||
}
|
||||
path_dir1 = wxFileName(fname).GetPath();
|
||||
|
||||
if((f_out = fopen("compare_it","w")) == NULL)
|
||||
{
|
||||
wxLogError(_T("Can't write file: compare_it "));
|
||||
return;
|
||||
}
|
||||
|
||||
if(pass == 1)
|
||||
{
|
||||
sprintf(buf,"%s/it_listx",path_dsource);
|
||||
remove(buf);
|
||||
CompileDictionary(path_dsource,"it",NULL,NULL,0);
|
||||
f_listx = fopen(buf,"w");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(buf,"%s/it_listx2",path_dsource);
|
||||
f_listx = fopen(buf,"w");
|
||||
sprintf(buf,"%s/it_listx",path_dsource);
|
||||
if((f_list_in = fopen(buf,"r")) == NULL)
|
||||
{
|
||||
wxLogError(_T("Can't read file: it_listx"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(f_listx == NULL)
|
||||
{
|
||||
wxLogError(_T("Can't write file: it_listx"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LoadVoice("it",0);
|
||||
|
||||
while(!feof(f_in))
|
||||
{
|
||||
count++;
|
||||
|
||||
if(fgets(buf,sizeof(buf),f_in) == NULL)
|
||||
break;
|
||||
|
||||
if((p = strstr(buf,"//")) != NULL)
|
||||
*p = 0;
|
||||
|
||||
if((sscanf(buf,"%s %s",word,temp)) < 2)
|
||||
continue;
|
||||
|
||||
if(strlen(word) < 8)
|
||||
sprintf(buf_out,"%s\t\t%s\t",word,temp);
|
||||
else
|
||||
sprintf(buf_out,"%s\t%s",word,temp);
|
||||
|
||||
sprintf(word1," %s ",word);
|
||||
|
||||
// should we remove a vowel ending to produce a stem ?
|
||||
strcpy(word_stem, word);
|
||||
len = strlen(word) - 1;
|
||||
utf8_in(&c, temp);
|
||||
// if(iswlower(c))
|
||||
{
|
||||
if((word[len] == 'a') && (strchr(vowels1, word[len-1]) == NULL))
|
||||
word_stem[len] = 0;
|
||||
else
|
||||
if((word[len] == 'o') && (strchr(vowels2, word[len-1]) == NULL))
|
||||
word_stem[len] = 0;
|
||||
}
|
||||
|
||||
// convert word to lower-case
|
||||
word2[0] = ' ';
|
||||
for(ix=0, p=&word2[1];;)
|
||||
{
|
||||
ix += utf8_in(&c,&temp[ix]);
|
||||
c = towlower(c);
|
||||
p += utf8_out(c,p);
|
||||
if(c == 0)
|
||||
break;
|
||||
}
|
||||
strcat(word2," ");
|
||||
|
||||
use_phonemes = 0;
|
||||
for(ix=0; ; ix++)
|
||||
{
|
||||
if(exceptions[ix] == NULL)
|
||||
break;
|
||||
|
||||
if(strstr(word2, exceptions[ix]) != NULL)
|
||||
{
|
||||
// the word contains a string for which we must do a complete phoneme translation
|
||||
use_phonemes = 1;
|
||||
strcpy(word_stem, word);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// translate
|
||||
memset(&winfo,0,sizeof(winfo));
|
||||
TranslateWord(translator,&word1[1],0,&winfo);
|
||||
DecodePhonemes(word_phonemes,phonemes);
|
||||
|
||||
stress_posn1 = 0;
|
||||
stress_posn2 = 0;
|
||||
stress_vowel1 = 0;
|
||||
stress_vowel2 = 0;
|
||||
|
||||
vowel_ix = 1;
|
||||
for(ix=0; ;ix++)
|
||||
{
|
||||
if((c = word_phonemes[ix]) == 0)
|
||||
break;
|
||||
if(c == phonSTRESS_P)
|
||||
{
|
||||
stress_posn1 = vowel_ix;
|
||||
stress_vowel1 = word_phonemes[ix+1];
|
||||
}
|
||||
|
||||
if((c != phonSCHWA_SHORT) && (phoneme_tab[c]->type == phVOWEL))
|
||||
vowel_ix++;
|
||||
}
|
||||
|
||||
memset(&winfo,0,sizeof(winfo));
|
||||
TranslateWord(translator,&word2[1],0,&winfo);
|
||||
DecodePhonemes(word_phonemes,phonemes2);
|
||||
|
||||
vowel_ix = 1;
|
||||
for(ix=0; ;ix++)
|
||||
{
|
||||
if((c = word_phonemes[ix]) == 0)
|
||||
break;
|
||||
if(c == phonSTRESS_P)
|
||||
{
|
||||
stress_posn2 = vowel_ix;
|
||||
stress_vowel2 = word_phonemes[ix+1];
|
||||
}
|
||||
|
||||
if((c != phonSCHWA_SHORT) && (phoneme_tab[c]->type == phVOWEL))
|
||||
vowel_ix++;
|
||||
}
|
||||
|
||||
if(stress_posn2 == (vowel_ix-1))
|
||||
{
|
||||
// stress is on the final vowel, don't renove it
|
||||
strcpy(word_stem, word);
|
||||
}
|
||||
|
||||
if(pass == 1)
|
||||
{
|
||||
if(use_phonemes)
|
||||
{
|
||||
fprintf(f_listx,"%s ", word_stem);
|
||||
for(p = phonemes2; *p != 0; p++)
|
||||
{
|
||||
if(*p != ',')
|
||||
fputc(*p, f_listx); // omit secondary stress marks
|
||||
}
|
||||
fputc('\n',f_listx);
|
||||
|
||||
}
|
||||
else
|
||||
if((stress_posn1 != stress_posn2) && (stress_posn1 > 0) && (stress_posn2 > 0))
|
||||
{
|
||||
fprintf(f_listx,"%s $%d\n", word_stem, stress_posn2);
|
||||
}
|
||||
}
|
||||
|
||||
// reduce [E] and [O] to [e] and [o] if not stressed
|
||||
for(ix=0; phonemes[ix] != 0; ix++)
|
||||
{
|
||||
if((phonemes[ix] == 'E') || (phonemes[ix] == 'O'))
|
||||
{
|
||||
if((pass == 2) || (ix==0) || (phonemes[ix-1] != '\''))
|
||||
phonemes[ix] = tolower(phonemes[ix]);
|
||||
}
|
||||
}
|
||||
|
||||
for(ix=0; phonemes2[ix] != 0; ix++)
|
||||
{
|
||||
if((phonemes2[ix] == 'E') || (phonemes2[ix] == 'O'))
|
||||
{
|
||||
if((pass == 2) || (ix==0) || (phonemes2[ix-1] != '\''))
|
||||
phonemes2[ix] = tolower(phonemes2[ix]);
|
||||
}
|
||||
}
|
||||
|
||||
if(strcmp(phonemes,phonemes2) == 0)
|
||||
{
|
||||
alt_string = NULL;
|
||||
if((pass == 2) && (stress_posn1 > 0) && (stress_posn2 > 0))
|
||||
{
|
||||
if(((stress_vowel1 == PhonemeCode('E')) && (stress_vowel2 == PhonemeCode('e'))) ||
|
||||
((stress_vowel1 == PhonemeCode('O')) && (stress_vowel2 == PhonemeCode('o'))))
|
||||
{
|
||||
alt_string = " $alt2";
|
||||
}
|
||||
else
|
||||
if(((stress_vowel1 == PhonemeCode('e')) && (stress_vowel2 == PhonemeCode('E'))) ||
|
||||
((stress_vowel1 == PhonemeCode('o')) && (stress_vowel2 == PhonemeCode('O'))))
|
||||
{
|
||||
alt_string = " $alt";
|
||||
}
|
||||
|
||||
if(alt_string != NULL)
|
||||
{
|
||||
while(!feof(f_list_in))
|
||||
{
|
||||
displ = ftell(f_list_in);
|
||||
if(fgets(buf, sizeof(buf), f_list_in) == NULL)
|
||||
break;
|
||||
|
||||
sscanf(buf, "%s", word1);
|
||||
if(strcmp(word1, word_stem) < 0)
|
||||
{
|
||||
fprintf(f_listx,"%s",buf); // copy it_listx from pass 1 until we reach the matching word
|
||||
}
|
||||
else
|
||||
if(strcmp(word1, word_stem) == 0)
|
||||
{
|
||||
p = buf;
|
||||
while((*p != '\n') && (*p != 0)) *p++;
|
||||
*p = 0;
|
||||
fprintf(f_listx,"%s %s\n",buf,alt_string); // add $alt or $alt2 to the entry
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(f_listx,"%s %s\n", word_stem, alt_string); // add a new word with $alt or $alt2
|
||||
fseek(f_list_in, displ, SEEK_SET);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
matched++;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(f_out,"%s\t%s\t%s\n",buf_out,phonemes,phonemes2);
|
||||
}
|
||||
}
|
||||
|
||||
if(pass == 2)
|
||||
{
|
||||
while(fgets(buf, sizeof(buf), f_list_in) != NULL)
|
||||
{
|
||||
fprintf(f_listx, "%s", buf); // copy the remaining entries from pass 1
|
||||
}
|
||||
fclose(f_list_in);
|
||||
}
|
||||
fclose(f_in);
|
||||
fclose(f_out);
|
||||
fclose(f_listx);
|
||||
wxLogStatus(_T("Completed, equal=%d different=%d"),matched,count-matched);
|
||||
}
|
||||
|
||||
|
||||
void Lexicon_De()
|
||||
{//==============
|
||||
// Compare eSpeak's translation of German words with a pronunciation lexicon
|
||||
@@ -766,6 +1075,12 @@ void CompareLexicon(int id)
|
||||
case MENU_LEXICON_DE:
|
||||
Lexicon_De();
|
||||
break;
|
||||
case MENU_LEXICON_IT:
|
||||
Lexicon_It(1);
|
||||
break;
|
||||
case MENU_LEXICON_IT2:
|
||||
Lexicon_It(2);
|
||||
break;
|
||||
}
|
||||
} // end of CompareLexicon
|
||||
|
||||
|
||||
+3
-3
@@ -1087,9 +1087,9 @@ void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v
|
||||
|
||||
if(wvoice != NULL)
|
||||
{
|
||||
if((wvoice->klatt[0] > 0) && (wvoice->klatt[0] <=3 ))
|
||||
if((wvoice->klattv[0] > 0) && (wvoice->klattv[0] <=3 ))
|
||||
{
|
||||
kt_globals.glsource = wvoice->klatt[0];
|
||||
kt_globals.glsource = wvoice->klattv[0];
|
||||
kt_globals.scale_wav = scale_wav_tab[kt_globals.glsource];
|
||||
}
|
||||
kt_globals.f0_flutter = wvoice->flutter/32;
|
||||
@@ -1167,7 +1167,7 @@ void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v
|
||||
klattp_inc[ix] = double((fr2->klattp[ix] - klattp[ix]) * STEPSIZE)/length;
|
||||
|
||||
if((ix>0) && (ix < KLATT_AVp))
|
||||
klattp1[ix] = klattp[ix] = (klattp[ix] + wvoice->klatt[ix]);
|
||||
klattp1[ix] = klattp[ix] = (klattp[ix] + wvoice->klattv[ix]);
|
||||
}
|
||||
|
||||
nsamples = length;
|
||||
|
||||
@@ -153,6 +153,8 @@ enum {
|
||||
MENU_LEXICON,
|
||||
MENU_LEXICON_RU,
|
||||
MENU_LEXICON_DE,
|
||||
MENU_LEXICON_IT,
|
||||
MENU_LEXICON_IT2,
|
||||
MENU_TO_UTF8,
|
||||
MENU_COUNT_WORDS,
|
||||
MENU_TEST,
|
||||
|
||||
@@ -111,6 +111,8 @@ wxMenuBar *MakeMenu(int type)
|
||||
lexicon_menu = new wxMenu;
|
||||
lexicon_menu->Append(MENU_LEXICON_RU, _("Russian (lexicon.dict)"));
|
||||
lexicon_menu->Append(MENU_LEXICON_DE, _("German"));
|
||||
lexicon_menu->Append(MENU_LEXICON_IT, _("Italian"));
|
||||
lexicon_menu->Append(MENU_LEXICON_IT2, _("Italian, pass 2"));
|
||||
|
||||
tools_menu = new wxMenu;
|
||||
tools_menu->Append(MENU_VOWELCHART, _("Make &Vowels Chart"), vowelchart_menu);
|
||||
|
||||
@@ -306,6 +306,8 @@ const wchar_t *wcschr(const wchar_t *str, int c)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#ifndef WINCE
|
||||
// wcslen() is provided by WINCE, but not the other wchar functions
|
||||
const int wcslen(const wchar_t *str)
|
||||
{
|
||||
int ix=0;
|
||||
@@ -316,6 +318,7 @@ const int wcslen(const wchar_t *str)
|
||||
}
|
||||
return(ix);
|
||||
}
|
||||
#endif
|
||||
|
||||
float wcstod(const wchar_t *str, wchar_t **tailptr)
|
||||
{
|
||||
|
||||
@@ -883,5 +883,8 @@ int main (int argc, char **argv)
|
||||
fprintf(stderr,"-w option must be used because the program was built without a sound interface\n");
|
||||
#endif // USE_PORTAUDIO
|
||||
}
|
||||
|
||||
if((f_trans != stdout) && (f_trans != stderr))
|
||||
fclose(f_trans); // needed for WinCe
|
||||
return(0);
|
||||
}
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.40.11 13.Mar.09";
|
||||
const char *version_string = "1.40.13 5.Apr.09";
|
||||
const int version_phdata = 0x014000;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
+14
-1
@@ -101,7 +101,7 @@ typedef struct {
|
||||
unsigned char klattp[N_KLATTP];
|
||||
} frame_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct { // 43 bytes
|
||||
short frflags;
|
||||
unsigned char length;
|
||||
unsigned char rms;
|
||||
@@ -112,6 +112,19 @@ typedef struct {
|
||||
} frame_t2; // the original, without Klatt additions, used for file "phondata"
|
||||
|
||||
|
||||
typedef struct { // 44 bytes
|
||||
short frflags;
|
||||
short ffreq[7];
|
||||
unsigned char length;
|
||||
unsigned char rms;
|
||||
unsigned char fheight[8];
|
||||
unsigned char fwidth[6]; // width/4 f0-5
|
||||
unsigned char fright[3]; // width/4 f0-2
|
||||
unsigned char bw[4]; // Klatt bandwidth BNZ, f1,f2,f3
|
||||
unsigned char klattp[5]; // AV, FNZ, Tilt, spare, spare (Aspr, Skew ?)
|
||||
} frame_t3; // TESTING
|
||||
|
||||
|
||||
|
||||
// formant data used by wavegen
|
||||
typedef struct {
|
||||
|
||||
@@ -325,7 +325,7 @@ Translator *SelectTranslator(const char *name)
|
||||
|
||||
case L('d','e'):
|
||||
{
|
||||
static const short stress_lengths_de[8] = {150,130, 190,190, 0, 0, 260,275};
|
||||
static const short stress_lengths_de[8] = {150,130, 200,200, 0, 0, 260,275};
|
||||
tr->langopts.stress_rule = 0;
|
||||
tr->langopts.word_gap = 0x8; // don't use linking phonemes
|
||||
tr->langopts.vowel_pause = 0x30;
|
||||
@@ -636,6 +636,7 @@ SetLengthMods(tr,3); // all equal
|
||||
|
||||
tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
|
||||
tr->langopts.stress_rule = 2;
|
||||
tr->langopts.stress_flags = 0x10 | 0x20000;
|
||||
tr->langopts.vowel_pause = 1;
|
||||
tr->langopts.unstressed_wd1 = 2;
|
||||
tr->langopts.unstressed_wd2 = 2;
|
||||
@@ -643,22 +644,24 @@ SetLengthMods(tr,3); // all equal
|
||||
tr->langopts.param[LOPT_IT_DOUBLING] = 2; // double the first consonant if the previous word ends in a stressed vowel
|
||||
tr->langopts.param[LOPT_SONORANT_MIN] = 130; // limit the shortening of sonorants before short vowels
|
||||
tr->langopts.param[LOPT_REDUCE] = 1; // reduce vowels even if phonemes are specified in it_list
|
||||
tr->langopts.param[LOPT_ALT] = 2; // call ApplySpecialAttributes2() if a word has $alt or $alt2
|
||||
tr->langopts.numbers = 0x2709 + NUM_ROMAN;
|
||||
tr->langopts.accents = 2; // Say "Capital" after the letter.
|
||||
SetLetterVowel(tr,'y');
|
||||
}
|
||||
break;
|
||||
|
||||
case L_jbo: // Lojban
|
||||
{
|
||||
static const short stress_lengths_jbo[8] = {145,145, 170,160, 0,0, 330,350};
|
||||
static const wchar_t jbo_punct_within_word[] = {'.',',','\'',0x2c8,0}; // allow period and comma within a word, also stress marker (from LOPT_SYLLABLE_CAPS)
|
||||
static const wchar_t jbo_punct_within_word[] = {'.',',','\'',0x2c8,0}; // allow period and comma within a word, also stress marker (from LOPT_CAPS_IN_WORD)
|
||||
|
||||
SetupTranslator(tr,stress_lengths_jbo,NULL);
|
||||
tr->langopts.stress_rule = 2;
|
||||
tr->langopts.vowel_pause = 0x20c; // pause before a word which starts with a vowel, or after a word which ends in a consonant
|
||||
// tr->langopts.word_gap = 1;
|
||||
tr->punct_within_word = jbo_punct_within_word;
|
||||
tr->langopts.param[LOPT_SYLLABLE_CAPS] = 1; // capitals indicate stressed syllables
|
||||
tr->langopts.param[LOPT_CAPS_IN_WORD] = 2; // capitals indicate stressed syllables
|
||||
SetLetterVowel(tr,'y');
|
||||
}
|
||||
break;
|
||||
|
||||
+8
-3
@@ -1203,6 +1203,11 @@ strcpy(phonemes2,phonemes);
|
||||
dictionary_flags[0] |= FLAG_DOT;
|
||||
}
|
||||
|
||||
if((tr->langopts.param[LOPT_ALT] & 2) && ((dictionary_flags[0] & (FLAG_ALT_TRANS | FLAG_ALT2_TRANS)) != 0))
|
||||
{
|
||||
ApplySpecialAttribute2(tr,word_phonemes,dictionary_flags[0]);
|
||||
}
|
||||
|
||||
return(dictionary_flags[0]);
|
||||
} // end of TranslateWord
|
||||
|
||||
@@ -1508,7 +1513,7 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
|
||||
if(pre_pause < 1)
|
||||
pre_pause = 1;
|
||||
}
|
||||
if((flags & FLAG_PREPAUSE) && (tr->prepause_timeout == 0))
|
||||
if((flags & FLAG_PREPAUSE) && ((word_flags && FLAG_LAST_WORD) == 0) && (tr->prepause_timeout == 0))
|
||||
{
|
||||
// the word is marked in the dictionary list with $pause
|
||||
if(pre_pause < 4) pre_pause = 4;
|
||||
@@ -2296,9 +2301,9 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
|
||||
{
|
||||
c = towlower2(c);
|
||||
|
||||
if(tr->langopts.param[LOPT_SYLLABLE_CAPS])
|
||||
if((j = tr->langopts.param[LOPT_CAPS_IN_WORD]) > 0)
|
||||
{
|
||||
if(syllable_marked == 0)
|
||||
if((j == 2) && (syllable_marked == 0))
|
||||
{
|
||||
char_inserted = c;
|
||||
c = 0x2c8; // stress marker
|
||||
|
||||
+7
-3
@@ -240,7 +240,7 @@ extern const int param_defaults[N_SPEECH_PARAM];
|
||||
|
||||
|
||||
|
||||
#define N_LOPTS 15
|
||||
#define N_LOPTS 16
|
||||
#define LOPT_DIERESES 1
|
||||
// 1=remove [:] from unstressed syllables, 2= remove from unstressed or non-penultimate syllables
|
||||
// bit 4=0, if stress < 4, bit 4=1, if not the highest stress in the word
|
||||
@@ -283,13 +283,16 @@ extern const int param_defaults[N_SPEECH_PARAM];
|
||||
// change [t] when followed by unstressed vowel
|
||||
#define LOPT_REDUCE_T 12
|
||||
|
||||
// stressed syllable is indicated by capitals
|
||||
#define LOPT_SYLLABLE_CAPS 13
|
||||
// 1 = allow capitals inside a word
|
||||
// 2 = stressed syllable is indicated by capitals
|
||||
#define LOPT_CAPS_IN_WORD 13
|
||||
|
||||
// bit 0=Italian "syntactic doubling" of consoants in the word after a word marked with $double attribute
|
||||
// bit 1=also after a word which ends with a stressed vowel
|
||||
#define LOPT_IT_DOUBLING 14
|
||||
|
||||
// Call ApplySpecialAttributes() if $alt or $alt2 is set for a word
|
||||
#define LOPT_ALT 15
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -562,6 +565,7 @@ int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *f
|
||||
void MakePhonemeList(Translator *tr, int post_pause, int new_sentence);
|
||||
int ChangePhonemes_ru(Translator *tr, PHONEME_LIST2 *phlist, int n_ph, int index, PHONEME_TAB *ph, CHANGEPH *ch);
|
||||
void ApplySpecialAttribute(Translator *tr, char *phonemes, int dict_flags);
|
||||
void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags);
|
||||
void AppendPhonemes(Translator *tr, char *string, int size, const char *ph);
|
||||
|
||||
void CalcLengths(Translator *tr);
|
||||
|
||||
+2
-1
@@ -454,7 +454,8 @@ void TranslDlg::OnCommand(wxCommandEvent& event)
|
||||
t_phonetic->AppendText(wxString(buf,wxConvUTF8));
|
||||
}
|
||||
t_phonetic->AppendText(_T("---\n"));
|
||||
fclose(f_trans);
|
||||
if(f_trans != NULL)
|
||||
fclose(f_trans);
|
||||
remove(fname_temp);
|
||||
}
|
||||
t_phonetic->AppendText(wxString(phon_out,wxConvLocal));
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ typedef struct {
|
||||
int formant_factor; // adjust nominal formant frequencies by this because of the voice's pitch (256ths)
|
||||
int consonant_amp; // amplitude of unvoiced consonants
|
||||
int consonant_ampv; // amplitude of the noise component of voiced consonants
|
||||
int klatt[8];
|
||||
int klattv[8];
|
||||
|
||||
// parameters used by Wavegen
|
||||
short freq[N_PEAKS]; // 100% = 256
|
||||
|
||||
+4
-4
@@ -387,7 +387,7 @@ void VoiceReset(int tone_only)
|
||||
voice->voicing = 64;
|
||||
voice->consonant_amp = 100;
|
||||
voice->consonant_ampv = 100;
|
||||
memset(voice->klatt,0,sizeof(voice->klatt));
|
||||
memset(voice->klattv,0,sizeof(voice->klattv));
|
||||
memset(speed.fast_settings,0,sizeof(speed.fast_settings));
|
||||
|
||||
#ifdef PLATFORM_RISCOS
|
||||
@@ -880,8 +880,8 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
break;
|
||||
|
||||
case V_KLATT:
|
||||
Read8Numbers(p,voice->klatt);
|
||||
voice->klatt[KLATT_Kopen] -= 40;
|
||||
Read8Numbers(p,voice->klattv);
|
||||
voice->klattv[KLATT_Kopen] -= 40;
|
||||
break;
|
||||
|
||||
case V_FAST:
|
||||
@@ -1562,7 +1562,7 @@ static void GetVoices(const char *path)
|
||||
DIR *dir;
|
||||
struct dirent *ent;
|
||||
|
||||
if((dir = opendir(path)) == NULL)
|
||||
if((dir = opendir((char *)path)) == NULL) // note: (char *) is needed for WINCE
|
||||
return;
|
||||
|
||||
while((ent = readdir(dir)) != NULL)
|
||||
|
||||
Reference in New Issue
Block a user