From 05cab4f2dc89571ab8a5a1f04734722a39d0c108 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Thu, 11 May 2017 07:27:31 +0100 Subject: [PATCH] Extend compile_line to include pronunciation data after a space (e.g. multi-word pronunciation replacements). --- src/libespeak-ng/compiledict.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libespeak-ng/compiledict.c b/src/libespeak-ng/compiledict.c index 4ff8e2d0..c339be7f 100644 --- a/src/libespeak-ng/compiledict.c +++ b/src/libespeak-ng/compiledict.c @@ -369,7 +369,7 @@ typedef enum LINE_PARSER_MULTIPLE_WORDS = 2, LINE_PARSER_END_OF_WORDS = 3, LINE_PARSER_PRONUNCIATION = 4, - LINE_PARSER_END = 5, + LINE_PARSER_END_OF_PRONUNCIATION = 5, } LINE_PARSER_STATES; static int compile_line(char *linebuf, char *dict_line, int *hash) @@ -379,6 +379,7 @@ static int compile_line(char *linebuf, char *dict_line, int *hash) char *p; char *word; char *phonetic; + char *phonetic_end; unsigned int ix; LINE_PARSER_STATES step; unsigned int n_flag_codes = 0; @@ -519,11 +520,16 @@ static int compile_line(char *linebuf, char *dict_line, int *hash) break; case LINE_PARSER_PRONUNCIATION: if (isspace2(c)) { + phonetic_end = p; p[0] = 0; // terminate phonetic - step = LINE_PARSER_END; + step = LINE_PARSER_END_OF_PRONUNCIATION; } break; - case LINE_PARSER_END: + case LINE_PARSER_END_OF_PRONUNCIATION: + if (!isspace2(c)) { + *phonetic_end = ' '; + step = LINE_PARSER_PRONUNCIATION; + } break; } p++;