Merge branch 'development'

This commit is contained in:
Reece H. Dunn
2013-04-24 12:42:54 +01:00
36 changed files with 1168 additions and 547 deletions
+7 -1
View File
@@ -909,7 +909,13 @@ int Unpronouncable(Translator *tr, char *word, int posn)
if(count==0)
c1 = c;
count++;
if((c == '\'') && (tr->langopts.param[LOPT_UNPRONOUNCABLE] == 3))
{
// don't count apostrophe
}
else
count++;
if(IsVowel(tr, c))
{
+70 -2
View File
@@ -2272,6 +2272,67 @@ void Test2()
#endif
#define MAX_WALPHA 0x24f
void Make_walpha_tab()
{//===================
int ix;
int value;
int c;
short exceptions[40];
int ex = 0;
FILE *f;
f = fopen("/home/jsd1/walpha_tab.txt","w");
for(ix=0x80; ix<=MAX_WALPHA; ix++)
{
value = 0;
if(iswalpha(ix))
{
value = 0xfe; // no case
if(iswlower(ix))
{
value = 0xff;
}
else if(iswupper(ix))
{
c = towlower(ix);
if(c > 0)
value = c - ix;
if((value < 0) || (value > 0xfc))
{
exceptions[ex] = ix;
exceptions[ex+1] = c;
ex+=2;
value = 0xfd;
}
}
}
if(value > 0xfc)
fprintf(f," 0x%.2x,", value);
else
fprintf(f," %4d,", value);
if((ix % 16) == 15)
{
fprintf(f," // %.3x\n", ix & 0xfff0);
}
}
fprintf(f, "\nstatic const short wchar_tolower[] = {\n");
exceptions[ex] = 0;
exceptions[ex+1] = 0;
for(ix=0; ix<=ex; ix+=2)
{
fprintf(f,"\t0x%.3x, 0x%.3x,\n", exceptions[ix], exceptions[ix+1]);
}
fprintf(f, "};\n");
fclose(f);
}
const char* text1 = "Hello world. Testing.";
@@ -2319,9 +2380,16 @@ if(control==2)
espeak_SetSynthCallback(TestSynthCallback);
espeak_SetUriCallback(TestUriCallback);
espeak_SetVoiceByName("en");
voice.languages = "fr";
espeak_SetVoiceByProperties(&voice);
// espeak_SetVoiceByName("fr");
espeak_Synth("1", 5, 0, POS_CHARACTER, 0, espeakSSML|espeakCHARS_UTF8, &unique_identifier, (void *)user_data);
// voice.languages = "en";
// espeak_SetVoiceByProperties(&voice);
espeak_SetVoiceByName("de");
espeak_Synth(textbuf, strlen(textbuf)+1, 0, POS_CHARACTER, 0, espeakSSML|espeakCHARS_UTF8, &unique_identifier, (void *)user_data);
// espeak_Synth(text1, strlen(text1)+1, 0, POS_CHARACTER, 0, espeakSSML|espeakCHARS_UTF8, &unique_identifier, (void *)(user_data+1));
// espeak_Synth(text1, strlen(text1)+1, 0, POS_CHARACTER, 0, espeakSSML|espeakCHARS_UTF8, &unique_identifier, (void *)(user_data+1));
espeak_SetParameter(espeakPUNCTUATION, 1, 0);
espeak_Synchronize();
+1 -1
View File
@@ -119,7 +119,7 @@ wxMenuBar *MakeMenu(int type, const char *dict_name)
option_menu = new wxMenu;
option_menu->Append(MENU_PATHS, _("Set &paths"), paths_menu);
option_menu->Append(MENU_OPT_SPEED, _("Speed..."));
option_menu->Append(MENU_OPT_PUNCT, _("Speak punctiation"));
option_menu->Append(MENU_OPT_PUNCT, _("Speak punctuation"));
option_menu->Append(MENU_OPT_SPELL, _("Speak character names"));
// TOOLS
+119 -49
View File
@@ -213,50 +213,74 @@ const int param_defaults[N_SPEECH_PARAM] = {
0, // voice type
};
#ifdef NEED_WCHAR_FUNCTIONS
// additional Latin characters beyond the Latin1 character set
#define MAX_WALPHA 0x233
// indexed by character - 0x100
// 0=not alphabetic, 0xff=lower case, 0xfe=special case
// additional Latin characters beyond the ascii character set
#define MAX_WALPHA 0x24f
// indexed by character - 0x80
// 0=not alphabetic, 0xff=lower case, 0xfe=no case, 0xfd=use wchar_tolower
// other=value to add to upper case to convert to lower case
static unsigned char walpha_tab[MAX_WALPHA-0xff] = {
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 100
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 110
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 120
0xfe,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1, // 130
0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, // 140
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 150
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 160
1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, // 170
0xff, 210, 1,0xff, 1,0xff, 206, 1,0xff, 205, 205, 1,0xff,0xff, 79, 202, // 180
203, 1,0xff, 205, 207,0xff, 211, 209, 1,0xff,0xff,0xff, 211, 213,0xff, 214, // 190
1,0xff, 1,0xff, 1,0xff, 218, 1,0xff, 218,0xff,0xff, 1,0xff, 218, 1, // 1a0
0xff, 217, 217, 1,0xff, 1,0xff, 219, 1,0xff,0xff,0xff, 1,0xff,0xff,0xff, // 1b0
0xff,0xff,0xff,0xff, 2, 1,0xff, 2, 1,0xff, 2, 1,0xff, 1,0xff, 1, // 1c0
0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, // 1d0
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1e0
0xff, 2, 1,0xff, 1,0xff,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1f0
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 200
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 210
0xff, 0, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 220
1,0xff, 1,0xff }; // 230
static unsigned char walpha_tab[MAX_WALPHA-0x7f] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 080
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 090
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xfe, 0, 0, 0, 0, 0, // 0a0
0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0xfe, 0, 0, 0, 0, 0, // 0b0
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, // 0c0
32, 32, 32, 32, 32, 32, 32, 0, 32, 32, 32, 32, 32, 32, 32, 0xff, // 0d0
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 0e0
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 0f0
1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, // 100
1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, // 110
1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, // 120
0xfd, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 0xfe, 1, 0xff, 1, 0xff, 1, 0xff, 1, // 130
0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 0xfe, 1, 0xff, 1, 0xff, 1, 0xff, // 140
1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, // 150
1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, // 160
1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 0xfd, 1, 0xff, 1, 0xff, 1, 0xff, 0xff, // 170
0xff, 210, 1, 0xff, 1, 0xff, 206, 1, 0xff, 205, 205, 1, 0xff, 0xfe, 79, 202, // 180
203, 1, 0xff, 205, 207, 0xff, 211, 209, 1, 0xff, 0xff, 0xfe, 211, 213, 0xff, 214, // 190
1, 0xff, 1, 0xff, 1, 0xff, 218, 1, 0xff, 218, 0xfe, 0xfe, 1, 0xff, 218, 1, // 1a0
0xff, 217, 217, 1, 0xff, 1, 0xff, 219, 1, 0xff, 0xfe, 0xfe, 1, 0xff, 0xfe, 0xff, // 1b0
0xfe, 0xfe, 0xfe, 0xfe, 2, 0xff, 0xff, 2, 0xff, 0xff, 2, 0xff, 0xff, 1, 0xff, 1, // 1c0
0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 0xff, 1, 0xff, // 1d0
1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, // 1e0
0xfe, 2, 0xff, 0xff, 1, 0xff, 0xfd, 0xfd, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, // 1f0
1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, // 200
1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, // 210
0xfd, 0xfe, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, // 220
1, 0xff, 1, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, 1, 0xff, 0xfd, 0xfd, 0xfe, // 230
0xfe, 1, 0xff, 0xfd, 69, 71, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff, 1, 0xff}; // 240
static const short wchar_tolower[] = {
0x130, 0x069,
0x178, 0x0ff,
0x1f6, 0x195,
0x1f7, 0x1bf,
0x220, 0x19e,
0x23a, 0x2c65,
0x23d, 0x19a,
0x23e, 0x2c66,
0x243, 0x180,
0x000, 0x000,
};
#ifdef NEED_WCHAR_FUNCTIONS
// use ctype.h functions for Latin1 (character < 0x100)
int iswalpha(int c)
{
if(c < 0x100)
if(c < 0x80)
return(isalpha(c));
if((c > 0x3040) && (c <= 0xa700))
return(1); // japanese, chinese characters
if(c > MAX_WALPHA)
return(0);
return(walpha_tab[c-0x100]);
return(walpha_tab[c-0x80]);
}
int iswdigit(int c)
{
if(c < 0x100)
if(c < 0x80)
return(isdigit(c));
return(0);
}
@@ -271,50 +295,63 @@ int iswalnum(int c)
int towlower(int c)
{
int x;
if(c < 0x100)
int ix;
if(c < 0x80)
return(tolower(c));
if((c > MAX_WALPHA) || ((x = walpha_tab[c-0x100])==0xff))
return(c); // already lower case
if(x == 0xfe)
if((c > MAX_WALPHA) || ((x = walpha_tab[c-0x80]) >= 0xfe))
return(c);
if(x == 0xfd)
{
// special cases
if(c == 0x130) // uppercase i-dot
return('i');
// special cases, lookup translation table
for(ix=0; wchar_tolower[ix] != 0; ix+=2)
{
if(wchar_tolower[ix] == c)
return(wchar_tolower[ix+1]);
}
}
return(c + x); // convert to lower case
}
int towupper(int c)
{
// check whether the previous character code is the upper-case equivalent of this character
if(tolower(c-1) == c)
return(c-1); // yes, use it
// check whether a previous character code is the upper-case equivalent of this character
if(towlower(c-32) == c)
return(c-32); // yes, use it
if(towlower(c-1) == c)
return(c-1);
if(towlower(c-2) == c)
return(c-2);
return(c); // no
}
int iswupper(int c)
{
int x;
if(c < 0x100)
if(c < 0x80)
return(isupper(c));
if(((c > MAX_WALPHA) || (x = walpha_tab[c-0x100])==0) || (x == 0xff))
if(((c > MAX_WALPHA) || (x = walpha_tab[c-0x80])==0) || (x == 0xff))
return(0);
return(1);
}
int iswlower(int c)
{
if(c < 0x100)
if(c < 0x80)
return(islower(c));
if((c > MAX_WALPHA) || (walpha_tab[c-0x100] != 0xff))
if((c > MAX_WALPHA) || (walpha_tab[c-0x80] != 0xff))
return(0);
return(1);
}
int iswspace(int c)
{
if(c < 0x100)
if(c < 0x80)
return(isspace(c));
if(c == 0xa0)
return(1);
return(0);
}
@@ -366,8 +403,26 @@ float wcstod(const wchar_t *str, wchar_t **tailptr)
}
#endif
// use internal data for iswalpha up to U+024F
// iswalpha() on Windows is unreliable (U+AA, U+BA).
int iswalpha2(int c)
{
if(c < 0x80)
return(isalpha(c));
if((c > 0x3040) && (c <= 0xa700))
return(1); // japanese, chinese characters
if(c > MAX_WALPHA)
return(iswalpha(c));
return(walpha_tab[c-0x80]);
}
int towlower2(unsigned int c)
{
int x;
int ix;
// check for non-standard upper to lower case conversions
if(c == 'I')
{
@@ -376,11 +431,26 @@ int towlower2(unsigned int c)
c = 0x131; // I -> ı
}
}
#ifdef __WIN32__
if(c == 0x130) // uppercase i-dot
return('i');
#endif
return(towlower(c));
if(c < 0x80)
return(tolower(c));
if(c > MAX_WALPHA)
return(towlower(c));
if((x = walpha_tab[c-0x80]) >= 0xfe)
return(c); // this is not an upper case letter
if(x == 0xfd)
{
// special cases, lookup translation table
for(ix=0; wchar_tolower[ix] != 0; ix+=2)
{
if(wchar_tolower[ix] == (int)c)
return(wchar_tolower[ix+1]);
}
}
return(c + x); // convert to lower case
}
+1 -1
View File
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.47.06 15.Apr.13";
const char *version_string = "1.47.07a 23.Apr.13";
const int version_phdata = 0x014701;
int option_device_number = -1;
+1
View File
@@ -844,6 +844,7 @@ Translator *SelectTranslator(const char *name)
tr->langopts.stress_rule = STRESSPOSN_1L;
tr->langopts.numbers = 1;
tr->langopts.accents = 2; // 'capital' after letter name
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 3; // don't count apostrophe
}
break;
+5 -2
View File
@@ -384,9 +384,12 @@ int IsAlpha(unsigned int c)
0
};
if(iswalpha(c))
if(iswalpha2(c))
return(1);
if(c < 0x300)
return(0);
if((c >= 0x901) && (c <= 0xdf7))
{
// Indic scripts: Devanagari, Tamil, etc
@@ -2957,7 +2960,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
if(UpperCaseInWord(tr, &sbuf[ix], c) == 1)
{
// convert to lower case and continue
c = towlower(c);
c = towlower2(c);
}
else
{
+1
View File
@@ -713,6 +713,7 @@ int IsDigit(unsigned int c);
int IsDigit09(unsigned int c);
int IsAlpha(unsigned int c);
int IsVowel(Translator *tr, int c);
int iswalpha2(int c);
int isspace2(unsigned int c);
int towlower2(unsigned int c);
void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa);
+1 -1
View File
@@ -601,7 +601,7 @@ voice_t *LoadVoice(const char *vname, int control)
// which directory to look for a named voice. List of voice names, must end in a space.
static const char *voices_asia =
"bn fa fa-pin hi hy hy-west id ka kn ku ml ms ne pa ta te tr vi vi-hue zh zh-yue ";
"bn fa fa-pin hi hy hy-west id ka kn ku ml ms ne pa ta te tr vi vi-hue vi-sgn zh zh-yue ";
static const char *voices_europe =
"an bg bs ca cs cy da de el en en-us es et fi fr fr-be ga hr hu is it lt lv mk nl no pl pt-pt ro ru sk sq sr sv ";