mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 21:39:47 +00:00
[1.43.63]
Phoneme definitions. Add "equivalents" table to translate phonemes from a foreign language (eg. English) into the equivalant phonemes of this language. This is used when *_rules and *_list files indicate that a word uses pronunciation rules from a different language. Unpronouncable words can be recognised by rules in *_rule files. This feature is now used for en, de, es. Lang=ta, hi. Letter-names for combining vowel characters are distinguished from stand-alone vowel characters by a preceding beep. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@251 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
@@ -763,6 +763,75 @@ void Lexicon_De()
|
||||
}
|
||||
|
||||
|
||||
extern int IsVowel(Translator *tr, int letter);
|
||||
|
||||
void Lexicon_Test()
|
||||
{//================
|
||||
int c1, c2, c3;
|
||||
char *p;
|
||||
int prev_c1=0;
|
||||
int prev_c2=0;
|
||||
int prev_c3 = 0;
|
||||
FILE *f_in;
|
||||
FILE *f_out;
|
||||
char buf[200];
|
||||
|
||||
wxString s_fname = wxFileSelector(_T("List of UTF-8 words with Combining Grave Accent U+300 to indicate stress"),path_dir1,
|
||||
_T(""),_T(""),_T("*"),wxOPEN);
|
||||
if(s_fname.IsEmpty())
|
||||
return;
|
||||
strcpy(buf,s_fname.mb_str(wxConvLocal));
|
||||
path_dir1 = wxFileName(s_fname).GetPath();
|
||||
|
||||
if((f_in = fopen(buf,"r")) == NULL)
|
||||
{
|
||||
wxLogError(_T("Can't read file: ") + wxString(buf,wxConvLocal));
|
||||
return;
|
||||
}
|
||||
|
||||
strcat(buf,"_1");
|
||||
if((f_out = fopen(buf,"w")) == NULL)
|
||||
{
|
||||
wxLogError(_T("Can't write file: ") + wxString(buf,wxConvLocal));
|
||||
fclose(f_in);
|
||||
return;
|
||||
}
|
||||
|
||||
while(!feof(f_in))
|
||||
{
|
||||
if((p = fgets(buf,sizeof(buf),f_in)) == NULL)
|
||||
break;
|
||||
|
||||
if(buf[0] == 0)
|
||||
continue;
|
||||
|
||||
p += utf8_in(&c1, p);
|
||||
p += utf8_in(&c2, p);
|
||||
p += utf8_in(&c3, p);
|
||||
|
||||
c1 = towlower(c1);
|
||||
c2 = towlower(c2);
|
||||
c3 = towlower(c3);
|
||||
|
||||
if(IsVowel(translator, c1))
|
||||
continue;
|
||||
if(IsVowel(translator, c2))
|
||||
continue;
|
||||
|
||||
if((prev_c1 != c1) || (prev_c2 != c2) || ((prev_c3 != c3) && !IsVowel(translator,c3)))
|
||||
fputc('\n',f_out);
|
||||
prev_c1 = c1;
|
||||
prev_c2 = c2;
|
||||
prev_c3 = c3;
|
||||
fprintf(f_out,"%s",buf);
|
||||
|
||||
}
|
||||
fclose(f_in);
|
||||
fclose(f_out);
|
||||
} // end of Lexicon_Test
|
||||
|
||||
|
||||
|
||||
void Lexicon_Bg()
|
||||
{//==============
|
||||
// Bulgarian: compare stress markup in a list of words with lookup using bg_rules
|
||||
@@ -1275,6 +1344,9 @@ void CompareLexicon(int id)
|
||||
case MENU_LEXICON_IT2:
|
||||
Lexicon_It(2);
|
||||
break;
|
||||
case MENU_LEXICON_TEST:
|
||||
Lexicon_Test();
|
||||
break;
|
||||
}
|
||||
} // end of CompareLexicon
|
||||
|
||||
|
||||
Reference in New Issue
Block a user