[1.46.28]

Ignore character U+00AD (soft hyphen) in text.
Added stress rule code for Lang=kl (Greenlandic).
Changes to languages: it, ta, si


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@294 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2012-11-16 10:02:19 +00:00
parent 066a898548
commit dfb316c05d
19 changed files with 339 additions and 59 deletions
+34
View File
@@ -1129,6 +1129,7 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
int stressflags;
int dflags = 0;
int first_primary;
int long_vowel;
signed char vowel_stress[N_WORD_PHONEMES/2];
char syllable_weight[N_WORD_PHONEMES/2];
@@ -1444,6 +1445,39 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
vowel_stress[ix] = 4;
}
break;
case 12: // LANG=kl (Greenlandic)
long_vowel = 0;
for(ix=1; ix < vowel_count; ix++)
{
if(vowel_stress[ix] == 4)
vowel_stress[ix] = 3; // change marked stress (consonant clusters) to secondary (except the last)
if(vowel_length[ix] > 0)
{
long_vowel = ix;
vowel_stress[ix] = 3; // give secondary stress to all long vowels
}
}
// 'stressed_syllable' gives the last marked stress
if(stressed_syllable == 0)
{
// no marked stress, choose the last long vowel
if(long_vowel > 0)
stressed_syllable = long_vowel;
else
{
// no long vowels or consonant clusters
if(vowel_count > 4)
stressed_syllable = vowel_count - 3;
else
stressed_syllable = vowel_count - 1;
}
}
vowel_stress[stressed_syllable] = 4;
max_stress = 4;
break;
}
/* now guess the complete stress pattern */
+56 -12
View File
@@ -1146,6 +1146,7 @@ static int LookupNum2(Translator *tr, int value, const int control, char *ph_out
// control bit 3: use feminine form of '2' (for thousands
// control bit 4: speak zero tens
// control bit 5: variant of ordinal number (lang=hu)
// bit 8 followed by decimal fraction
int found;
int ix;
@@ -1385,6 +1386,22 @@ static int LookupNum2(Translator *tr, int value, const int control, char *ph_out
}
}
if(tr->langopts.numbers & NUM_SINGLE_STRESS_L)
{
// only one primary stress, on the first part (tens)
found = 0;
for(ix=0; ix < (signed)strlen(ph_out); ix++)
{
if(ph_out[ix] == phonSTRESS_P)
{
if(found)
ph_out[ix] = phonSTRESS_3;
else
found = 1;
}
}
}
else
if(tr->langopts.numbers & NUM_SINGLE_STRESS)
{
// only one primary stress
@@ -1410,6 +1427,7 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
// control bit 0, previous thousands
// bit 1, ordinal number
// bit 5 variant form of ordinal number
// bit 8 followed by decimal fraction
int found;
int hundreds;
int tensunits;
@@ -1610,7 +1628,7 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
x = 8; // use variant (feminine) for before thousands and millions
}
if(LookupNum2(tr, tensunits, x, buf2) != 0)
if(LookupNum2(tr, tensunits, x | control & 0x100, buf2) != 0)
{
if(tr->langopts.numbers & NUM_SINGLE_AND)
ph_hundred_and[0] = 0; // don't put 'and' after 'hundred' if there's 'and' between tens and units
@@ -1858,7 +1876,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
{
// this "word" ends with a decimal point
Lookup(tr, "_dpt", ph_append);
decimal_point = 1;
decimal_point = 0x100;
}
else
if(suppress_null == 0)
@@ -1913,6 +1931,7 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
// if((buf_digit_lookup[0] == 0) && (*p != '0') && (dot_ordinal==0))
if((buf_digit_lookup[0] == 0) && (*p != '0'))
{
// LANG=hu ?
// not found, lookup only the last digit (?? but not if dot-ordinal has been found)
if(LookupDictList(tr, &p, buf_digit_lookup, flags, FLAG_SUFX, wtab)) // don't match '0', or entries with $only
{
@@ -1920,24 +1939,38 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
}
}
if((tr->langopts.numbers2 & NUM2_PERCENT_BEFORE) && (prev_thousands == 0))
if(prev_thousands == 0)
{
// LANG=si, say "percent" before the number
p2 = word;
while((*p2 != ' ') && (*p2 != 0))
if((decimal_point == 0) && (ordinal == 0))
{
p2++;
// Look for special pronunciation for this number in isolation (LANG=kl)
sprintf(string, "_%dn", value);
if(Lookup(tr, string, ph_out))
{
return(1);
}
}
if(p2[1] == '%')
if(tr->langopts.numbers2 & NUM2_PERCENT_BEFORE)
{
Lookup(tr, "%", ph_out);
ph_out += strlen(ph_out);
p2[1] = ' ';
// LANG=si, say "percent" before the number
p2 = word;
while((*p2 != ' ') && (*p2 != 0))
{
p2++;
}
if(p2[1] == '%')
{
Lookup(tr, "%", ph_out);
ph_out += strlen(ph_out);
p2[1] = ' ';
}
}
}
}
LookupNum3(tr, value, ph_buf, suppress_null, thousandplex, prev_thousands | ordinal);
LookupNum3(tr, value, ph_buf, suppress_null, thousandplex, prev_thousands | ordinal | decimal_point);
if((thousandplex > 0) && (tr->langopts.numbers2 & 0x200))
sprintf(ph_out,"%s%s%s%s",ph_zeros,ph_append,ph_buf2,ph_buf); // say "thousands" before its number
else
@@ -2005,6 +2038,17 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
n_digits += decimal_count;
}
break;
case NUM_DFRACTION_7:
// alternative form of decimal fraction digits, except the final digit
while(decimal_count-- > 1)
{
sprintf(string,"_%cd", word[n_digits]);
if(Lookup(tr, string, buf1) == 0)
break;
n_digits++;
strcat(ph_out, buf1);
}
}
}
+1 -1
View File
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.46.27 21.Oct.12";
const char *version_string = "1.46.28 16.Nov.12";
const int version_phdata = 0x014624;
int option_device_number = -1;
+11 -1
View File
@@ -113,12 +113,14 @@ static void SetLetterBitsRange(Translator *tr, int group, int first, int last)
// ignore these characters
static const unsigned short chars_ignore_default[] = {
0xad, 1, // soft hyphtn
0x200c, 1, // zero width non-joiner
0x200d, 1, // zero width joiner
0, 0 };
// alternatively, ignore characters but allow zero-width-non-joiner (lang-fa)
static const unsigned short chars_ignore_zwnj_hyphen[] = {
0xad, 1, // soft hyphen
0x200c, '-', // zero width non-joiner, replace with hyphen
0x200d, 1, // zero width joiner
0, 0 };
@@ -943,6 +945,14 @@ SetLengthMods(tr,3); // all equal
}
break;
case L('k','l'): // Greenlandic
{
tr->langopts.stress_rule = 12;
tr->langopts.stress_flags = S_NO_AUTO_2;
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_ORDINAL_DOT | NUM_1900 | NUM_ROMAN | NUM_ROMAN_CAPITALS | NUM_ROMAN_ORDINAL;
}
break;
case L('k','o'): // Korean, TEST
{
static const char ko_ivowels[] = {0x63,0x64,0x67,0x68,0x6d,0x72,0x74,0x75,0}; // y and i vowels
@@ -1207,7 +1217,7 @@ SetLengthMods(tr,3); // all equal
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
tr->langopts.suffix_add_e = tr->letter_bits_offset + 0x4a; //virama
tr->langopts.numbers = NUM_OMIT_1_THOUSAND;
tr->langopts.numbers = NUM_OMIT_1_THOUSAND | NUM_SINGLE_STRESS_L | NUM_DFRACTION_7;
tr->langopts.numbers2 = NUM2_PERCENT_BEFORE;
tr->langopts.break_numbers = 0x14aa8; // for languages which have numbers for 100,000 and 100,00,000, eg Hindi
}
+3
View File
@@ -402,6 +402,7 @@ typedef struct {
#define NUM_DFRACTION_4 0x8000
#define NUM_DFRACTION_5 0xa000
#define NUM_DFRACTION_6 0xc000
#define NUM_DFRACTION_7 0xe000 // lang=si, alternative form of number for decimal fraction digits (except the last)
#define NUM_ORDINAL_DOT 0x10000
#define NUM_NOPAUSE 0x20000
#define NUM_AND_HUNDRED 0x40000
@@ -414,6 +415,7 @@ typedef struct {
#define NUM_ROMAN_CAPITALS 0x2000000
#define NUM_ROMAN_AFTER 0x4000000
#define NUM_ROMAN_ORDINAL 0x8000000
#define NUM_SINGLE_STRESS_L 0x10000000
// bits0-1=which numbers routine to use.
// bit2= thousands separator must be space
@@ -442,6 +444,7 @@ typedef struct {
// bit25= Roman numbers only if upper case
// bit26= say "roman" after the number, not before
// bit27= Roman numbers are ordinal numbers
// bit28= only one primary stress in tens+units (on the tens)
int numbers;
#define NUM2_THOUSANDS_VAR1 0x40