Merge branch 'upstream' into development

Conflicts:
	dictsource/dict_phonemes
	phsource/compile_report
	phsource/ph_azerbaijani
This commit is contained in:
Reece H. Dunn
2013-04-25 23:22:14 +01:00
35 changed files with 852 additions and 237 deletions
+2 -2
View File
@@ -700,9 +700,9 @@ static int compile_line(char *linebuf, char *dict_line, int *hash)
ix = utf8_in(&c2,p);
if(c2 == 0)
break;
if(iswupper(c2))
if(iswupper2(c2))
{
utf8_out(towlower(c2),p);
utf8_out(towlower2(c2),p);
}
else
{
+29 -18
View File
@@ -520,7 +520,7 @@ void DecodePhonemes(const char *inptr, char *outptr)
unsigned short ipa1[96] = {
0x20,0x21,0x22,0x2b0,0x24,0x25,0x0e6,0x2c8,0x28,0x27e,0x2a,0x2b,0x2cc,0x2d,0x2e,0x2f,
0x252,0x31,0x32,0x25c,0x34,0x35,0x36,0x37,0x275,0x39,0x2d0,0x2b2,0x3c,0x3d,0x3e,0x294,
0x259,0x251,0x3b2,0xe7,0xf0,0x25b,0x46,0x262,0x127,0x26a,0x25f,0x4b,0x29f,0x271,0x14b,0x254,
0x259,0x251,0x3b2,0xe7,0xf0,0x25b,0x46,0x262,0x127,0x26a,0x25f,0x4b,0x26b,0x271,0x14b,0x254,
0x3a6,0x263,0x280,0x283,0x3b8,0x28a,0x28c,0x153,0x3c7,0xf8,0x292,0x32a,0x5c,0x5d,0x5e,0x5f,
0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x261,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,
0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x303,0x7f
@@ -629,10 +629,13 @@ char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int
void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa)
{//=========================================================================
/* Can be called after a clause has been translated into phonemes, in order
void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int phoneme_mode)
{//===============================================================================
/* Called after a clause has been translated into phonemes, in order
to display the clause in phoneme mnemonic form.
phoneme_mode bits 0-3: 0=only phoneme names, 1=ties, 2=ZWJ, 3=underscore separator
bit 4: 0=eSpeak phoneme names, 1=IPA
*/
int ix;
@@ -645,6 +648,8 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa)
char *buf;
int count;
int flags;
int use_ipa;
int use_tie;
int separate_phonemes = 0;
char phon_buf[30];
char phon_buf2[30];
@@ -653,15 +658,16 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa)
static const char *stress_chars = "==,,''";
static const int char_tie[] = {0x0361, 0x200d}; // combining-double-inverted-breve, zero-width-joiner
if(use_ipa >= 4)
use_ipa = phoneme_mode & 0x10;
use_tie = phoneme_mode & 0x0f;
if(use_tie >= 3)
{
// separate individual phonemes with underscores
separate_phonemes = '_';
if(use_ipa == 5)
use_ipa = 0;
else
use_ipa = 1;
use_tie = 0;
}
if(phon_out != NULL)
{
for(ix=1; ix<(n_phoneme_list-2); ix++)
@@ -669,13 +675,19 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa)
buf = phon_buf;
plist = &phoneme_list[ix];
WritePhMnemonic(phon_buf2, plist->ph, plist, use_ipa, &flags);
if(plist->newword)
*buf++ = ' ';
else
{
if((separate_phonemes != 0) && (ix > 1))
{
*buf++ = separate_phonemes;
utf8_in(&c, phon_buf2);
if((c < 0x2b0) || (c > 0x36f)) // not if the phoneme starts with a superscript letter
{
*buf++ = separate_phonemes;
}
}
}
@@ -707,17 +719,16 @@ void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa)
}
flags = 0;
WritePhMnemonic(phon_buf2, plist->ph, plist, use_ipa, &flags);
count = 0;
for(p=phon_buf2; *p != 0;)
{
p += utf8_in(&c, p);
if(use_ipa > 1)
if(use_tie > 0)
{
// look for non-inital alphabetic character, but not diacritic, superscript etc.
if((count>0) && !(flags & (1 << (count-1))) && ((c < 0x2b0) || (c > 0x36f)) && iswalpha(c))
if((count>0) && !(flags & (1 << (count-1))) && ((c < 0x2b0) || (c > 0x36f)) && iswalpha2(c))
{
buf += utf8_out(char_tie[use_ipa-2], buf);
buf += utf8_out(char_tie[use_tie-1], buf);
}
}
buf += utf8_out(c, buf);
@@ -923,7 +934,7 @@ int Unpronouncable(Translator *tr, char *word, int posn)
break;
}
if((c != '\'') && !iswalpha(c))
if((c != '\'') && !iswalpha2(c))
return(0);
}
@@ -2102,7 +2113,7 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
break;
case RULE_NONALPHA:
if(!iswalpha(letter_w))
if(!iswalpha2(letter_w))
{
add_points = (21-distance_right);
post_ptr += letter_xbytes;
@@ -2346,7 +2357,7 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
break;
case RULE_NONALPHA:
if(!iswalpha(letter_w))
if(!iswalpha2(letter_w))
{
add_points = (21-distance_right);
pre_ptr -= letter_xbytes;
@@ -2663,7 +2674,7 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
if(tr->letter_bits_offset > 0)
{
// not a Latin alphabet, switch to the default Latin alphabet language
if((letter <= 0x241) && iswalpha(letter))
if((letter <= 0x241) && iswalpha2(letter))
{
sprintf(phonemes,"%c%s",phonSWITCH,tr->langopts.ascii_language);
return(0);
+1 -1
View File
@@ -632,7 +632,7 @@ void OnOptions2(int event_id)
case MENU_PATH0:
string = wxFileSelector(_T("Master phonemes file"),wxFileName(path_phfile).GetPath(),
_T(""),_T(""),_T("*"),wxOPEN);
_T("phonemes"),_T(""),_T("*"),wxOPEN);
if(!string.IsEmpty())
{
path_phfile = string;
+22 -6
View File
@@ -1564,8 +1564,8 @@ void CountWordFreq(wxString path, wcount **hashtab)
for(k=0; k<ix; )
{
k += utf8_in(&wc,&buf[k]);
wc = towlower(wc); // convert to lower case
if(iswalpha(wc))
wc = towlower2(wc); // convert to lower case
if(iswalpha2(wc))
{
j += utf8_out(wc,&wbuf[j]);
n_chars++;
@@ -2324,13 +2324,28 @@ void Make_walpha_tab()
}
fprintf(f, "\nstatic const short wchar_tolower[] = {\n");
exceptions[ex] = 0;
exceptions[ex+1] = 0;
for(ix=0; ix<=ex; ix+=2)
for(ix=0; ix<ex; ix+=2)
{
fprintf(f,"\t0x%.3x, 0x%.3x,\n", exceptions[ix], exceptions[ix+1]);
}
fprintf(f, "};\n");
fprintf(f, "\t0,0 };\n");
fprintf(f, "\nstatic const short wchar_toupper[] = {\n");
for(ix=0x80; ix<=MAX_WALPHA; ix++)
{
if(iswlower(ix))
{
c = towupper(ix);
value = ix - c;
if((value != 32) && (value != 1))
{
fprintf(f,"\t0x%.3x, 0x%.3x,\n", ix, c);
}
}
}
fprintf(f, "\t0,0 };\n");
fclose(f);
}
@@ -2351,6 +2366,7 @@ void TestTest(int control)
//CharsetToUnicode("ISO-8859-4");
//CharsetToUnicode("ISCII");
if(control==2)
{
return;
+108 -5
View File
@@ -602,6 +602,77 @@ int NonAsciiNumber(int letter)
return(-1);
}
#define L_SUB 0x4000 // subscript
#define L_SUP 0x8000 // superscript
static const char *modifiers[] = {NULL, "_sub", "_sup", NULL};
// this list must be in ascending order
static unsigned short derived_letters[] = {
0x00aa, 'a'+L_SUP,
0x00b2, '2'+L_SUP,
0x00b3, '3'+L_SUP,
0x00b9, '1'+L_SUP,
0x00ba, 'o'+L_SUP,
0x02b0, 'h'+L_SUP,
0x02b1, 0x266+L_SUP,
0x02b2, 'j'+L_SUP,
0x02b3, 'r'+L_SUP,
0x02b4, 0x279+L_SUP,
0x02b5, 0x27b+L_SUP,
0x02b6, 0x281+L_SUP,
0x02b7, 'w'+L_SUP,
0x02b8, 'y'+L_SUP,
0x02c0, 0x294+L_SUP,
0x02c1, 0x295+L_SUP,
0x02e0, 0x263+L_SUP,
0x02e1, 'l'+L_SUP,
0x02e2, 's'+L_SUP,
0x02e3, 'x'+L_SUP,
0x2070, '0'+L_SUP,
0x2071, 'i'+L_SUP,
0x2074, '4'+L_SUP,
0x2075, '5'+L_SUP,
0x2076, '6'+L_SUP,
0x2077, '7'+L_SUP,
0x2078, '8'+L_SUP,
0x2079, '9'+L_SUP,
0x207a, '+'+L_SUP,
0x207b, '-'+L_SUP,
0x207c, '='+L_SUP,
0x207d, '('+L_SUP,
0x207e, ')'+L_SUP,
0x207f, 'n'+L_SUP,
0x2080, '0'+L_SUB,
0x2081, '1'+L_SUB,
0x2082, '2'+L_SUB,
0x2083, '3'+L_SUB,
0x2084, '4'+L_SUB,
0x2085, '5'+L_SUB,
0x2086, '6'+L_SUB,
0x2087, '7'+L_SUB,
0x2088, '8'+L_SUB,
0x2089, '9'+L_SUB,
0x208a, '+'+L_SUB,
0x208b, '-'+L_SUB,
0x208c, '='+L_SUB,
0x208d, '('+L_SUB,
0x208e, ')'+L_SUB,
0x2090, 'a'+L_SUB,
0x2091, 'e'+L_SUB,
0x2092, 'o'+L_SUB,
0x2093, 'x'+L_SUB,
0x2094, 0x259+L_SUB,
0x2095, 'h'+L_SUB,
0x2096, 'k'+L_SUB,
0x2097, 'l'+L_SUB,
0x2098, 'm'+L_SUB,
0x2099, 'n'+L_SUB,
0x209a, 'p'+L_SUB,
0x209b, 's'+L_SUB,
0x209c, 't'+L_SUB,
0,0};
static const char *hex_letters[] = {"'e:j","b'i:","s'i:","d'i:","'i:","'ef"}; // names, using phonemes available to all languages
@@ -617,8 +688,10 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
int letter;
int len;
int ix;
int c;
char *p2;
char *pbuf;
const char *modifier;
ALPHABET *alphabet;
int al_offset;
int al_flags;
@@ -626,7 +699,7 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
int number;
int phontab_1;
int speak_letter_number;
char capital[20];
char capital[30];
char ph_buf[80];
char ph_buf2[80];
char ph_alphabet[80];
@@ -648,13 +721,42 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
if(control & 2)
{
// include CAPITAL information
if(iswupper(letter))
if(iswupper2(letter))
{
Lookup(tr, "_cap", capital);
}
}
letter = towlower2(letter);
// is this a subscript or superscript letter ?
for(ix=0; (c = derived_letters[ix]) != 0; ix+=2)
{
if(c > letter)
break;
if(c == letter)
{
c = derived_letters[ix+1];
letter = c & 0x3fff;
if((modifier = modifiers[c >> 14]) != NULL)
{
Lookup(tr, modifier, capital);
if(capital[0] == 0)
{
capital[2] = SetTranslator2("en"); // overwrites previous contents of translator2
Lookup(translator2, modifier, &capital[3]);
if(capital[3] != 0)
{
capital[0] = phonPAUSE;
capital[1] = phonSWITCH;
len = strlen(&capital[3]);
capital[len+3] = phonSWITCH;
capital[len+4] = phontab_1;
capital[len+5] = 0;
}
}
}
}
}
LookupLetter(tr, letter, word[n_bytes], ph_buf, control & 1);
if(ph_buf[0] == phonSWITCH)
@@ -663,6 +765,7 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
return(0);
}
if((ph_buf[0] == 0) && ((number = NonAsciiNumber(letter)) > 0))
{
// convert a non-ascii number to 0-9
@@ -794,7 +897,7 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
speak_letter_number = 1;
if(!(al_flags & AL_NO_SYMBOL))
{
if(iswalpha(letter))
if(iswalpha2(letter))
Lookup(translator, "_?A", ph_buf);
if((ph_buf[0]==0) && !iswspace(letter))
@@ -2244,8 +2347,8 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
if((tr->langopts.numbers & NUM_NOPAUSE) && (next_char == ' '))
utf8_in(&next_char,p);
if(!iswalpha(next_char) && (thousands_exact==0))
// if(!iswalpha(next_char) && !((wtab[thousandplex].flags & FLAG_HYPHEN_AFTER) && (thousands_exact != 0)))
if(!iswalpha2(next_char) && (thousands_exact==0))
// if(!iswalpha2(next_char) && !((wtab[thousandplex].flags & FLAG_HYPHEN_AFTER) && (thousands_exact != 0)))
strcat(ph_out,str_pause); // don't add pause for 100s, 6th, etc.
}
+75 -14
View File
@@ -260,8 +260,25 @@ static const short wchar_tolower[] = {
0x23d, 0x19a,
0x23e, 0x2c66,
0x243, 0x180,
0x000, 0x000,
};
0,0 };
static const short wchar_toupper[] = {
0x0b5, 0x39c,
0x0df, 0x0df,
0x0ff, 0x178,
0x131, 0x049,
0x17f, 0x053,
0x180, 0x243,
0x195, 0x1f6,
0x19a, 0x23d,
0x19e, 0x220,
0x1bf, 0x1f7,
0x1c6, 0x1c4,
0x1c9, 0x1c7,
0x1cc, 0x1ca,
0x1dd, 0x18e,
0x1f3, 0x1f1,
0,0 };
#ifdef NEED_WCHAR_FUNCTIONS
@@ -317,13 +334,17 @@ int towlower(int c)
int towupper(int c)
{
int ix;
// 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);
for(ix=0; wchar_toupper[ix] != 0; ix+=2)
{
if(wchar_toupper[ix] == c)
return(wchar_toupper[ix+1]);
}
return(c); // no
}
@@ -417,6 +438,28 @@ int iswalpha2(int c)
return(walpha_tab[c-0x80]);
}
int iswlower2(int c)
{
if(c < 0x80)
return(islower(c));
if(c > MAX_WALPHA)
return(iswlower(c));
if(walpha_tab[c-0x80] == 0xff)
return(1);
return(0);
}
int iswupper2(int c)
{
int x;
if(c < 0x80)
return(isupper(c));
if(c > MAX_WALPHA)
return(iswupper(c));
if(((x = walpha_tab[c-0x80]) > 0) && (x < 0xfe))
return(1);
return(0);
}
int towlower2(unsigned int c)
{
@@ -426,7 +469,7 @@ int towlower2(unsigned int c)
// check for non-standard upper to lower case conversions
if(c == 'I')
{
if(translator->translator_name == L('t','r'))
if(translator->langopts.dotless_i)
{
c = 0x131; // I -> ı
}
@@ -453,6 +496,24 @@ int towlower2(unsigned int c)
return(c + x); // convert to lower case
}
int towupper2(unsigned int c)
{
int ix;
if(c > MAX_WALPHA)
return(towupper(c));
// check whether a previous character code is the upper-case equivalent of this character
if(towlower2(c-32) == c)
return(c-32); // yes, use it
if(towlower2(c-1) == c)
return(c-1);
for(ix=0; wchar_toupper[ix] != 0; ix+=2)
{
if(wchar_toupper[ix] == c)
return(wchar_toupper[ix+1]);
}
return(c); // no
}
static int IsRomanU(unsigned int c)
{//================================
@@ -2330,7 +2391,7 @@ f_input = f_in; // for GetC etc
c2 = ' ';
}
else
if((c2 == '/') || iswalpha(c2))
if((c2 == '/') || iswalpha2(c2))
{
// check for space in the output buffer for embedded commands produced by the SSML tag
if(ix > (n_buf - 20))
@@ -2513,10 +2574,10 @@ f_input = f_in; // for GetC etc
}
}
if(iswupper(c1))
if(iswupper2(c1))
{
tr->clause_upper_count++;
if((option_capitals == 2) && (sayas_mode == 0) && !iswupper(cprev))
if((option_capitals == 2) && (sayas_mode == 0) && !iswupper2(cprev))
{
char text_buf[40];
char text_buf2[30];
@@ -2533,7 +2594,7 @@ f_input = f_in; // for GetC etc
}
}
else
if(iswalpha(c1))
if(iswalpha2(c1))
tr->clause_lower_count++;
if(option_phoneme_input)
@@ -2602,8 +2663,8 @@ if(option_ssml) parag=1;
if(!iswspace(c1))
{
if(!IsAlpha(c1) || !iswlower(c1))
// if(iswdigit(c1) || (IsAlpha(c1) && !iswlower(c1)))
if(!IsAlpha(c1) || !iswlower2(c1))
// if(iswdigit(c1) || (IsAlpha(c1) && !iswlower2(c1)))
{
UngetC(c2);
ungot_char2 = c1;
@@ -2702,7 +2763,7 @@ if(option_ssml) parag=1;
if(nl_count==0)
{
if((c1 == ',') && (cprev == '.') && (tr->translator_name == L('h','u')) && iswdigit(cprev2) && (iswdigit(c_next) || (iswlower(c_next))))
if((c1 == ',') && (cprev == '.') && (tr->translator_name == L('h','u')) && iswdigit(cprev2) && (iswdigit(c_next) || (iswlower2(c_next))))
{
// lang=hu, fix for ordinal numbers, eg: "december 2., szerda", ignore ',' after ordinal number
c1 = CHAR_COMMA_BREAK;
@@ -2721,7 +2782,7 @@ if(option_ssml) parag=1;
}
else
{
if (iswlower(c_next) || (c_next=='-')) // hyphen is needed for lang-hu (eg. 2.-kal)
if (iswlower2(c_next) || (c_next=='-')) // hyphen is needed for lang-hu (eg. 2.-kal)
is_end_clause = 0; // only if followed by lower-case, (or if there is a XML tag)
}
}
@@ -2730,7 +2791,7 @@ if(option_ssml) parag=1;
{
is_end_clause = 0; // eg. u.s.a.'s
}
if(iswlower(c_next))
if(iswlower2(c_next))
{
// next word has no capital letter, this dot is probably from an abbreviation
// c1 = ' ';
+11
View File
@@ -1164,6 +1164,17 @@ ESPEAK_API void espeak_SetPhonemeTrace(int value, FILE *stream)
} // end of espeak_SetPhonemes
ESPEAK_API void espeak_TextToPhonemes(const void *text, char *buffer, int size, int textmode, int phonememode)
{//==============================================================================================================
/* phoneme_mode bits 0-3: 0=only phoneme names, 1=ties, 2=ZWJ, 3=underscore separator
bit 4: 0=eSpeak phoneme names, 1=IPA
*/
option_multibyte = textmode & 7;
TranslateClause(translator, NULL, text, NULL, NULL);
GetTranslatedPhonemeString(buffer, size, phonememode);
}
ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags)
{//=============================================================================
ENTER("espeak_CompileDictionary");
+1 -1
View File
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.47.07a 23.Apr.13";
const char *version_string = "1.47.07b 25.Apr.13";
const int version_phdata = 0x014701;
int option_device_number = -1;
+3 -9
View File
@@ -1953,20 +1953,14 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control)
if((option_phonemes > 0) || (phoneme_callback != NULL))
{
int use_ipa = 0;
int phoneme_mode = 0;
if(option_phonemes >= 3)
use_ipa = option_phonemes-2; // 1=ipa, 2=ipa with tie, 3=ipa with ZWJ, 4=ipa with separators
phoneme_mode = 0x10 + option_phonemes-3; // 0x10=ipa, 0x11=ipa with tie, 0x12=ipa with ZWJ, 0x13=ipa with separators
GetTranslatedPhonemeString(translator->phon_out, sizeof(translator->phon_out), use_ipa);
GetTranslatedPhonemeString(translator->phon_out, sizeof(translator->phon_out), phoneme_mode);
if(option_phonemes > 0)
{
fprintf(f_trans,"%s\n",translator->phon_out);
if(!iswalpha(0x010d))
{
// check that c-caron is recognized as an alphabetic character
fprintf(stderr,"Warning: Accented letters are not recognized, eg: U+010D\nSet LC_CTYPE to a UTF-8 locale\n");
}
}
if(phoneme_callback != NULL)
{
+3 -1
View File
@@ -972,7 +972,7 @@ SetLengthMods(tr,3); // all equal
SetLetterBits(tr,LETTERGP_VOWEL2,hy_vowels);
SetLetterBits(tr,LETTERGP_C,hy_consonants);
tr->langopts.max_initial_consonants = 6;
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED;
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_OMIT_1_HUNDRED;
// tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
}
break;
@@ -1290,6 +1290,7 @@ SetLengthMods(tr,3); // all equal
ResetLetterBits(tr,0x2);
SetLetterBits(tr,1,"bcdfgjkmnpqstvxz"); // B hard consonants, excluding h,l,r,w,y
tr->langopts.param[LOPT_ALT] = 2; // call ApplySpecialAttributes2() if a word has $alt or $alt2
tr->langopts.accents = 2; // 'capital' after letter name
}
break;
@@ -1521,6 +1522,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 = S_NO_AUTO_2; //no automatic secondary stress
tr->langopts.dotless_i = 1;
tr->langopts.param[LOPT_SUFFIX] = 1;
if(name2 == L('a','z'))
+15 -15
View File
@@ -624,7 +624,7 @@ int IsAllUpper(const char *word)
while((*word != 0) && !isspace2(*word))
{
word += utf8_in(&c, word);
if(!iswupper(c))
if(!iswupper2(c))
return(0);
}
return(1);
@@ -1053,7 +1053,7 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
}
}
if((wflags & FLAG_ALL_UPPER) && (word_length > 1)&& iswalpha(first_char))
if((wflags & FLAG_ALL_UPPER) && (word_length > 1)&& iswalpha2(first_char))
{
if((option_tone_flags & OPTION_EMPHASIZE_ALLCAPS) && !(dictionary_flags[0] & FLAG_ABBREV))
{
@@ -1632,7 +1632,7 @@ if(end_type & SUFX_UNPRON)
tr->expect_past--;
}
if((word_length == 1) && (tr->translator_name == L('e','n')) && iswalpha(first_char) && (first_char != 'i'))
if((word_length == 1) && (tr->translator_name == L('e','n')) && iswalpha2(first_char) && (first_char != 'i'))
{
// English Specific !!!!
// any single letter before a dot is an abbreviation, except 'I'
@@ -1908,7 +1908,7 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
while(*p2 != ' ') p2++;
utf8_in(&c_word2, p2+1); // first character of the next word;
if(!iswalpha(c_word2))
if(!iswalpha2(c_word2))
{
ok =0;
}
@@ -2376,9 +2376,9 @@ static int SubstituteChar(Translator *tr, unsigned int c, unsigned int next_in,
// there is a list of character codes to be substituted with alternative codes
if(iswupper(c_lower = c))
if(iswupper2(c_lower = c))
{
c_lower = towlower(c);
c_lower = towlower2(c);
upper_case = 1;
}
@@ -2392,7 +2392,7 @@ static int SubstituteChar(Translator *tr, unsigned int c, unsigned int next_in,
new_c = replace_chars[ix+1];
break;
}
if((word >> 16) == (unsigned int)towlower(next_in))
if((word >> 16) == (unsigned int)towlower2(next_in))
{
new_c = replace_chars[ix+1];
ignore_next = 1;
@@ -2409,14 +2409,14 @@ static int SubstituteChar(Translator *tr, unsigned int c, unsigned int next_in,
// there is a second character to be inserted
// don't convert the case of the second character unless the next letter is also upper case
c2 = new_c >> 16;
if(upper_case && iswupper(next_in))
c2 = towupper(c2);
if(upper_case && iswupper2(next_in))
c2 = towupper2(c2);
*insert = c2;
new_c &= 0xffff;
}
if(upper_case)
new_c = towupper(new_c);
new_c = towupper2(new_c);
*wordflags |= FLAG_CHAR_REPLACED;
return(new_c);
@@ -2480,7 +2480,7 @@ static int TranslateChar(Translator *tr, char *ptr, int prev_in, unsigned int c,
// look for 'n and replace by a special character (unicode: schwa)
if(!iswalpha(prev_in))
if(!iswalpha2(prev_in))
{
utf8_in(&next2, &ptr[1]);
@@ -2910,7 +2910,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
}
else
{
if(iswupper(c))
if(iswupper2(c))
word_flags |= FLAG_FIRST_UPPER;
if((prev_out == ' ') && iswdigit(sbuf[ix-2]) && !iswdigit(prev_in))
@@ -2939,7 +2939,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
}
}
if(iswupper(c))
if(iswupper2(c))
{
c = towlower2(c);
@@ -2954,7 +2954,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
}
else
{
if((iswlower(prev_in)) && (prev_in != 0xba)) // Windows thinks masc.ordinal (0xba) is lower-case
if(iswlower2(prev_in))
{
// lower case followed by upper case in a word
if(UpperCaseInWord(tr, &sbuf[ix], c) == 1)
@@ -2970,7 +2970,7 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
// next_word_flags |= FLAG_NOSPACE; // problem: prevents FLAG_HAS_DOT being set
}
}
else if((c != ' ') && iswupper(prev_in) && iswlower(next_in))
else if((c != ' ') && iswupper2(prev_in) && iswlower2(next_in))
{
int next2_in;
utf8_in(&next2_in,&source[source_index + next_in_nbytes]);
+5 -1
View File
@@ -542,6 +542,7 @@ typedef struct {
char tone_numbers;
char ideographs; // treat as separate words
char textmode; // the meaning of FLAG_TEXTMODE is reversed (to save data when *_list file is compiled)
char dotless_i; // uses letter U+0131
int testing; // testing options: bit 1= specify stressed syllable in the form: "outdoor/2"
int listx; // compile *_listx after *list
const unsigned int *replace_chars; // characters to be substitutes
@@ -715,8 +716,11 @@ int IsAlpha(unsigned int c);
int IsVowel(Translator *tr, int c);
int iswalpha2(int c);
int isspace2(unsigned int c);
int iswlower2(int c);
int iswupper2(int c);
int towlower2(unsigned int c);
void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int use_ipa);
int towupper2(unsigned int c);
void GetTranslatedPhonemeString(char *phon_out, int n_phon_out, int phoneme_mode);
const char *WordToString2(unsigned int word);
ALPHABET *AlphabetFromChar(int c);
ALPHABET *AlphabetFromName(const char *name);
+1 -1
View File
@@ -460,7 +460,7 @@ void TranslDlg::OnCommand(wxCommandEvent& event)
t_phonetic->SetDefaultStyle(style_phonetic_large);
translate_text = 3;
use_ipa = 1;
use_ipa = 0x10;
break;
case T_PROCESS:
+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 vi-sgn zh zh-yue ";
"az 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 ";