mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-12 00:46:50 +00:00
[1.29.04] Allow up to 10 parts in multiple-word entries in *_list files.
lang=hr: Recognize Roman numbers only when all-capitals. lang=en: Change to word-final [I] (phoneme [i]). git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@84 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+12
-5
@@ -384,12 +384,19 @@ int compile_line(char *linebuf, char *dict_line, int *hash)
|
||||
}
|
||||
length += n_flag_codes;
|
||||
|
||||
if((multiple_string != NULL) && (multiple_words > 0) && (multiple_words <= 4))
|
||||
if((multiple_string != NULL) && (multiple_words > 0))
|
||||
{
|
||||
dict_line[length++] = 40 + multiple_words;
|
||||
ix = multiple_string_end - multiple_string;
|
||||
memcpy(&dict_line[length],multiple_string,ix);
|
||||
length += ix;
|
||||
if(multiple_words > 10)
|
||||
{
|
||||
fprintf(f_log,"%5d: Two many parts in a multi-word entry: %d\n",linenum,multiple_words);
|
||||
}
|
||||
else
|
||||
{
|
||||
dict_line[length++] = 40 + multiple_words;
|
||||
ix = multiple_string_end - multiple_string;
|
||||
memcpy(&dict_line[length],multiple_string,ix);
|
||||
length += ix;
|
||||
}
|
||||
}
|
||||
dict_line[0] = length;
|
||||
|
||||
|
||||
+4
-3
@@ -36,7 +36,7 @@
|
||||
#include "translate.h"
|
||||
|
||||
|
||||
|
||||
int dictionary_skipwords;
|
||||
char dictionary_name[40];
|
||||
|
||||
extern MNEM_TAB mnem_flags[];
|
||||
@@ -2716,12 +2716,13 @@ int Translator::LookupDict2(char *word, char *word2, char *phonetic, unsigned in
|
||||
else
|
||||
if(flag > 40)
|
||||
{
|
||||
// flags 41,42,or 43 match more than one word
|
||||
// flags 41 to 50 match more than one word
|
||||
// This comes after the other flags
|
||||
n_chars = next - p;
|
||||
if(memcmp(word2,p,n_chars)==0)
|
||||
{
|
||||
dictionary_flags |= ((flag-40) << 5); // set (bits 5-7) to 1,2,or 3
|
||||
dictionary_flags |= FLAG_SKIPWORDS;
|
||||
dictionary_skipwords = (flag - 40);
|
||||
p = next;
|
||||
word_end = word2 + n_chars;
|
||||
}
|
||||
|
||||
@@ -214,9 +214,6 @@ int Translator::TranslateRoman(char *word, char *ph_out)
|
||||
static char *roman_numbers = "ixcmvld";
|
||||
static int roman_values[] = {1,10,100,1000,5,50,500};
|
||||
|
||||
if((langopts.numbers & NUM_ROMAN) == 0)
|
||||
return(0);
|
||||
|
||||
acc = 0;
|
||||
prev = 0;
|
||||
subtract = 0x7fff;
|
||||
|
||||
+11
-6
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.29.02 10.Sep.07";
|
||||
const char *version_string = "1.29.04 11.Sep.07";
|
||||
const int version_phdata = 0x012901;
|
||||
|
||||
int option_device_number = -1;
|
||||
@@ -204,7 +204,7 @@ static unsigned int LookupSound2(int index, unsigned int other_phcode, int contr
|
||||
{//================================================================================
|
||||
// control=1 get formant transition data only
|
||||
|
||||
int code;
|
||||
unsigned int code;
|
||||
unsigned int value, value2;
|
||||
|
||||
while((value = phoneme_index[index++]) != 0)
|
||||
@@ -223,12 +223,17 @@ static unsigned int LookupSound2(int index, unsigned int other_phcode, int contr
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(control==0)
|
||||
seq_len_adjust = value2 >> 8;
|
||||
if(control==0)
|
||||
{
|
||||
seq_len_adjust = value2 >> 8;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(control==0)
|
||||
seq_len_adjust = -(value2 >> 8);
|
||||
if(control==0)
|
||||
{
|
||||
seq_len_adjust = value2 >> 8;
|
||||
seq_len_adjust = -seq_len_adjust;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(control==0)
|
||||
|
||||
@@ -304,7 +304,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.max_initial_consonants = 5;
|
||||
tr->langopts.spelling_stress = 1;
|
||||
|
||||
tr->langopts.numbers = 0x1c0d + 0x4000 + NUM_ROMAN;
|
||||
tr->langopts.numbers = 0x1c0d + 0x4000 + NUM_ROMAN_UC;
|
||||
tr->langopts.numbers2 = 0x4a; // variant numbers before thousands,milliards
|
||||
tr->langopts.replace_chars = replace_cyrillic;
|
||||
tr->langopts.replacement_chars = replace_cyrillic_latin;
|
||||
|
||||
+14
-8
@@ -671,8 +671,12 @@ if((wmark > 0) && (wmark < 8))
|
||||
if(!found & ((word_flags & FLAG_UPPERS) != FLAG_FIRST_UPPER))
|
||||
{
|
||||
// either all upper or all lower case
|
||||
if((found = TranslateRoman(word,phonemes)) != 0)
|
||||
dictionary_flags |= FLAG_ABBREV; // don't spell capital Roman numbers as individual letters
|
||||
|
||||
if((langopts.numbers & NUM_ROMAN) || ((langopts.numbers & NUM_ROMAN_UC) && (word_flags & FLAG_ALL_UPPER)))
|
||||
{
|
||||
if((found = TranslateRoman(word,phonemes)) != 0)
|
||||
dictionary_flags |= FLAG_ABBREV; // don't spell capital Roman numbers as individual letters
|
||||
}
|
||||
}
|
||||
|
||||
if((wflags & FLAG_ALL_UPPER) && (clause_upper_count <= clause_lower_count) &&
|
||||
@@ -1233,7 +1237,8 @@ int Translator::TranslateWord2(char *word, WORD_TAB *wtab, int pre_pause, int ne
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= FLAG_SKIPWORDS_1;
|
||||
flags |= FLAG_SKIPWORDS;
|
||||
dictionary_skipwords = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1562,7 +1567,7 @@ int Translator::TranslateChar(char *ptr, int prev_in, unsigned int c, unsigned i
|
||||
|
||||
int ix;
|
||||
unsigned int word;
|
||||
unsigned int new_c, c2;
|
||||
unsigned int new_c, c2, c_lower;
|
||||
int upper_case = 0;
|
||||
static int ignore_next = 0;
|
||||
|
||||
@@ -1578,16 +1583,16 @@ int Translator::TranslateChar(char *ptr, int prev_in, unsigned int c, unsigned i
|
||||
|
||||
// there is a list of character codes to be substituted with alternative codes
|
||||
|
||||
if(iswupper(c))
|
||||
if(iswupper(c_lower = c))
|
||||
{
|
||||
c = towlower(c);
|
||||
c_lower = towlower(c);
|
||||
upper_case = 1;
|
||||
}
|
||||
|
||||
new_c = 0;
|
||||
for(ix=0; (word = langopts.replace_chars[ix]) != 0; ix++)
|
||||
{
|
||||
if(c == (word & 0xffff))
|
||||
if(c_lower == (word & 0xffff))
|
||||
{
|
||||
if((word >> 16) == 0)
|
||||
{
|
||||
@@ -2217,7 +2222,8 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
|
||||
else
|
||||
{
|
||||
dict_flags = TranslateWord2(word, &words[ix], words[ix].pre_pause, words[ix+1].pre_pause);
|
||||
ix += ((dict_flags >> 5) & 7); // dictionary indicates skip next word(s)
|
||||
if(dict_flags & FLAG_SKIPWORDS)
|
||||
ix += dictionary_skipwords; // dictionary indicates skip next word(s)
|
||||
|
||||
if((dict_flags & FLAG_DOT) && (ix == word_count-1) && (terminator == CLAUSE_PERIOD))
|
||||
{
|
||||
|
||||
+6
-3
@@ -34,8 +34,7 @@
|
||||
|
||||
/* flags from word dictionary */
|
||||
// bits 0-3 stressed syllable, 7=unstressed
|
||||
#define FLAG_SKIPWORDS 0xe0 /* bits 5,6,7 number of words to skip */
|
||||
#define FLAG_SKIPWORDS_1 0x20
|
||||
#define FLAG_SKIPWORDS 0x80
|
||||
#define FLAG_PREPAUSE 0x100
|
||||
#define FLAG_ONLY 0x200
|
||||
#define BITNUM_FLAG_ONLY 9 // bit 9 is set
|
||||
@@ -277,7 +276,8 @@ typedef struct {
|
||||
unsigned char *length_mods;
|
||||
unsigned char *length_mods0;
|
||||
|
||||
#define NUM_ROMAN 0x20000
|
||||
#define NUM_ROMAN 0x20000
|
||||
#define NUM_ROMAN_UC 0x40000
|
||||
// bits0-1=which numbers routine to use.
|
||||
// bit2= thousands separator must be space
|
||||
// bit3= , decimal separator, not .
|
||||
@@ -293,6 +293,7 @@ typedef struct {
|
||||
// bits13-15 post-decimal-digits 0=single digits, 1=(LANG=it) 2=(LANG=pl) 3=(LANG=ro)
|
||||
// bit16=dot after number indicates ordinal
|
||||
// bit17=recognize roman numbers
|
||||
// bit18=Roman numbers only if upper case
|
||||
|
||||
int numbers;
|
||||
|
||||
@@ -501,6 +502,8 @@ extern char ctrl_embedded; // to allow an alternative CTRL for embedded comma
|
||||
extern char *p_textinput;
|
||||
extern wchar_t *p_wchar_input;
|
||||
extern int ungot_char;
|
||||
extern int dictionary_skipwords;
|
||||
|
||||
extern int (* uri_callback)(int, const char *, const char *);
|
||||
extern int (* phoneme_callback)(const char *);
|
||||
extern void SetLengthMods(Translator *tr, int value);
|
||||
|
||||
Reference in New Issue
Block a user