[1.47.15]

Language changes to: an, en, gu, it, pt, ta.

Superscripts and subscripts are spoken as single letters and numbers during njormal speech, and with "superscript" and "subscript" spoken when spelling.


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@367 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2013-12-22 12:51:23 +00:00
parent e8b87dbf8c
commit 1ca65a170f
26 changed files with 6998 additions and 6523 deletions
+1 -1
View File
@@ -1932,7 +1932,7 @@ int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, cha
if((f_out = fopen_log(fname_out,"wb+")) == NULL)
{
if(fname_err)
strcpy(fname_err,fname_in);
strcpy(fname_err,fname_out);
return(-1);
}
sprintf(fname_temp,"%s%ctemp",path_home,PATHSEP);
+7
View File
@@ -905,6 +905,7 @@ int Unpronouncable(Translator *tr, char *word, int posn)
int vowel_posn=9;
int index;
int count;
ALPHABET *alphabet;
utf8_in(&c,word);
if((tr->letter_bits_offset > 0) && (c < 0x241))
@@ -913,6 +914,12 @@ int Unpronouncable(Translator *tr, char *word, int posn)
return(0); // so we can re-translate the word as English
}
if(((alphabet = AlphabetFromChar(c)) != NULL) && (alphabet->offset != tr->letter_bits_offset))
{
// Character is not in our alphabet
return(0);
}
if(tr->langopts.param[LOPT_UNPRONOUNCABLE] == 1)
return(0);
+35 -21
View File
@@ -676,6 +676,25 @@ static unsigned short derived_letters[] = {
static const char *hex_letters[] = {"'e:j","b'i:","s'i:","d'i:","'i:","'ef"}; // names, using phonemes available to all languages
int IsSuperscript(int letter)
{//===========================
// is this a subscript or superscript letter ?
int ix;
int c;
for(ix=0; (c = derived_letters[ix]) != 0; ix+=2)
{
if(c > letter)
break;
if(c == letter)
return(derived_letters[ix+1]);
}
return(0);
}
int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
{//=========================================================================
// get pronunciation for an isolated letter
@@ -732,30 +751,25 @@ int TranslateLetter(Translator *tr, char *word, char *phonemes, int control)
if(ph_buf[0] == 0)
{
// is this a subscript or superscript letter ?
for(ix=0; (c = derived_letters[ix]) != 0; ix+=2)
if((c = IsSuperscript(letter)) != 0)
{
if(c > letter)
break;
if(c == letter)
letter = c & 0x3fff;
if((control & 4 ) && ((modifier = modifiers[c >> 14]) != NULL))
{
c = derived_letters[ix+1];
letter = c & 0x3fff;
if((modifier = modifiers[c >> 14]) != NULL)
// don't say "superscript" during normal text reading
Lookup(tr, modifier, capital);
if(capital[0] == 0)
{
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[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;
}
capital[0] = phonPAUSE;
capital[1] = phonSWITCH;
len = strlen(&capital[3]);
capital[len+3] = phonSWITCH;
capital[len+4] = phontab_1;
capital[len+5] = 0;
}
}
}
@@ -1209,7 +1223,7 @@ int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab)
p = &ph_out[strlen(ph_roman)];
}
sprintf(number_chars," %d ",acc);
sprintf(number_chars," %d %s ",acc, tr->langopts.roman_suffix);
if(word[0] == '.')
{
+1 -1
View File
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.47.14 29.Nov.13";
const char *version_string = "1.47.15 22.Dec.13";
const int version_phdata = 0x014709;
int option_device_number = -1;
+19 -11
View File
@@ -193,10 +193,13 @@ static const unsigned short chars_ignore_default[] = {
// alternatively, ignore characters but allow zero-width-non-joiner (lang-fa)
static const unsigned short chars_ignore_zwnj_hyphen[] = {
0xad, 1, // soft hyphen
0x640, 1, // igniore Arabic Tatweel (lang=FA)
0x200c, '-', // zero width non-joiner, replace with hyphen
0x200d, 1, // zero width joiner
0, 0 };
const char string_ordinal[] = {0xc2,0xba,0}; // masculine ordinal character, UTF-8
static Translator* NewTranslator(void)
{//===================================
@@ -293,6 +296,7 @@ static const char transpose_map_latin[] = {
tr->langopts.replace_chars = NULL;
tr->langopts.ascii_language[0] = 0; // Non-Latin alphabet languages, use this language to speak Latin words, default is English
tr->langopts.alt_alphabet_lang = L('e','n');
tr->langopts.roman_suffix = "";
SetLengthMods(tr,201);
// tr->langopts.length_mods = length_mods_en;
@@ -752,7 +756,9 @@ Translator *SelectTranslator(const char *name)
if(name2 == L('a','n'))
{
tr->langopts.stress_flags = S_FINAL_SPANISH | S_FINAL_DIM_ONLY | S_FINAL_NO_2;
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_AND_UNITS | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_ROMAN | NUM_ROMAN_ORDINAL;
tr->langopts.numbers2 = NUM2_ORDINAL_NO_AND;
tr->langopts.roman_suffix = string_ordinal;
}
else
if(name2 == L_pap)
@@ -1657,21 +1663,23 @@ SetLengthMods(tr,3); // all equal
tr->translator_name = name2;
if(tr->langopts.numbers & NUM_DECIMAL_COMMA)
{
// use . and ; for thousands and decimal separators
tr->langopts.thousands_sep = '.';
tr->langopts.decimal_sep = ',';
}
if(tr->langopts.numbers & NUM_THOUS_SPACE)
{
tr->langopts.thousands_sep = 0; // don't allow thousands separator, except space
}
return(tr);
} // end of SelectTranslator
void ProcessLanguageOptions(LANGUAGE_OPTIONS *langopts)
{//=====================================================
if(langopts->numbers & NUM_DECIMAL_COMMA)
{
// use . and ; for thousands and decimal separators
langopts->thousands_sep = '.';
langopts->decimal_sep = ',';
}
if(langopts->numbers & NUM_THOUS_SPACE)
{
langopts->thousands_sep = 0; // don't allow thousands separator, except space
}
}
//**********************************************************************************************************
+2 -2
View File
@@ -1180,9 +1180,9 @@ if(end_type & SUFX_UNPRON)
{
int wc;
// characters not recognised, speak them individually
// ?? should we say super/sub-script numbers and letters here?
utf8_in(&wc, wordx);
if((word_length == 1) && IsAlpha(wc))
if((word_length == 1) && (IsAlpha(wc) || IsSuperscript(wc)))
{
if((wordx = SpeakIndividualLetters(tr, wordx, phonemes, spell_word)) == NULL)
{
+3
View File
@@ -533,6 +533,7 @@ typedef struct {
int decimal_sep;
int max_digits; // max number of digits which can be spoken as an integer number (rather than individual digits)
const char *ordinal_indicator; // UTF-8 string
const char *roman_suffix; // add this (ordinal) suffix to Roman numbers (LANG=an)
// bit 0, accent name before the letter name, bit 1 "capital" after letter name
int accents;
@@ -722,6 +723,7 @@ int IsDigit(unsigned int c);
int IsDigit09(unsigned int c);
int IsAlpha(unsigned int c);
int IsVowel(Translator *tr, int c);
int IsSuperscript(int letter);
int iswalpha2(int c);
int isspace2(unsigned int c);
int iswlower2(int c);
@@ -736,6 +738,7 @@ ALPHABET *AlphabetFromName(const char *name);
Translator *SelectTranslator(const char *name);
int SetTranslator2(const char *name);
void DeleteTranslator(Translator *tr);
void ProcessLanguageOptions(LANGUAGE_OPTIONS *langopts);
int Lookup(Translator *tr, const char *word, char *ph_out);
int LookupFlags(Translator *tr, const char *word);
+1
View File
@@ -881,6 +881,7 @@ voice_t *LoadVoice(const char *vname, int control)
}
while(isalnum(*p)) p++;
}
ProcessLanguageOptions(langopts);
break;
case V_REPLACE: