Browse Source

Revert "Move handling of SetLetterVowel() to language files"

This reverts commit 6042eb8d1e.

The change causes an issue with `pt-BR` and possibly other languages
and voices.
master
Reece H. Dunn 6 years ago
parent
commit
919f3240cb

+ 0
- 7
docs/voices.md View File

- [stressAmp](#stressamp) - [stressAmp](#stressamp)
- [intonation](#intonation) - [intonation](#intonation)
- [dictmin](#dictmin) - [dictmin](#dictmin)
- [letterVowel](#letterVowel)


---------- ----------


installed. If the size of the compiled dictionary data for the language installed. If the size of the compiled dictionary data for the language
(the file `espeak-ng-data/*_dict`) is less than this size then a (the file `espeak-ng-data/*_dict`) is less than this size then a
warning is given. warning is given.

### letterVowel

letterVowel <letter>

Used for some languages to handle a certain letter as a vowel instead of consonant.

+ 0
- 1
espeak-ng-data/lang/art/jbo View File

language jbo language jbo


speed 80 // speed adjustment, percentage speed 80 // speed adjustment, percentage
letterVowel y

+ 0
- 2
espeak-ng-data/lang/cel/cy View File

language cy language cy


intonation 4 intonation 4
letterVowel w
letterVowel y

+ 0
- 1
espeak-ng-data/lang/gmq/da View File

language da language da


tunes s2 c2 q2 e2 tunes s2 c2 q2 e2
letterVowel y

+ 0
- 1
espeak-ng-data/lang/gmq/is View File

name Icelandic name Icelandic
language is language is
letterVowel y

+ 0
- 1
espeak-ng-data/lang/gmq/nb View File

dictionary no dictionary no


intonation 4 intonation 4
letterVowel y

+ 0
- 1
espeak-ng-data/lang/gmq/sv View File

name Swedish name Swedish
language sv language sv
letterVowel y

+ 0
- 1
espeak-ng-data/lang/gmw/af View File



roughness 0 roughness 0
pitch 63 120 pitch 63 120
letterVowel y

+ 0
- 2
espeak-ng-data/lang/gmw/de View File

name German name German
language de language de

letterVowel y

+ 0
- 1
espeak-ng-data/lang/gmw/nl View File

name Dutch name Dutch
language nl language nl
letterVowel y

+ 0
- 1
espeak-ng-data/lang/ine/sq View File

name Albanian name Albanian
language sq language sq
letterVowel y


// add this line to remove 'ë' at the end of words // add this line to remove 'ë' at the end of words
// replace 00 @/ NULL // replace 00 @/ NULL

+ 0
- 1
espeak-ng-data/lang/roa/fr View File



dictrules 1 dictrules 1
tunes s3 c3 q3 e3 tunes s3 c3 q3 e3
letterVowel y

+ 1
- 1
espeak-ng-data/lang/roa/fr-BE View File



dictrules 2 dictrules 2
tunes s3 c3 q3 e3 tunes s3 c3 q3 e3
letterVowel y



+ 0
- 1
espeak-ng-data/lang/roa/fr-CH View File



dictrules 3 dictrules 3
tunes s3 c3 q3 e3 tunes s3 c3 q3 e3
letterVowel y

+ 0
- 1
espeak-ng-data/lang/roa/it View File

status mature status mature


tunes s4 c4 q4 e4 tunes s4 c4 q4 e4
letterVowel y

+ 0
- 1
espeak-ng-data/lang/roa/pt View File



dictrules 1 dictrules 1
intonation 2 intonation 2
letterVowel y

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

name Finnish name Finnish
language fi language fi
letterVowel y

+ 1
- 1
espeak-ng-data/lang/urj/hu View File

language hu language hu
option bracket 0 0 option bracket 0 0
pitch 81 117 pitch 81 117
letterVowel y



+ 0
- 2
espeak-ng-data/lang/zls/bg View File



stressAmp 13 12 17 17 20 22 22 21 stressAmp 13 12 17 17 20 22 22 21
stressLength 180 170 200 200 200 200 210 220 stressLength 180 170 200 200 200 200 210 220
letterVowel 0x2a


+ 0
- 2
espeak-ng-data/lang/zls/bs View File



stressAdd 10 10 0 0 0 0 -30 -30 stressAdd 10 10 0 0 0 0 -30 -30
dictrules 3 4 dictrules 3 4
letterVowel y
letterVowel r

+ 0
- 2
espeak-ng-data/lang/zls/hr View File



stressAdd 10 10 0 0 0 0 -30 -30 stressAdd 10 10 0 0 0 0 -30 -30
dictrules 1 dictrules 1
letterVowel y
letterVowel r

+ 0
- 3
espeak-ng-data/lang/zls/sr View File



stressAdd 10 10 0 0 0 0 -30 -30 stressAdd 10 10 0 0 0 0 -30 -30
dictrules 2 4 dictrules 2 4

letterVowel y
letterVowel r

+ 0
- 2
espeak-ng-data/lang/zlw/cs View File

name Czech name Czech
language cs language cs
letterVowel y
letterVowel r

+ 0
- 1
espeak-ng-data/lang/zlw/pl View File

language pl language pl


intonation 2 intonation 2
letterVowel y

+ 0
- 2
espeak-ng-data/lang/zlw/sk View File

name Slovak name Slovak
language sk language sk
letterVowel y
letterVowel r

+ 27
- 0
src/libespeak-ng/tr_languages.c View File



static void Translator_Russian(Translator *tr); static void Translator_Russian(Translator *tr);


static void SetLetterVowel(Translator *tr, int c)
{
tr->letter_bits[c] = (tr->letter_bits[c] & 0x40) | 0x81; // keep value for group 6 (front vowels e,i,y)
}

static void ResetLetterBits(Translator *tr, int groups) static void ResetLetterBits(Translator *tr, int groups)
{ {
// Clear all the specified groups // Clear all the specified groups
tr->langopts.vowel_pause = 0x30; tr->langopts.vowel_pause = 0x30;
tr->langopts.param[LOPT_DIERESES] = 1; tr->langopts.param[LOPT_DIERESES] = 1;
tr->langopts.param[LOPT_PREFIXES] = 1; tr->langopts.param[LOPT_PREFIXES] = 1;
SetLetterVowel(tr, 'y'); // add 'y' to vowels


tr->langopts.numbers = NUM_SWAP_TENS | NUM_HUNDRED_AND | NUM_SINGLE_AND | NUM_ROMAN | NUM_1900; tr->langopts.numbers = NUM_SWAP_TENS | NUM_HUNDRED_AND | NUM_SINGLE_AND | NUM_ROMAN | NUM_1900;
tr->langopts.accents = 1; tr->langopts.accents = 1;
case L('b', 'g'): // Bulgarian case L('b', 'g'): // Bulgarian
{ {
SetCyrillicLetters(tr); SetCyrillicLetters(tr);
SetLetterVowel(tr, 0x2a);
tr->encoding = ESPEAKNG_ENCODING_ISO_8859_5; tr->encoding = ESPEAKNG_ENCODING_ISO_8859_5;
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 0x432; // [v] don't count this character at start of word tr->langopts.param[LOPT_UNPRONOUNCABLE] = 0x432; // [v] don't count this character at start of word
tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x107; // devoice at end of word, and change voicing to match a following consonant (except v) tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x107; // devoice at end of word, and change voicing to match a following consonant (except v)


tr->langopts.numbers = NUM_OMIT_1_HUNDRED; tr->langopts.numbers = NUM_OMIT_1_HUNDRED;


SetLetterVowel(tr, 'w'); // add letter to vowels and remove from consonants
SetLetterVowel(tr, 'y');
} }
break; break;
case L('d', 'a'): // Danish case L('d', 'a'): // Danish


tr->langopts.stress_rule = STRESSPOSN_1L; tr->langopts.stress_rule = STRESSPOSN_1L;
tr->langopts.param[LOPT_PREFIXES] = 1; tr->langopts.param[LOPT_PREFIXES] = 1;
SetLetterVowel(tr, 'y');
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; 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; break;
tr->langopts.param[LOPT_LONG_VOWEL_THRESHOLD] = 175/2; tr->langopts.param[LOPT_LONG_VOWEL_THRESHOLD] = 175/2;


tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_ALLOW_SPACE | NUM_ORDINAL_DOT | NUM_ROMAN; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_ALLOW_SPACE | NUM_ORDINAL_DOT | NUM_ROMAN;
SetLetterVowel(tr, 'y');
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 2; // use de_rules for unpronouncable rules tr->langopts.param[LOPT_UNPRONOUNCABLE] = 2; // use de_rules for unpronouncable rules
} }
break; break;
tr->langopts.long_stop = 130; tr->langopts.long_stop = 130;


tr->langopts.numbers = NUM_DECIMAL_COMMA + NUM_ALLOW_SPACE; tr->langopts.numbers = NUM_DECIMAL_COMMA + NUM_ALLOW_SPACE;
SetLetterVowel(tr, 'y');
tr->langopts.spelling_stress = 1; tr->langopts.spelling_stress = 1;
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
} }
tr->langopts.accents = 2; // Say "Capital" after the letter. tr->langopts.accents = 2; // Say "Capital" after the letter.


tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_OMIT_1_HUNDRED | NUM_NOPAUSE | NUM_ROMAN | NUM_ROMAN_CAPITALS | NUM_ROMAN_AFTER | NUM_VIGESIMAL | NUM_DFRACTION_4; tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_OMIT_1_HUNDRED | NUM_NOPAUSE | NUM_ROMAN | NUM_ROMAN_CAPITALS | NUM_ROMAN_AFTER | NUM_VIGESIMAL | NUM_DFRACTION_4;
SetLetterVowel(tr, 'y');
} }
break; break;
case L3('h','a', 'k'): // Hakka Chinese case L3('h','a', 'k'): // Hakka Chinese
tr->langopts.numbers2 = 0xa + NUM2_THOUSANDS_VAR5; // variant numbers before thousands,milliards tr->langopts.numbers2 = 0xa + NUM2_THOUSANDS_VAR5; // variant numbers before thousands,milliards
tr->langopts.our_alphabet = OFFSET_CYRILLIC; // don't say "cyrillic" before letter names tr->langopts.our_alphabet = OFFSET_CYRILLIC; // don't say "cyrillic" before letter names


SetLetterVowel(tr, 'y');
SetLetterVowel(tr, 'r');
} }
break; break;
case L('h', 't'): // Haitian Creole case L('h', 't'): // Haitian Creole
tr->langopts.decimal_sep = ','; tr->langopts.decimal_sep = ',';
tr->langopts.max_roman = 899; tr->langopts.max_roman = 899;
tr->langopts.min_roman = 1; tr->langopts.min_roman = 1;
SetLetterVowel(tr, 'y');
tr->langopts.spelling_stress = 1; tr->langopts.spelling_stress = 1;
SetLengthMods(tr, 3); // all equal SetLengthMods(tr, 3); // all equal
} }
SetLetterBits(tr, 4, "kpst"); // Letter group F SetLetterBits(tr, 4, "kpst"); // Letter group F
SetLetterBits(tr, 3, "jvr"); // Letter group H SetLetterBits(tr, 3, "jvr"); // Letter group H
tr->letter_groups[1] = is_lettergroup_B; tr->letter_groups[1] = is_lettergroup_B;
SetLetterVowel(tr, 'y');
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SINGLE_AND | NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_1900; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SINGLE_AND | NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_1900;
tr->langopts.numbers2 = 0x2; tr->langopts.numbers2 = 0x2;
} }
tr->langopts.numbers2 = NUM2_NO_TEEN_ORDINALS; tr->langopts.numbers2 = NUM2_NO_TEEN_ORDINALS;
tr->langopts.roman_suffix = utf8_ordinal; tr->langopts.roman_suffix = utf8_ordinal;
tr->langopts.accents = 2; // Say "Capital" after the letter. tr->langopts.accents = 2; // Say "Capital" after the letter.
SetLetterVowel(tr, 'y');
} }
break; break;
case L3('j', 'b', 'o'): // Lojban case L3('j', 'b', 'o'): // Lojban
tr->langopts.vowel_pause = 0x20c; // pause before a word which starts with a vowel, or after a word which ends in a consonant 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->punct_within_word = jbo_punct_within_word;
tr->langopts.param[LOPT_CAPS_IN_WORD] = 2; // capitals indicate stressed syllables tr->langopts.param[LOPT_CAPS_IN_WORD] = 2; // capitals indicate stressed syllables
SetLetterVowel(tr, 'y');
tr->langopts.max_lengthmod = 368; tr->langopts.max_lengthmod = 368;
} }
break; break;
tr->langopts.param[LOPT_DIERESES] = 1; tr->langopts.param[LOPT_DIERESES] = 1;
tr->langopts.param[LOPT_PREFIXES] = 1; tr->langopts.param[LOPT_PREFIXES] = 1;
tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x100; // devoice at end of word tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x100; // devoice at end of word
SetLetterVowel(tr, 'y');


tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_ALLOW_SPACE | NUM_1900 | NUM_ORDINAL_DOT; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_SWAP_TENS | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_ALLOW_SPACE | NUM_1900 | NUM_ORDINAL_DOT;
tr->langopts.ordinal_indicator = "e"; tr->langopts.ordinal_indicator = "e";


SetupTranslator(tr, stress_lengths_no, NULL); SetupTranslator(tr, stress_lengths_no, NULL);
tr->langopts.stress_rule = STRESSPOSN_1L; tr->langopts.stress_rule = STRESSPOSN_1L;
SetLetterVowel(tr, 'y');
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_HUNDRED_AND | NUM_ALLOW_SPACE | NUM_1900 | NUM_ORDINAL_DOT; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_HUNDRED_AND | NUM_ALLOW_SPACE | NUM_1900 | NUM_ORDINAL_DOT;
} }
break; break;
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_2; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_2;
tr->langopts.numbers2 = NUM2_THOUSANDS_VAR3; tr->langopts.numbers2 = NUM2_THOUSANDS_VAR3;
tr->langopts.param[LOPT_COMBINE_WORDS] = 4 + 0x100; // combine 'nie' (marked with $alt2) with some 1-syllable (and 2-syllable) words (marked with $alt) tr->langopts.param[LOPT_COMBINE_WORDS] = 4 + 0x100; // combine 'nie' (marked with $alt2) with some 1-syllable (and 2-syllable) words (marked with $alt)
SetLetterVowel(tr, 'y');
} }
break; break;
case L('p', 't'): // Portuguese case L('p', 't'): // Portuguese
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_DFRACTION_2 | NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_ROMAN_CAPITALS; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_DFRACTION_2 | NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_ROMAN_CAPITALS;
tr->langopts.numbers2 = NUM2_MULTIPLE_ORDINAL | NUM2_NO_TEEN_ORDINALS | NUM2_ORDINAL_NO_AND; tr->langopts.numbers2 = NUM2_MULTIPLE_ORDINAL | NUM2_NO_TEEN_ORDINALS | NUM2_ORDINAL_NO_AND;
tr->langopts.max_roman = 5000; tr->langopts.max_roman = 5000;
SetLetterVowel(tr, 'y');
ResetLetterBits(tr, 0x2); ResetLetterBits(tr, 0x2);
SetLetterBits(tr, 1, "bcdfgjkmnpqstvxz"); // B hard consonants, excluding h,l,r,w,y SetLetterBits(tr, 1, "bcdfgjkmnpqstvxz"); // B hard consonants, excluding h,l,r,w,y
tr->langopts.param[LOPT_ALT] = 2; // call ApplySpecialAttributes2() if a word has $alt or $alt2 tr->langopts.param[LOPT_ALT] = 2; // call ApplySpecialAttributes2() if a word has $alt or $alt2
if (name2 == L('c', 's')) if (name2 == L('c', 's'))
tr->langopts.numbers2 = 0x108; // variant numbers before milliards tr->langopts.numbers2 = 0x108; // variant numbers before milliards


SetLetterVowel(tr, 'y');
SetLetterVowel(tr, 'r');
ResetLetterBits(tr, 0x20); ResetLetterBits(tr, 0x20);
SetLetterBits(tr, 5, sk_voiced); SetLetterBits(tr, 5, sk_voiced);
} }


tr->langopts.stress_rule = STRESSPOSN_1R; tr->langopts.stress_rule = STRESSPOSN_1R;
tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2 | S_FINAL_VOWEL_UNSTRESSED; tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2 | S_FINAL_VOWEL_UNSTRESSED;
SetLetterVowel(tr, 'y');
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_DFRACTION_4; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_HUNDRED_AND | NUM_AND_UNITS | NUM_DFRACTION_4;
tr->langopts.accents = 2; // "capital" after letter name tr->langopts.accents = 2; // "capital" after letter name
} }
SetupTranslator(tr, stress_lengths_sv, stress_amps_sv); SetupTranslator(tr, stress_lengths_sv, stress_amps_sv);


tr->langopts.stress_rule = STRESSPOSN_1L; tr->langopts.stress_rule = STRESSPOSN_1L;
SetLetterVowel(tr, 'y');
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_1900; tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_1900;
tr->langopts.accents = 1; tr->langopts.accents = 1;
} }

+ 1
- 28
src/libespeak-ng/voices.c View File



// these need a phoneme table to have been specified // these need a phoneme table to have been specified
V_REPLACE, V_REPLACE,
V_CONSONANTS,

// these are alpha features that need to be tested and categorized
V_LETTER_VOWEL

V_CONSONANTS
}; };


static MNEM_TAB options_tab[] = { static MNEM_TAB options_tab[] = {
{ "l_length_mods", 0x100+LOPT_LENGTH_MODS }, { "l_length_mods", 0x100+LOPT_LENGTH_MODS },
{ "apostrophe", 0x100+LOPT_APOSTROPHE }, { "apostrophe", 0x100+LOPT_APOSTROPHE },


// these are alpha features that need to be tested and categorized
{ "letterVowel", V_LETTER_VOWEL },
{ NULL, 0 } { NULL, 0 }
}; };


case V_MAINTAINER: case V_MAINTAINER:
case V_STATUS: case V_STATUS:
break; break;

case V_LETTER_VOWEL: {
char str[5] = "";
char c = '0';
char *endptr = NULL;
sscanf(p, "%s", str);
// assume a hex value if string starts with "0x"
if (str[0] == '0' && str[1] == 'x') {
c = strtoul(str, &endptr, 16);
if (errno == ERANGE)
fprintf(stderr, "letterVowel out of range.\n");
}
else {// otherwise, assume a single letter
c = str[0];
if (c < 97 || c > 122) // valid values are a-z, ascii 97-122
fprintf(stderr, "letterVowel out of range.\n");
}
new_translator->letter_bits[c] = (new_translator->letter_bits[c] & 0x40) | 0x81; // keep value for group 6 (front vowels e,i,y)
break;
}

default: default:
if ((key & 0xff00) == 0x100) { if ((key & 0xff00) == 0x100) {
if (langopts) if (langopts)

Loading…
Cancel
Save