lang=de improve de_rules

Changes to "de" lexicon comparitor

git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@42 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2007-06-09 02:32:26 +00:00
parent 52fcbc6d29
commit 245ee91a84
10 changed files with 117 additions and 30 deletions
+2
View File
@@ -1938,6 +1938,8 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
case RULE_NO_SUFFIX:
if(word_flags & FLAG_SUFFIX_REMOVED)
failed = 1; // a suffix has been removed
else
match.points++;
break;
default:
+29 -11
View File
@@ -39,7 +39,6 @@
//******************************************************************************************************
FILE *f_wavtest = NULL;
FILE *f_events = NULL;
@@ -215,8 +214,8 @@ void DecodePhonemes2(const char *inptr, char *outptr)
int start;
static const char *stress_chars = "==,,'* ";
unsigned int replace_ph[] = {',',PH('@','-'),'W','3','y',PH('A',':'),'*',PH('_','!'),PH('_','|'),PH('O','I'),PH('Y',':'),PH('p','F'),0};
const char *replace_ph2[] = {NULL,NULL, "9","@r","Y", "a:", "r", "?", "?", "OY", "2:", "pf" ,NULL};
unsigned int replace_ph[] = {',',PH('@','-'),'W','3','y',PH('A',':'),'*',PH('_','!'),PH('_','|'),PH('O','I'),PH('Y',':'),PH('p','F'),PH('E','2'),0};
const char *replace_ph2[] = {NULL,NULL, "9","@r","Y", "a:", "r", "?", "?", "OY", "2:", "pf" ,"E",NULL};
start = 1;
@@ -229,7 +228,7 @@ void DecodePhonemes2(const char *inptr, char *outptr)
if((ph->type == phSTRESS) && (ph->std_length <= 4) && (ph->spect == 0))
{
if(ph->std_length > 3)
if(ph->std_length > 2)
*outptr++ = stress_chars[ph->std_length];
}
else
@@ -302,12 +301,12 @@ void Lexicon_De()
char pronounce[80];
char pronounce2[80];
char phonemes[80];
char phonemes2[80];
WORD_TAB winfo;
static char *vowels = "aeiouyAEIOU29@";
static char *vowels = "aeiouyAEIOUY29@";
wxString fname = wxFileSelector(_T("German Lexicon"),wxString(path_home,wxConvLocal),
_T(""),_T(""),_T("*"),wxOPEN);
wxString fname = wxFileSelector(_T("German Lexicon"),path_dir1,_T(""),_T(""),_T("*"),wxOPEN);
strcpy(buf,fname.mb_str(wxConvLocal));
if((f_in = fopen(buf,"r")) == NULL)
@@ -315,6 +314,7 @@ void Lexicon_De()
wxLogError(_T("Can't read file ")+fname);
return;
}
path_dir1 = wxFileName(fname).GetPath();
if((f_out = fopen("compare_de","w")) == NULL)
{
@@ -331,7 +331,7 @@ void Lexicon_De()
if(fgets(buf,sizeof(buf),f_in) == NULL)
break;
sscanf(buf,"%s\t%s\t%s",word,type,pronounce);
sscanf(buf,"%s %s %s",word,type,pronounce);
// convert word to lower-case
for(ix=0, p=&word2[1];;)
@@ -397,9 +397,27 @@ void Lexicon_De()
}
else
{
if(strlen(word) < 8)
strcat(word,"\t");
fprintf(f_out,"%s\t%s\t%s\n",word,phonemes,pronounce2);
// remove secondary stress
strcpy(phonemes2,phonemes);
p = phonemes;
for(ix=0; ;ix++)
{
if((c = phonemes2[ix]) != ',')
*p++ = c;
if(c == 0)
break;
}
if(strcmp(phonemes,pronounce2) == 0)
{
matched++;
}
else
{
if(strlen(word) < 8)
strcat(word,"\t");
fprintf(f_out,"%s\t%s\t%s\n",word,phonemes,pronounce2);
}
}
}
+3
View File
@@ -49,6 +49,7 @@ wxString path_voices;
wxString path_phsource;
wxString path_dictsource;
wxString path_speaktext;
wxString path_dir1;
int option_speed=160;
char path_dsource[120];
@@ -166,6 +167,7 @@ void ConfigInit()
pConfig->Read(_T("/phsource"),&path_phsource,basedir+_T("/phsource"));
pConfig->Read(_T("/dictsource"),&path_dictsource,basedir+_T("/dictsource"));
pConfig->Read(_T("/speaktext"),&path_speaktext,wxEmptyString);
pConfig->Read(_T("/dir1"),&path_dir1,basedir);
option_speed = pConfig->Read(_T("/speed"),160);
ConfigSetPaths();
} // end of ConfigInit
@@ -191,6 +193,7 @@ void ConfigSave(int exit)
pConfig->Write(_T("/dictsource"),path_dictsource);
pConfig->Write(_T("/speaktext"),path_speaktext);
pConfig->Write(_T("/speed"),option_speed);
pConfig->Write(_T("/dir1"),path_dir1);
if(exit)
delete wxFileConfig::Set((wxFileConfig *)NULL);
+1
View File
@@ -35,6 +35,7 @@ extern wxString path_pitches;
extern wxString path_voices;
extern wxString path_phsource;
extern wxString path_dictsource;
extern wxString path_dir1;
extern char path_source[80];
extern char path_dsource[120];