mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-12-02 14:42:45 +00:00
[1.30.03] lang=sv: update dictionary.
lang=jbo (lojban): initial draft. Linux: look for env variable ESPEAK_DATA_PATH git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@117 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
@@ -208,6 +208,7 @@ int Translator::TranslateRoman(char *word, char *ph_out)
|
||||
int prev;
|
||||
int value;
|
||||
int subtract;
|
||||
int repeat = 0;
|
||||
unsigned int flags;
|
||||
char number_chars[N_WORD_BYTES];
|
||||
|
||||
@@ -224,6 +225,14 @@ int Translator::TranslateRoman(char *word, char *ph_out)
|
||||
return(0);
|
||||
|
||||
value = roman_values[p2 - roman_numbers];
|
||||
if(value == prev)
|
||||
{
|
||||
repeat++;
|
||||
if(repeat >= 3)
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
repeat = 0;
|
||||
|
||||
if((prev==5) || (prev==50) || (prev==500))
|
||||
{
|
||||
|
||||
+28
-15
@@ -498,27 +498,40 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
|
||||
{
|
||||
int x;
|
||||
|
||||
if(langopts.vowel_pause && (ph->type != phPAUSE) && (next->type == phVOWEL))
|
||||
if(langopts.vowel_pause && (ph->type != phPAUSE))
|
||||
{
|
||||
if(langopts.vowel_pause & 0x04)
|
||||
|
||||
if((ph->type != phVOWEL) && (langopts.vowel_pause & 0x200))
|
||||
{
|
||||
// break before a word which starts with a vowel
|
||||
insert_ph = phonPAUSE_VSHORT;
|
||||
// add a pause after a word which ends in a consonant
|
||||
insert_ph = phonPAUSE_NOLINK;
|
||||
}
|
||||
|
||||
if((ph->type == phVOWEL) && ((x = langopts.vowel_pause & 0x03) != 0))
|
||||
if(next->type == phVOWEL)
|
||||
{
|
||||
// adjacent vowels over a word boundary
|
||||
if(x == 2)
|
||||
if((x = langopts.vowel_pause & 0x0c) != 0)
|
||||
{
|
||||
// break before a word which starts with a vowel
|
||||
if(x == 0xc)
|
||||
insert_ph = phonPAUSE_NOLINK;
|
||||
else
|
||||
insert_ph = phonPAUSE_VSHORT;
|
||||
}
|
||||
|
||||
if((ph->type == phVOWEL) && ((x = langopts.vowel_pause & 0x03) != 0))
|
||||
{
|
||||
// adjacent vowels over a word boundary
|
||||
if(x == 2)
|
||||
insert_ph = phonPAUSE_SHORT;
|
||||
else
|
||||
insert_ph = phonPAUSE_VSHORT;
|
||||
}
|
||||
|
||||
if(((plist2+1)->stress >= 4) && (langopts.vowel_pause & 0x100))
|
||||
{
|
||||
// pause before a words which starts with a stressed vowel
|
||||
insert_ph = phonPAUSE_SHORT;
|
||||
else
|
||||
insert_ph = phonPAUSE_VSHORT;
|
||||
}
|
||||
|
||||
if(((plist2+1)->stress >= 4) && (langopts.vowel_pause & 0x08))
|
||||
{
|
||||
// pause before a words which starts with a stressed vowel
|
||||
insert_ph = phonPAUSE_SHORT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -260,13 +260,13 @@ static void init_path(char *argv0)
|
||||
#ifdef PLATFORM_DOS
|
||||
strcpy(path_home,PATH_ESPEAK_DATA);
|
||||
#else
|
||||
// char *env;
|
||||
// if((env = getenv("ESPEAK_DATA_PATH")) != NULL)
|
||||
// {
|
||||
// snprintf(path_home,sizeof(path_home),"%s/espeak-data",env);
|
||||
// if(GetFileLength(path_home) == -2)
|
||||
// return; // an espeak-data directory exists
|
||||
// }
|
||||
char *env;
|
||||
if((env = getenv("ESPEAK_DATA_PATH")) != NULL)
|
||||
{
|
||||
snprintf(path_home,sizeof(path_home),"%s/espeak-data",env);
|
||||
if(GetFileLength(path_home) == -2)
|
||||
return; // an espeak-data directory exists
|
||||
}
|
||||
|
||||
snprintf(path_home,sizeof(path_home),"%s/espeak-data",getenv("HOME"));
|
||||
if(access(path_home,R_OK) != 0)
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.30.02 02.Jan.08";
|
||||
const char *version_string = "1.30.03 04.Jan.08";
|
||||
const int version_phdata = 0x013000;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
+15
-1
@@ -39,6 +39,7 @@
|
||||
|
||||
#define L_qa 0x716100
|
||||
#define L_grc 0x677263 // grc Ancient Greek
|
||||
#define L_jbo 0x6a626f // jbo Lojban
|
||||
#define L_zhy 0x7a6879 // zhy
|
||||
|
||||
|
||||
@@ -214,7 +215,6 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.vowel_pause = 1;
|
||||
tr->langopts.stress_rule = 2;
|
||||
tr->langopts.stress_flags = 0x6 | 0x10;
|
||||
// tr->langopts.stress_flags = 0x1; // don't give full stress to monosyllables
|
||||
tr->langopts.unstressed_wd1 = 1;
|
||||
tr->langopts.unstressed_wd2 = 2;
|
||||
|
||||
@@ -409,6 +409,20 @@ SetLengthMods(tr,3); // all equal
|
||||
}
|
||||
break;
|
||||
|
||||
case L_jbo: // Lojban
|
||||
{
|
||||
static const short stress_lengths_jbo[8] = {180,180, 220,220, 0,0, 260,280};
|
||||
static const wchar_t jbo_punct_within_word[] = {'.',',','\'',0x2c8,0}; // allow period and comma within a word, also stress marker
|
||||
tr = new Translator();
|
||||
SetupTranslator(tr,stress_lengths_jbo,NULL);
|
||||
tr->langopts.stress_rule = 2;
|
||||
tr->langopts.vowel_pause = 0x20c; // pause before a word which starts with a vowel, or after a word which ends in a consonant
|
||||
tr->punct_within_word = jbo_punct_within_word;
|
||||
tr->langopts.param[LOPT_SYLLABLE_CAPS] = 1; // capitals indicate stressed syllables
|
||||
SetLetterVowel(tr,'y');
|
||||
}
|
||||
break;
|
||||
|
||||
case L('l','a'): //Latin
|
||||
{
|
||||
tr = new Translator();
|
||||
|
||||
+32
-26
@@ -396,6 +396,7 @@ Translator::Translator()
|
||||
static const unsigned char stress_amps2[] = {16,16, 20,20, 20,24, 24,21 };
|
||||
static const short stress_lengths2[8] = {182,140, 220,220, 220,240, 260,280};
|
||||
static const wchar_t empty_wstring[1] = {0};
|
||||
static const wchar_t punct_in_word[2] = {'\'', 0}; // allow hyphen within words
|
||||
|
||||
charset_a0 = charsets[1]; // ISO-8859-1, this is for when the input is not utf8
|
||||
dictionary_name[0] = 0;
|
||||
@@ -423,6 +424,7 @@ Translator::Translator()
|
||||
|
||||
|
||||
char_plus_apostrophe = empty_wstring;
|
||||
punct_within_word = punct_in_word;
|
||||
|
||||
for(ix=0; ix<8; ix++)
|
||||
{
|
||||
@@ -657,6 +659,8 @@ int Translator::TranslateWord(char *word1, int next_pause, WORD_TAB *wtab)
|
||||
spell_word = 0;
|
||||
found = LookupDictList(&word1, phonemes, dictionary_flags, FLAG_ALLOW_TEXTMODE, wtab); // the original word
|
||||
|
||||
// if textmode, LookupDictList() replaces word1 by the new text and returns found=0
|
||||
|
||||
if(phonemes[0] == phonSWITCH)
|
||||
{
|
||||
// change to another language in order to translate this word
|
||||
@@ -1709,6 +1713,7 @@ void *Translator::TranslateClause(FILE *f_text, const void *vp_input, int *tone_
|
||||
int embedded_count = 0;
|
||||
int letter_count = 0;
|
||||
int space_inserted = 0;
|
||||
int syllable_marked = 0;
|
||||
char *word;
|
||||
char *p;
|
||||
int j, k;
|
||||
@@ -1933,7 +1938,8 @@ if((c == '/') && (langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(prev_ou
|
||||
if(char_inserted)
|
||||
next_in = char_inserted;
|
||||
|
||||
if(!IsAlpha(c) && !iswspace(c) && (c != '\''))
|
||||
// allow certain punctuation within a word (usually only apostrophe)
|
||||
if(!IsAlpha(c) && !iswspace(c) && (wcschr(punct_within_word,c) == 0))
|
||||
{
|
||||
if(IsAlpha(prev_out))
|
||||
{
|
||||
@@ -1974,10 +1980,10 @@ if((c == '/') && (langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(prev_ou
|
||||
{
|
||||
if(!IsAlpha(prev_out) || (langopts.ideographs && ((c >= 0x3000) || (prev_out >= 0x3000))))
|
||||
{
|
||||
if(prev_out != '\'')
|
||||
if(wcschr(punct_within_word,prev_out) == 0)
|
||||
letter_count = 0; // don't reset count for an apostrophy within a word
|
||||
|
||||
if((prev_out != ' ') && (prev_out != '\''))
|
||||
if((prev_out != ' ') && (wcschr(punct_within_word,prev_out) == 0))
|
||||
{
|
||||
// start of word, insert space if not one there already
|
||||
c = ' ';
|
||||
@@ -2004,37 +2010,36 @@ if((c == '/') && (langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(prev_ou
|
||||
{
|
||||
c = towlower(c);
|
||||
|
||||
if(iswlower(prev_in))
|
||||
if(langopts.param[LOPT_SYLLABLE_CAPS])
|
||||
{
|
||||
c = ' '; // lower case followed by upper case, treat as new word
|
||||
space_inserted = 1;
|
||||
prev_in2 = c;
|
||||
if(syllable_marked == 0)
|
||||
{
|
||||
char_inserted = c;
|
||||
c = 0x2c8; // stress marker
|
||||
syllable_marked = 1;
|
||||
}
|
||||
}
|
||||
//#ifdef deleted
|
||||
// changed to break after the last uppercase letter, not before. See below
|
||||
else
|
||||
if((c != ' ') && iswupper(prev_in) && iswlower(next_in) &&
|
||||
(memcmp(&source[source_index],"s ",2) != 0)) // ENGLISH specific plural
|
||||
{
|
||||
c = ' '; // change from upper to lower case, start new word at the last uppercase
|
||||
space_inserted = 1;
|
||||
prev_in2 = c;
|
||||
next_word_flags |= FLAG_NOSPACE;
|
||||
if(iswlower(prev_in))
|
||||
{
|
||||
c = ' '; // lower case followed by upper case, treat as new word
|
||||
space_inserted = 1;
|
||||
prev_in2 = c;
|
||||
}
|
||||
else
|
||||
if((c != ' ') && iswupper(prev_in) && iswlower(next_in) &&
|
||||
(memcmp(&source[source_index],"s ",2) != 0)) // ENGLISH specific plural
|
||||
{
|
||||
c = ' '; // change from upper to lower case, start new word at the last uppercase
|
||||
space_inserted = 1;
|
||||
prev_in2 = c;
|
||||
next_word_flags |= FLAG_NOSPACE;
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef deleted
|
||||
if(iswupper(prev_in) && iswalpha(prev_out2) &&
|
||||
(memcmp(&source[source_index-1],"s ",2) != 0)) // ENGLISH specific plural
|
||||
{
|
||||
// change to break after the last uppercase letter, not before.
|
||||
c = ' '; // more than one upper case followed by lower case, treat as new word
|
||||
space_inserted = 1;
|
||||
prev_in2 = c;
|
||||
}
|
||||
#endif
|
||||
if((all_upper_case) && (letter_count > 2))
|
||||
{
|
||||
if((c == 's') && (next_in==' '))
|
||||
@@ -2211,6 +2216,7 @@ if((c == '/') && (langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(prev_ou
|
||||
pre_pause = 0;
|
||||
word_mark = 0;
|
||||
all_upper_case = FLAG_ALL_UPPER;
|
||||
syllable_marked = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
+5
-1
@@ -227,7 +227,7 @@ extern const int param_defaults[N_SPEECH_PARAM];
|
||||
|
||||
|
||||
|
||||
#define N_LOPTS 13
|
||||
#define N_LOPTS 14
|
||||
#define LOPT_DIERESES 1
|
||||
// 1=remove [:] from unstressed syllables, 2= remove from unstressed or non-penultimate syllables
|
||||
// bit 4=0, if stress < 4, bit 4=1, if not the highest stress in the word
|
||||
@@ -271,6 +271,9 @@ extern const int param_defaults[N_SPEECH_PARAM];
|
||||
// change [t] when followed by unstressed vowel
|
||||
#define LOPT_REDUCE_T 12
|
||||
|
||||
// stressed syllable is indicated by capitals
|
||||
#define LOPT_SYLLABLE_CAPS 13
|
||||
|
||||
|
||||
typedef struct {
|
||||
// bits0-2 separate words with (1=pause_vshort, 2=pause_short, 3=pause, 4=pause_long 5=[?] phonemme)
|
||||
@@ -389,6 +392,7 @@ public:
|
||||
int dict_condition; // conditional apply some pronunciation rules and dict.lookups
|
||||
const unsigned short *charset_a0; // unicodes for characters 0xa0 to oxff
|
||||
const wchar_t *char_plus_apostrophe; // single chars + apostrophe treated as words
|
||||
const wchar_t *punct_within_word; // allow these punctuation characters within words
|
||||
|
||||
// holds properties of characters: vowel, consonant, etc for pronunciation rules
|
||||
unsigned char letter_bits[256];
|
||||
|
||||
Reference in New Issue
Block a user