From 4d70ceceb5fa411d1bf84b0ca9022f278d3b624f Mon Sep 17 00:00:00 2001 From: Juho Hiltunen Date: Sun, 9 Oct 2022 21:51:05 +0300 Subject: [PATCH] Remove LOPT_IT_DOUBLING and delete unused functionality. Code checked for both langopt LOPT_IT_DOUBLING and attribe $double. LOPT_IT_DOUBLING is redundant. $double already has a test in dictionary.test Code had a check for tr->langopts.param[LOPT_IT_DOUBLING] & 2 but that bit value is not used in any language. That logic was removed. --- src/libespeak-ng/tr_languages.c | 4 ---- src/libespeak-ng/translate.c | 11 +++-------- src/libespeak-ng/translate.h | 4 ---- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/libespeak-ng/tr_languages.c b/src/libespeak-ng/tr_languages.c index f02e64d8..038bc10a 100644 --- a/src/libespeak-ng/tr_languages.c +++ b/src/libespeak-ng/tr_languages.c @@ -799,7 +799,6 @@ Translator *SelectTranslator(const char *name) // fallthrough: case L('f', 'i'): // Finnish { - tr->langopts.param[LOPT_IT_DOUBLING] = 1; tr->langopts.long_stop = 130; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_DFRACTION_2 | NUM_ORDINAL_DOT; @@ -929,7 +928,6 @@ Translator *SelectTranslator(const char *name) tr->langopts.stress_rule = STRESSPOSN_1L; tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2 | S_NO_AUTO_2 | 0x8000 | S_HYPEN_UNSTRESS; tr->langopts.unstressed_wd1 = 2; - tr->langopts.param[LOPT_IT_DOUBLING] = 1; tr->langopts.param[LOPT_ANNOUNCE_PUNCT] = 2; // don't break clause before announcing . ? ! tr->langopts.numbers = NUM_DFRACTION_5 | NUM_ALLOW_SPACE | NUM_ROMAN | NUM_ROMAN_ORDINAL | NUM_ROMAN_CAPITALS | NUM_ORDINAL_DOT | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND; @@ -1032,7 +1030,6 @@ Translator *SelectTranslator(const char *name) tr->langopts.unstressed_wd1 = 0; tr->langopts.unstressed_wd2 = 2; tr->langopts.param[LOPT_IT_LENGTHEN] = 2; // remove lengthen indicator from unstressed or non-penultimate syllables - tr->langopts.param[LOPT_IT_DOUBLING] = 1; // double the first consonant if the previous word ends in a stressed vowel (changed to =1, 23.01.2014 - only use if prev.word has $double) tr->langopts.param[LOPT_SONORANT_MIN] = 130; // limit the shortening of sonorants before short vowels tr->langopts.param[LOPT_REDUCE] = 1; // reduce vowels even if phonemes are specified in it_list tr->langopts.param[LOPT_ALT] = 2; // call ApplySpecialAttributes2() if a word has $alt or $alt2 @@ -1390,7 +1387,6 @@ Translator *SelectTranslator(const char *name) tr->langopts.stress_rule = STRESSPOSN_1L; tr->langopts.stress_flags = S_FINAL_DIM_ONLY | S_FINAL_NO_2 | S_2_TO_HEAVY; // move secondary stress from light to a following heavy syllable - tr->langopts.param[LOPT_IT_DOUBLING] = 1; tr->langopts.long_stop = 130; tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_SWAP_TENS | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ORDINAL_DOT; diff --git a/src/libespeak-ng/translate.c b/src/libespeak-ng/translate.c index 01f89002..7aa63097 100644 --- a/src/libespeak-ng/translate.c +++ b/src/libespeak-ng/translate.c @@ -668,7 +668,6 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa srcix = source_ix+1; } else if (ph_code == phonX1) { // a language specific action - if (tr->langopts.param[LOPT_IT_DOUBLING]) flags |= FLAG_DOUBLING; } else { ph_list2[n_ph_list2].phcode = ph_code; @@ -700,13 +699,9 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa next_tone = 0; } } else { - if (first_phoneme && tr->langopts.param[LOPT_IT_DOUBLING]) { - if (((tr->prev_dict_flags[0] & FLAG_DOUBLING) && (tr->langopts.param[LOPT_IT_DOUBLING] & 1)) || - (tr->end_stressed_vowel && (tr->langopts.param[LOPT_IT_DOUBLING] & 2))) { - // italian, double the initial consonant if the previous word ends with a - // stressed vowel, or is marked with a flag - ph_list2[n_ph_list2].synthflags |= SFLAG_LENGTHEN; - } + if (first_phoneme && tr->prev_dict_flags[0] & FLAG_DOUBLING) { + // double the initial consonant if the previous word is marked with a flag + ph_list2[n_ph_list2].synthflags |= SFLAG_LENGTHEN; } } diff --git a/src/libespeak-ng/translate.h b/src/libespeak-ng/translate.h index f292a7a1..922acca2 100644 --- a/src/libespeak-ng/translate.h +++ b/src/libespeak-ng/translate.h @@ -326,10 +326,6 @@ typedef struct { // 1 = stressed syllable is indicated by capitals #define LOPT_CAPS_IN_WORD 13 -// bit 0=Italian "syntactic doubling" of consoants in the word after a word marked with $double attribute -// bit 1=also after a word which ends with a stressed vowel -#define LOPT_IT_DOUBLING 14 - // Call ApplySpecialAttributes() if $alt or $alt2 is set for a word // bit 1: stressed syllable: $alt change [e],[o] to [E],[O], $alt2 change [E],[O] to [e],[o] #define LOPT_ALT 15