Changes for numbers lang=vi
Undo a change for lang=hu which broke oridinal numbers.


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@256 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2010-12-20 10:29:42 +00:00
parent b89d8bde63
commit 347ff0e5bb
22 changed files with 316 additions and 95 deletions
+2 -2
View File
@@ -50,13 +50,13 @@ endif
speak_SOURCES = speak.cpp compiledict.cpp dictionary.cpp intonation.cpp \
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
synthdata.cpp synthesize.cpp translate.cpp mbrowrap.cpp \
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp klatt.cpp
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp klatt.cpp sonic.cpp
libespeak_SOURCES = speak_lib.cpp compiledict.cpp dictionary.cpp intonation.cpp \
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
synthdata.cpp synthesize.cpp translate.cpp mbrowrap.cpp \
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp \
espeak_command.cpp event.cpp fifo.cpp $(WAVE) debug.cpp klatt.cpp
espeak_command.cpp event.cpp fifo.cpp $(WAVE) debug.cpp klatt.cpp sonic.cpp
SRCS1=$(speak_SOURCES)
OBJS1=$(patsubst %.cpp,%.o,$(SRCS1))
+1 -1
View File
@@ -6,7 +6,7 @@ SRCS= compiledata.cpp compiledict.cpp debug.cpp dictionary.cpp espeak_command.cp
prosodydisplay.cpp readclause.cpp setlengths.cpp speak_lib.cpp spect.cpp \
spectdisplay.cpp spectseq.cpp synthdata.cpp synthesize.cpp synth_mbrola.cpp \
translate.cpp transldlg.cpp tr_languages.cpp voicedlg.cpp voices.cpp vowelchart.cpp \
wave.cpp wavegen.cpp
wave.cpp wavegen.cpp sonic.cpp
OBJS=$(patsubst %.cpp,%.o,$(SRCS))
+1 -1
View File
@@ -3338,7 +3338,7 @@ int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *f
}
else
{
flags[0] &= ~FLAG_SKIPWORDS;
// flags[0] &= ~FLAG_SKIPWORDS; // check lang=hu január 21.-ig (error: suffix repeated ??)
}
ph_out[0] = 0;
+40 -23
View File
@@ -1361,6 +1361,7 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
int ix;
int exact;
int ordinal;
int say_zero_hundred=0;
char string[12]; // for looking up entries in **_list
char buf1[100];
char buf2[100];
@@ -1379,7 +1380,12 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
ph_thousands[0] = 0;
ph_thousand_and[0] = 0;
if(hundreds > 0)
if((tr->langopts.numbers & NUM_ZERO_HUNDRED) && ((control & 1) || (hundreds >= 10)))
{
say_zero_hundred = 1; // lang=vi
}
if((hundreds > 0) || say_zero_hundred)
{
found = 0;
if(ordinal && (tensunits == 0))
@@ -1420,14 +1426,14 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
sprintf(ph_thousands,"%s%s",ph_digits,ph_10T);
hundreds %= 10;
if(hundreds == 0)
if((hundreds == 0) && (say_zero_hundred == 0))
ph_100[0] = 0;
suppress_null = 1;
}
ph_digits[0] = 0;
if(hundreds > 0)
if((hundreds > 0) || say_zero_hundred)
{
if((tr->langopts.numbers & NUM_AND_HUNDRED) && ((control & 1) || (ph_thousands[0] != 0)))
{
@@ -1452,28 +1458,35 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
}
}
if((!found) && (tensunits == 0))
if((hundreds == 0) && say_zero_hundred)
{
// is there a special pronunciation for exactly n00 ?
sprintf(string,"_%dC0",hundreds);
found = Lookup(tr, string, ph_digits);
}
if(!found)
{
sprintf(string,"_%dC",hundreds);
found = Lookup(tr, string, ph_digits); // is there a specific pronunciation for n-hundred ?
}
if(found)
{
ph_100[0] = 0;
Lookup(tr, "_0", ph_digits);
}
else
{
if((hundreds > 1) || ((tr->langopts.numbers & NUM_OMIT_1_HUNDRED) == 0))
if((!found) && (tensunits == 0))
{
LookupNum2(tr, hundreds, 0, ph_digits);
// is there a special pronunciation for exactly n00 ?
sprintf(string,"_%dC0",hundreds);
found = Lookup(tr, string, ph_digits);
}
if(!found)
{
sprintf(string,"_%dC",hundreds);
found = Lookup(tr, string, ph_digits); // is there a specific pronunciation for n-hundred ?
}
if(found)
{
ph_100[0] = 0;
}
else
{
if((hundreds > 1) || ((tr->langopts.numbers & NUM_OMIT_1_HUNDRED) == 0))
{
LookupNum2(tr, hundreds, 0, ph_digits);
}
}
}
}
@@ -1484,9 +1497,12 @@ static int LookupNum3(Translator *tr, int value, char *ph_out, int suppress_null
ph_hundred_and[0] = 0;
if(tensunits > 0)
{
if((tr->langopts.numbers & NUM_HUNDRED_AND) && ((value > 100) || ((control & 1) && (thousandplex==0))))
if((value > 100) || ((control & 1) && (thousandplex==0)))
{
Lookup(tr, "_0and", ph_hundred_and);
if((tr->langopts.numbers & NUM_HUNDRED_AND) || ((tr->langopts.numbers & NUM_HUNDRED_AND_DIGIT) && (tensunits < 10)))
{
Lookup(tr, "_0and", ph_hundred_and);
}
}
if((tr->langopts.numbers & NUM_THOUSAND_AND) && (hundreds == 0) && ((control & 1) || (ph_thousands[0] != 0)))
{
@@ -1622,8 +1638,9 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
word[ix] = 0;
}
if(ordinal == 0)
if((ordinal == 0) || (tr->translator_name == L('h','u')))
{
// NOTE lang=hu, allow both dot and ordinal suffix, eg. "december 21.-én"
// look for an ordinal number suffix after the number
ix++;
hyphen = 0;
+1 -1
View File
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.44.18 03.Dec.10";
const char *version_string = "1.44.19 20.Dec.10";
const int version_phdata = 0x014415;
int option_device_number = -1;
+1 -1
View File
@@ -1207,7 +1207,7 @@ SetLengthMods(tr,3); // all equal
tr->letter_groups[0] = tr->letter_groups[7] = vowels_vi;
tr->langopts.tone_language = 1; // Tone language, use CalcPitches_Tone() rather than CalcPitches()
tr->langopts.unstressed_wd1 = 2;
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_HUNDRED_AND | NUM_DFRACTION_4;
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_HUNDRED_AND_DIGIT | NUM_DFRACTION_4 | NUM_ZERO_HUNDRED;
}
break;
+8 -5
View File
@@ -395,13 +395,14 @@ typedef struct {
#define NUM_NOPAUSE 0x20000
#define NUM_AND_HUNDRED 0x40000
#define NUM_THOUSAND_AND 0x80000
#define NUM_VIGESIMAL 0x100000
#define NUM_VIGESIMAL 0x100000
#define NUM_OMIT_1_THOUSAND 0x200000
#define NUM_ROMAN 0x1000000
#define NUM_ZERO_HUNDRED 0x400000
#define NUM_HUNDRED_AND_DIGIT 0x800000
#define NUM_ROMAN 0x1000000
#define NUM_ROMAN_CAPITALS 0x2000000
#define NUM_ROMAN_AFTER 0x4000000
#define NUM_ROMAN_ORDINAL 0x8000000
#define NUM_ROMAN_AFTER 0x4000000
#define NUM_ROMAN_ORDINAL 0x8000000
// bits0-1=which numbers routine to use.
// bit2= thousands separator must be space
@@ -423,6 +424,8 @@ typedef struct {
// bit19= 'and' after thousands if there are no hundreds
// bit20= vigesimal number, if tens are not found
// bit21= omit "one" before "thousand"
// bit22= say "zero" before hundred
// bit23= add "and" after hundreds and thousands, only if there are digits and no tens
// bit24= recognize roman numbers
// bit25= Roman numbers only if upper case