Browse Source

Merge branch 'spellingStress'

master
Juho Hiltunen 2 years ago
parent
commit
0f1f006afe

+ 7
- 0
docs/voices.md View File

- [dictrules](#dictrules) - [dictrules](#dictrules)
- [lowercaseSentence](#lowercaseSentence) - [lowercaseSentence](#lowercaseSentence)
- [replace](#replace) - [replace](#replace)
- [spellingStress](#spellingStress)
- [stressOpt](#stressopt) - [stressOpt](#stressopt)
- [stressRule](#stressrule) - [stressRule](#stressrule)
- [stressLength](#stresslength) - [stressLength](#stresslength)
The phoneme mnemonics can be defined for each language, but some are The phoneme mnemonics can be defined for each language, but some are
listed in [Phonemes](phonemes.md). listed in [Phonemes](phonemes.md).


### spellingStress

spellingStress

When set, stress first letter when reading abbreviations.

### stressOpt ### stressOpt


stressOpt <list of rule numbers> stressOpt <list of rule numbers>

+ 1
- 0
espeak-ng-data/lang/urj/et View File

stressRule 0 stressRule 0


intonation 3 intonation 3
spellingStress

+ 2
- 1
espeak-ng-data/lang/urj/fi View File

stressOpt 1 2 4 6 // (S_NO_DIM + S_FINAL_DIM = S_FINAL_DIM_ONLY), S_FINAL_NO_2, S_2_TO_HEAVY stressOpt 1 2 4 6 // (S_NO_DIM + S_FINAL_DIM = S_FINAL_DIM_ONLY), S_FINAL_NO_2, S_2_TO_HEAVY
stressRule 0 stressRule 0


intonation 3
intonation 3
spellingStress

+ 4
- 0
src/libespeak-ng/langopts.c View File

translator->langopts.lowercase_sentence = true; translator->langopts.lowercase_sentence = true;
break; break;
} }
case V_SPELLINGSTRESS: {
translator->langopts.spelling_stress = true;
break;
}
case V_STRESSADD: { // stressAdd case V_STRESSADD: { // stressAdd
int stress_add_set = 0; int stress_add_set = 0;
int stress_add[8]; int stress_add[8];

+ 1
- 1
src/libespeak-ng/numbers.c View File

if ((c == phonSTRESS_P) && (n_chars > 1) && (prev != phonSWITCH)) { if ((c == phonSTRESS_P) && (n_chars > 1) && (prev != phonSWITCH)) {
count++; count++;


if (tr->langopts.spelling_stress == 1) {
if (tr->langopts.spelling_stress) {
// stress on initial letter when spelling // stress on initial letter when spelling
if (count > 1) if (count > 1)
c = phonSTRESS_3; c = phonSTRESS_3;

+ 8
- 8
src/libespeak-ng/tr_languages.c View File

tr->langopts.param[LOPT_UNPRONOUNCABLE] = 's'; // don't count this character at start of word tr->langopts.param[LOPT_UNPRONOUNCABLE] = 's'; // don't count this character at start of word
tr->langopts.param[LOPT_BRACKET_PAUSE] = 4; // pause at bracket tr->langopts.param[LOPT_BRACKET_PAUSE] = 4; // pause at bracket
tr->langopts.param[LOPT_BRACKET_PAUSE_ANNOUNCED] = 2; // pauses when announcing bracket names tr->langopts.param[LOPT_BRACKET_PAUSE_ANNOUNCED] = 2; // pauses when announcing bracket names
tr->langopts.spelling_stress = false;
tr->langopts.max_initial_consonants = 3; tr->langopts.max_initial_consonants = 3;
tr->langopts.replace_chars = NULL; tr->langopts.replace_chars = NULL;
tr->langopts.alt_alphabet_lang = L('e', 'n'); tr->langopts.alt_alphabet_lang = L('e', 'n');


tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_2 | NUM_ORDINAL_DOT; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_2 | NUM_ORDINAL_DOT;
SetLetterVowel(tr, 'y'); SetLetterVowel(tr, 'y');
tr->langopts.spelling_stress = 1;
} }
break; break;
case L('f', 'r'): // french case L('f', 'r'): // french
tr->langopts.stress_flags = S_FINAL_NO_2; tr->langopts.stress_flags = S_FINAL_NO_2;
tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x3; tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x3;
tr->langopts.max_initial_consonants = 5; tr->langopts.max_initial_consonants = 5;
tr->langopts.spelling_stress = 1;
tr->langopts.spelling_stress = true;
tr->langopts.accents = 1; tr->langopts.accents = 1;


tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_DECIMAL_COMMA | NUM_THOUS_SPACE | NUM_DFRACTION_2 | NUM_ROMAN_CAPITALS; tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_DECIMAL_COMMA | NUM_THOUS_SPACE | NUM_DFRACTION_2 | NUM_ROMAN_CAPITALS;
tr->langopts.max_roman = 899; tr->langopts.max_roman = 899;
tr->langopts.min_roman = 1; tr->langopts.min_roman = 1;
SetLetterVowel(tr, 'y'); SetLetterVowel(tr, 'y');
tr->langopts.spelling_stress = 1;
tr->langopts.spelling_stress = true;
SetLengthMods(tr, 3); // all equal SetLengthMods(tr, 3); // all equal
} }
break; break;
SetupTranslator(tr, stress_lengths_lv, stress_amps_lv); SetupTranslator(tr, stress_lengths_lv, stress_amps_lv);


tr->langopts.stress_rule = STRESSPOSN_1L; tr->langopts.stress_rule = STRESSPOSN_1L;
tr->langopts.spelling_stress = 1;
tr->langopts.spelling_stress = true;
tr->encoding = ESPEAKNG_ENCODING_ISO_8859_4; tr->encoding = ESPEAKNG_ENCODING_ISO_8859_4;
tr->langopts.max_digits = 33; tr->langopts.max_digits = 33;
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_4 | NUM_ORDINAL_DOT; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_4 | NUM_ORDINAL_DOT;
tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2; tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2;
tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x3; tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x3;
tr->langopts.max_initial_consonants = 5; tr->langopts.max_initial_consonants = 5;
tr->langopts.spelling_stress = 1;
tr->langopts.spelling_stress = true;
tr->langopts.param[LOPT_COMBINE_WORDS] = 4; // combine some prepositions with the following word tr->langopts.param[LOPT_COMBINE_WORDS] = 4; // combine some prepositions with the following word


tr->langopts.numbers = NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ROMAN; tr->langopts.numbers = NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ROMAN;


tr->langopts.stress_rule = STRESSPOSN_1L; tr->langopts.stress_rule = STRESSPOSN_1L;
tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2; tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2;
tr->langopts.spelling_stress = 1;
tr->langopts.spelling_stress = true;


tr->letter_bits_offset = OFFSET_SINHALA; tr->letter_bits_offset = OFFSET_SINHALA;
memset(tr->letter_bits, 0, sizeof(tr->letter_bits)); memset(tr->letter_bits, 0, sizeof(tr->letter_bits));


tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_SWAP_TENS | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ORDINAL_DOT; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_SWAP_TENS | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ORDINAL_DOT;
SetLetterVowel(tr, 'y'); SetLetterVowel(tr, 'y');
tr->langopts.spelling_stress = 1;
tr->langopts.spelling_stress = true;
tr->langopts.intonation_group = 3; // less intonation, don't raise pitch at comma tr->langopts.intonation_group = 3; // less intonation, don't raise pitch at comma
} }
break; break;


tr->langopts.stress_rule = STRESSPOSN_1L; tr->langopts.stress_rule = STRESSPOSN_1L;
tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2; // use 'diminished' for unstressed final syllable tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2; // use 'diminished' for unstressed final syllable
tr->langopts.spelling_stress = 1;
tr->langopts.spelling_stress = true;
tr->langopts.break_numbers = BREAK_LAKH_DV; tr->langopts.break_numbers = BREAK_LAKH_DV;


if (name2 == L('t', 'a')) { if (name2 == L('t', 'a')) {

+ 1
- 1
src/libespeak-ng/translate.h View File

unsigned char tunes[6]; unsigned char tunes[6];
int long_stop; // extra mS pause for a lengthened stop int long_stop; // extra mS pause for a lengthened stop
char max_initial_consonants; char max_initial_consonants;
char spelling_stress; // 0=default, 1=stress first letter
bool spelling_stress;
char tone_numbers; char tone_numbers;
char ideographs; // treat as separate words char ideographs; // treat as separate words
bool textmode; // the meaning of FLAG_TEXTMODE is reversed (to save data when *_list file is compiled) bool textmode; // the meaning of FLAG_TEXTMODE is reversed (to save data when *_list file is compiled)

+ 2
- 0
src/libespeak-ng/voice.h View File

V_WORDGAP, V_WORDGAP,
V_INTONATION, V_INTONATION,
V_TUNES, V_TUNES,
V_SPELLINGSTRESS,
V_STRESSLENGTH, V_STRESSLENGTH,
V_STRESSAMP, V_STRESSAMP,
V_STRESSADD, V_STRESSADD,
{ "l_sonorant_min", 0x100+LOPT_SONORANT_MIN }, { "l_sonorant_min", 0x100+LOPT_SONORANT_MIN },
{ "lowercaseSentence", V_LOWERCASE_SENTENCE }, { "lowercaseSentence", V_LOWERCASE_SENTENCE },
{ "numbers", V_NUMBERS }, { "numbers", V_NUMBERS },
{ "spellingStress", V_SPELLINGSTRESS },
{ "stressAdd", V_STRESSADD }, { "stressAdd", V_STRESSADD },
{ "stressAmp", V_STRESSAMP }, { "stressAmp", V_STRESSAMP },
{ "stressLength", V_STRESSLENGTH }, { "stressLength", V_STRESSLENGTH },

+ 1
- 0
tests/voices.test View File

##### Voice options ##### Voice options
test_phon ka "s'asi,amovn,oa t#k#v'eni g'ats#noba test_phon ka "s'asi,amovn,oa t#k#v'eni g'ats#noba
r'ogor brdz'andebit#" "სასიამოვნოა თქვენი გაცნობა. როგორ ბრძანდებით" "lowercaseSentence" #872 r'ogor brdz'andebit#" "სასიამოვნოა თქვენი გაცნობა. როგორ ბრძანდებით" "lowercaseSentence" #872
test_phon fi "'a:b,e:s,e:" "abc" "spelling_stress"

Loading…
Cancel
Save