mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-08 23:47:27 +00:00
cleanup: move numbers to LoadLanguageOptions()
Note: This feature has no tests.
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -119,6 +120,29 @@ void LoadLanguageOptions(Translator *translator, int key, char *keyValue ) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case V_NUMBERS: {
|
||||||
|
// if (CheckTranslator(translator, langopts_tab, key) != 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// expect a list of numbers
|
||||||
|
while (*keyValue != 0) {
|
||||||
|
while (isspace(*keyValue)) keyValue++;
|
||||||
|
if ((n = atoi(keyValue)) > 0) {
|
||||||
|
keyValue++;
|
||||||
|
if (n < 32) {
|
||||||
|
translator->langopts.numbers |= (1 << n);
|
||||||
|
} else {
|
||||||
|
if (n < 64)
|
||||||
|
translator->langopts.numbers2 |= (1 << (n-32));
|
||||||
|
else
|
||||||
|
fprintf(stderr, "numbers: Bad option number %d\n", n); }
|
||||||
|
}
|
||||||
|
while (isalnum(*keyValue)) keyValue++;
|
||||||
|
}
|
||||||
|
ProcessLanguageOptions(&(translator->langopts));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case V_LOWERCASE_SENTENCE: {
|
case V_LOWERCASE_SENTENCE: {
|
||||||
if (CheckTranslator(translator, langopts_tab, key) != 0)
|
if (CheckTranslator(translator, langopts_tab, key) != 0)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -808,7 +808,7 @@ Translator *SelectTranslator(const char *name)
|
|||||||
tr->langopts.param[LOPT_IT_DOUBLING] = 1;
|
tr->langopts.param[LOPT_IT_DOUBLING] = 1;
|
||||||
tr->langopts.long_stop = 130;
|
tr->langopts.long_stop = 130;
|
||||||
|
|
||||||
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;
|
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
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ const MNEM_TAB langopts_tab[] = {
|
|||||||
{ "dictrules", V_DICTRULES },
|
{ "dictrules", V_DICTRULES },
|
||||||
{ "intonation", V_INTONATION },
|
{ "intonation", V_INTONATION },
|
||||||
{ "lowercaseSentence", V_LOWERCASE_SENTENCE },
|
{ "lowercaseSentence", V_LOWERCASE_SENTENCE },
|
||||||
|
{ "numbers", V_NUMBERS },
|
||||||
{ "stressAdd", V_STRESSADD },
|
{ "stressAdd", V_STRESSADD },
|
||||||
{ "stressAmp", V_STRESSAMP },
|
{ "stressAmp", V_STRESSAMP },
|
||||||
{ "stressLength", V_STRESSLENGTH },
|
{ "stressLength", V_STRESSLENGTH },
|
||||||
@@ -157,7 +158,6 @@ static const MNEM_TAB keyword_tab[] = {
|
|||||||
{ "voicing", V_VOICING },
|
{ "voicing", V_VOICING },
|
||||||
{ "breath", V_BREATH },
|
{ "breath", V_BREATH },
|
||||||
{ "breathw", V_BREATHW },
|
{ "breathw", V_BREATHW },
|
||||||
{ "numbers", V_NUMBERS },
|
|
||||||
{ "mbrola", V_MBROLA },
|
{ "mbrola", V_MBROLA },
|
||||||
{ "consonants", V_CONSONANTS },
|
{ "consonants", V_CONSONANTS },
|
||||||
{ "klatt", V_KLATT },
|
{ "klatt", V_KLATT },
|
||||||
@@ -706,28 +706,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
case V_NUMBERS:
|
|
||||||
if (CheckTranslator(translator, keyword_tab, key) != 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// expect a list of numbers
|
|
||||||
while (*p != 0) {
|
|
||||||
while (isspace(*p)) p++;
|
|
||||||
if ((n = atoi(p)) > 0) {
|
|
||||||
p++;
|
|
||||||
if (n < 32) {
|
|
||||||
translator->langopts.numbers |= (1 << n);
|
|
||||||
} else {
|
|
||||||
if (n < 64)
|
|
||||||
translator->langopts.numbers2 |= (1 << (n-32));
|
|
||||||
else
|
|
||||||
fprintf(stderr, "numbers: Bad option number %d\n", n); }
|
|
||||||
}
|
|
||||||
while (isalnum(*p)) p++;
|
|
||||||
}
|
|
||||||
ProcessLanguageOptions(&(translator->langopts));
|
|
||||||
|
|
||||||
break;
|
|
||||||
case V_REPLACE:
|
case V_REPLACE:
|
||||||
if (phonemes_set == false) {
|
if (phonemes_set == false) {
|
||||||
// must set up a phoneme table before we can lookup phoneme mnemonics
|
// must set up a phoneme table before we can lookup phoneme mnemonics
|
||||||
|
|||||||
Reference in New Issue
Block a user