From 919f3240cbbb8060da550f0f9641e69b2975d9f4 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Mon, 8 Oct 2018 07:38:56 +0100 Subject: [PATCH] Revert "Move handling of SetLetterVowel() to language files" This reverts commit 6042eb8d1ebef0632f65b74e34f836e5c91e52fc. The change causes an issue with `pt-BR` and possibly other languages and voices. --- docs/voices.md | 7 ------- espeak-ng-data/lang/art/jbo | 1 - espeak-ng-data/lang/cel/cy | 2 -- espeak-ng-data/lang/gmq/da | 1 - espeak-ng-data/lang/gmq/is | 1 - espeak-ng-data/lang/gmq/nb | 1 - espeak-ng-data/lang/gmq/sv | 1 - espeak-ng-data/lang/gmw/af | 1 - espeak-ng-data/lang/gmw/de | 2 -- espeak-ng-data/lang/gmw/nl | 1 - espeak-ng-data/lang/ine/sq | 1 - espeak-ng-data/lang/roa/fr | 1 - espeak-ng-data/lang/roa/fr-BE | 2 +- espeak-ng-data/lang/roa/fr-CH | 1 - espeak-ng-data/lang/roa/it | 1 - espeak-ng-data/lang/roa/pt | 1 - espeak-ng-data/lang/urj/fi | 1 - espeak-ng-data/lang/urj/hu | 2 +- espeak-ng-data/lang/zls/bg | 2 -- espeak-ng-data/lang/zls/bs | 2 -- espeak-ng-data/lang/zls/hr | 2 -- espeak-ng-data/lang/zls/sr | 3 --- espeak-ng-data/lang/zlw/cs | 2 -- espeak-ng-data/lang/zlw/pl | 1 - espeak-ng-data/lang/zlw/sk | 2 -- src/libespeak-ng/tr_languages.c | 27 +++++++++++++++++++++++++++ src/libespeak-ng/voices.c | 29 +---------------------------- 27 files changed, 30 insertions(+), 68 deletions(-) diff --git a/docs/voices.md b/docs/voices.md index cad9b7f2..8573a414 100644 --- a/docs/voices.md +++ b/docs/voices.md @@ -31,7 +31,6 @@ - [stressAmp](#stressamp) - [intonation](#intonation) - [dictmin](#dictmin) - - [letterVowel](#letterVowel) ---------- @@ -441,9 +440,3 @@ Used for some languages to detect if additional language data is 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 warning is given. - -### letterVowel - - letterVowel  - -Used for some languages to handle a certain letter as a vowel instead of consonant. diff --git a/espeak-ng-data/lang/art/jbo b/espeak-ng-data/lang/art/jbo index 70164f70..9cf2f309 100644 --- a/espeak-ng-data/lang/art/jbo +++ b/espeak-ng-data/lang/art/jbo @@ -2,4 +2,3 @@ name Lojban language jbo speed 80 // speed adjustment, percentage -letterVowel y diff --git a/espeak-ng-data/lang/cel/cy b/espeak-ng-data/lang/cel/cy index dc51c1e8..6d021329 100644 --- a/espeak-ng-data/lang/cel/cy +++ b/espeak-ng-data/lang/cel/cy @@ -2,5 +2,3 @@ name Welsh language cy intonation 4 -letterVowel w -letterVowel y diff --git a/espeak-ng-data/lang/gmq/da b/espeak-ng-data/lang/gmq/da index fd77dbdb..58f02f15 100644 --- a/espeak-ng-data/lang/gmq/da +++ b/espeak-ng-data/lang/gmq/da @@ -2,4 +2,3 @@ name Danish language da tunes s2 c2 q2 e2 -letterVowel y diff --git a/espeak-ng-data/lang/gmq/is b/espeak-ng-data/lang/gmq/is index 938c9ec0..04bf5ad3 100644 --- a/espeak-ng-data/lang/gmq/is +++ b/espeak-ng-data/lang/gmq/is @@ -1,3 +1,2 @@ name Icelandic language is -letterVowel y diff --git a/espeak-ng-data/lang/gmq/nb b/espeak-ng-data/lang/gmq/nb index d2c78ac8..c29117f5 100644 --- a/espeak-ng-data/lang/gmq/nb +++ b/espeak-ng-data/lang/gmq/nb @@ -5,4 +5,3 @@ phonemes no dictionary no intonation 4 -letterVowel y diff --git a/espeak-ng-data/lang/gmq/sv b/espeak-ng-data/lang/gmq/sv index 1724c2e4..bb2d0299 100644 --- a/espeak-ng-data/lang/gmq/sv +++ b/espeak-ng-data/lang/gmq/sv @@ -1,3 +1,2 @@ name Swedish language sv -letterVowel y diff --git a/espeak-ng-data/lang/gmw/af b/espeak-ng-data/lang/gmw/af index fb2ce120..64fc96f5 100644 --- a/espeak-ng-data/lang/gmw/af +++ b/espeak-ng-data/lang/gmw/af @@ -6,4 +6,3 @@ status mature roughness 0 pitch 63 120 -letterVowel y diff --git a/espeak-ng-data/lang/gmw/de b/espeak-ng-data/lang/gmw/de index 31a1dc23..470e5afd 100644 --- a/espeak-ng-data/lang/gmw/de +++ b/espeak-ng-data/lang/gmw/de @@ -1,4 +1,2 @@ name German language de - -letterVowel y diff --git a/espeak-ng-data/lang/gmw/nl b/espeak-ng-data/lang/gmw/nl index b0711137..a212fbef 100644 --- a/espeak-ng-data/lang/gmw/nl +++ b/espeak-ng-data/lang/gmw/nl @@ -1,3 +1,2 @@ name Dutch language nl -letterVowel y diff --git a/espeak-ng-data/lang/ine/sq b/espeak-ng-data/lang/ine/sq index 3cd293d5..9ace3576 100644 --- a/espeak-ng-data/lang/ine/sq +++ b/espeak-ng-data/lang/ine/sq @@ -1,6 +1,5 @@ name Albanian language sq -letterVowel y // add this line to remove 'ë' at the end of words // replace 00 @/ NULL diff --git a/espeak-ng-data/lang/roa/fr b/espeak-ng-data/lang/roa/fr index e26c916d..9e0b9440 100644 --- a/espeak-ng-data/lang/roa/fr +++ b/espeak-ng-data/lang/roa/fr @@ -4,4 +4,3 @@ language fr dictrules 1 tunes s3 c3 q3 e3 -letterVowel y diff --git a/espeak-ng-data/lang/roa/fr-BE b/espeak-ng-data/lang/roa/fr-BE index 9103eb56..1a0311f9 100644 --- a/espeak-ng-data/lang/roa/fr-BE +++ b/espeak-ng-data/lang/roa/fr-BE @@ -4,5 +4,5 @@ language fr 8 dictrules 2 tunes s3 c3 q3 e3 -letterVowel y + diff --git a/espeak-ng-data/lang/roa/fr-CH b/espeak-ng-data/lang/roa/fr-CH index 4a31800a..2e45fbd1 100644 --- a/espeak-ng-data/lang/roa/fr-CH +++ b/espeak-ng-data/lang/roa/fr-CH @@ -4,4 +4,3 @@ language fr 8 dictrules 3 tunes s3 c3 q3 e3 -letterVowel y diff --git a/espeak-ng-data/lang/roa/it b/espeak-ng-data/lang/roa/it index 092aebe6..ad7bb50e 100644 --- a/espeak-ng-data/lang/roa/it +++ b/espeak-ng-data/lang/roa/it @@ -5,4 +5,3 @@ maintainer Christian Leo M status mature tunes s4 c4 q4 e4 -letterVowel y diff --git a/espeak-ng-data/lang/roa/pt b/espeak-ng-data/lang/roa/pt index 0a2f181c..5041b511 100644 --- a/espeak-ng-data/lang/roa/pt +++ b/espeak-ng-data/lang/roa/pt @@ -5,4 +5,3 @@ phonemes pt-pt dictrules 1 intonation 2 -letterVowel y diff --git a/espeak-ng-data/lang/urj/fi b/espeak-ng-data/lang/urj/fi index 0a944a77..ef14b147 100644 --- a/espeak-ng-data/lang/urj/fi +++ b/espeak-ng-data/lang/urj/fi @@ -1,3 +1,2 @@ name Finnish language fi -letterVowel y diff --git a/espeak-ng-data/lang/urj/hu b/espeak-ng-data/lang/urj/hu index adb35805..5ece4b1b 100644 --- a/espeak-ng-data/lang/urj/hu +++ b/espeak-ng-data/lang/urj/hu @@ -2,5 +2,5 @@ name Hungarian language hu option bracket 0 0 pitch 81 117 -letterVowel y + diff --git a/espeak-ng-data/lang/zls/bg b/espeak-ng-data/lang/zls/bg index 9efaa699..870c0424 100644 --- a/espeak-ng-data/lang/zls/bg +++ b/espeak-ng-data/lang/zls/bg @@ -3,5 +3,3 @@ language bg stressAmp 13 12 17 17 20 22 22 21 stressLength 180 170 200 200 200 200 210 220 -letterVowel 0x2a - diff --git a/espeak-ng-data/lang/zls/bs b/espeak-ng-data/lang/zls/bs index 4dcaabcc..01fd1746 100644 --- a/espeak-ng-data/lang/zls/bs +++ b/espeak-ng-data/lang/zls/bs @@ -12,5 +12,3 @@ formant 5 97 102 100 stressAdd 10 10 0 0 0 0 -30 -30 dictrules 3 4 -letterVowel y -letterVowel r diff --git a/espeak-ng-data/lang/zls/hr b/espeak-ng-data/lang/zls/hr index 3d6214a7..d1cae3a3 100644 --- a/espeak-ng-data/lang/zls/hr +++ b/espeak-ng-data/lang/zls/hr @@ -13,5 +13,3 @@ formant 5 97 102 100 stressAdd 10 10 0 0 0 0 -30 -30 dictrules 1 -letterVowel y -letterVowel r diff --git a/espeak-ng-data/lang/zls/sr b/espeak-ng-data/lang/zls/sr index b9deeea3..81e33907 100644 --- a/espeak-ng-data/lang/zls/sr +++ b/espeak-ng-data/lang/zls/sr @@ -11,6 +11,3 @@ formant 5 97 102 100 stressAdd 10 10 0 0 0 0 -30 -30 dictrules 2 4 - -letterVowel y -letterVowel r diff --git a/espeak-ng-data/lang/zlw/cs b/espeak-ng-data/lang/zlw/cs index 6e2413a4..5c3bf2ac 100644 --- a/espeak-ng-data/lang/zlw/cs +++ b/espeak-ng-data/lang/zlw/cs @@ -1,4 +1,2 @@ name Czech language cs -letterVowel y -letterVowel r diff --git a/espeak-ng-data/lang/zlw/pl b/espeak-ng-data/lang/zlw/pl index 09a29334..b85f56be 100644 --- a/espeak-ng-data/lang/zlw/pl +++ b/espeak-ng-data/lang/zlw/pl @@ -2,4 +2,3 @@ name Polish language pl intonation 2 -letterVowel y diff --git a/espeak-ng-data/lang/zlw/sk b/espeak-ng-data/lang/zlw/sk index 2db37b03..e849e61b 100644 --- a/espeak-ng-data/lang/zlw/sk +++ b/espeak-ng-data/lang/zlw/sk @@ -1,4 +1,2 @@ name Slovak language sk -letterVowel y -letterVowel r diff --git a/src/libespeak-ng/tr_languages.c b/src/libespeak-ng/tr_languages.c index 860dfce1..85ed8bd7 100644 --- a/src/libespeak-ng/tr_languages.c +++ b/src/libespeak-ng/tr_languages.c @@ -113,6 +113,11 @@ ALPHABET *AlphabetFromChar(int c) 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) { // Clear all the specified groups @@ -485,6 +490,7 @@ Translator *SelectTranslator(const char *name) tr->langopts.vowel_pause = 0x30; tr->langopts.param[LOPT_DIERESES] = 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.accents = 1; @@ -514,6 +520,7 @@ Translator *SelectTranslator(const char *name) case L('b', 'g'): // Bulgarian { SetCyrillicLetters(tr); + SetLetterVowel(tr, 0x2a); 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_REGRESSIVE_VOICING] = 0x107; // devoice at end of word, and change voicing to match a following consonant (except v) @@ -582,6 +589,8 @@ Translator *SelectTranslator(const char *name) tr->langopts.numbers = NUM_OMIT_1_HUNDRED; + SetLetterVowel(tr, 'w'); // add letter to vowels and remove from consonants + SetLetterVowel(tr, 'y'); } break; case L('d', 'a'): // Danish @@ -591,6 +600,7 @@ Translator *SelectTranslator(const char *name) tr->langopts.stress_rule = STRESSPOSN_1L; 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; } break; @@ -607,6 +617,7 @@ Translator *SelectTranslator(const char *name) 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; + SetLetterVowel(tr, 'y'); tr->langopts.param[LOPT_UNPRONOUNCABLE] = 2; // use de_rules for unpronouncable rules } break; @@ -799,6 +810,7 @@ Translator *SelectTranslator(const char *name) tr->langopts.long_stop = 130; tr->langopts.numbers = NUM_DECIMAL_COMMA + NUM_ALLOW_SPACE; + SetLetterVowel(tr, 'y'); tr->langopts.spelling_stress = 1; tr->langopts.intonation_group = 3; // less intonation, don't raise pitch at comma } @@ -813,6 +825,7 @@ Translator *SelectTranslator(const char *name) 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; + SetLetterVowel(tr, 'y'); } break; case L3('h','a', 'k'): // Hakka Chinese @@ -903,6 +916,8 @@ Translator *SelectTranslator(const char *name) 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 + SetLetterVowel(tr, 'y'); + SetLetterVowel(tr, 'r'); } break; case L('h', 't'): // Haitian Creole @@ -930,6 +945,7 @@ Translator *SelectTranslator(const char *name) tr->langopts.decimal_sep = ','; tr->langopts.max_roman = 899; tr->langopts.min_roman = 1; + SetLetterVowel(tr, 'y'); tr->langopts.spelling_stress = 1; SetLengthMods(tr, 3); // all equal } @@ -986,6 +1002,7 @@ Translator *SelectTranslator(const char *name) SetLetterBits(tr, 4, "kpst"); // Letter group F SetLetterBits(tr, 3, "jvr"); // Letter group H 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.numbers2 = 0x2; } @@ -1010,6 +1027,7 @@ Translator *SelectTranslator(const char *name) tr->langopts.numbers2 = NUM2_NO_TEEN_ORDINALS; tr->langopts.roman_suffix = utf8_ordinal; tr->langopts.accents = 2; // Say "Capital" after the letter. + SetLetterVowel(tr, 'y'); } break; case L3('j', 'b', 'o'): // Lojban @@ -1022,6 +1040,7 @@ Translator *SelectTranslator(const char *name) 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_CAPS_IN_WORD] = 2; // capitals indicate stressed syllables + SetLetterVowel(tr, 'y'); tr->langopts.max_lengthmod = 368; } break; @@ -1192,6 +1211,7 @@ Translator *SelectTranslator(const char *name) tr->langopts.param[LOPT_DIERESES] = 1; tr->langopts.param[LOPT_PREFIXES] = 1; 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.ordinal_indicator = "e"; @@ -1205,6 +1225,7 @@ Translator *SelectTranslator(const char *name) SetupTranslator(tr, stress_lengths_no, NULL); 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; } break; @@ -1235,6 +1256,7 @@ Translator *SelectTranslator(const char *name) tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_2; 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) + SetLetterVowel(tr, 'y'); } break; case L('p', 't'): // Portuguese @@ -1250,6 +1272,7 @@ Translator *SelectTranslator(const char *name) 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.max_roman = 5000; + SetLetterVowel(tr, 'y'); ResetLetterBits(tr, 0x2); 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 @@ -1307,6 +1330,8 @@ Translator *SelectTranslator(const char *name) if (name2 == L('c', 's')) tr->langopts.numbers2 = 0x108; // variant numbers before milliards + SetLetterVowel(tr, 'y'); + SetLetterVowel(tr, 'r'); ResetLetterBits(tr, 0x20); SetLetterBits(tr, 5, sk_voiced); } @@ -1358,6 +1383,7 @@ Translator *SelectTranslator(const char *name) tr->langopts.stress_rule = STRESSPOSN_1R; 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.accents = 2; // "capital" after letter name } @@ -1369,6 +1395,7 @@ Translator *SelectTranslator(const char *name) SetupTranslator(tr, stress_lengths_sv, stress_amps_sv); 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.accents = 1; } diff --git a/src/libespeak-ng/voices.c b/src/libespeak-ng/voices.c index f2de297d..73a48fc4 100644 --- a/src/libespeak-ng/voices.c +++ b/src/libespeak-ng/voices.c @@ -114,11 +114,7 @@ enum { // these need a phoneme table to have been specified 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[] = { @@ -177,8 +173,6 @@ static MNEM_TAB keyword_tab[] = { { "l_length_mods", 0x100+LOPT_LENGTH_MODS }, { "apostrophe", 0x100+LOPT_APOSTROPHE }, - // these are alpha features that need to be tested and categorized - { "letterVowel", V_LETTER_VOWEL }, { NULL, 0 } }; @@ -869,27 +863,6 @@ voice_t *LoadVoice(const char *vname, int control) case V_MAINTAINER: case V_STATUS: 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: if ((key & 0xff00) == 0x100) { if (langopts)