tokenizer.c: Support question mark tokens.

This commit is contained in:
Reece H. Dunn
2017-05-01 17:50:54 +01:00
parent 8f62e18324
commit 128ceaff6a
3 changed files with 21 additions and 2 deletions
+8 -1
View File
@@ -93,9 +93,10 @@ typedef enum {
ESPEAKNG_CTYPE_LOWERCASE,
ESPEAKNG_CTYPE_UPPERCASE,
ESPEAKNG_CTYPE_FULL_STOP,
ESPEAKNG_CTYPE_QUESTION_MARK,
} espeakng_CTYPE;
#define ESPEAKNG_CTYPE_PROPERTY_MASK 0x800000000000C001ull
#define ESPEAKNG_CTYPE_PROPERTY_MASK 0xC00000000000C001ull
// Reference: http://www.unicode.org/reports/tr14/tr14-32.html -- Unicode Line Breaking Algorithm
static espeakng_CTYPE codepoint_type(uint32_t c)
@@ -136,6 +137,8 @@ static espeakng_CTYPE codepoint_type(uint32_t c)
return ESPEAKNG_CTYPE_UPPERCASE;
case ESPEAKNG_PROPERTY_FULL_STOP:
return ESPEAKNG_CTYPE_FULL_STOP;
case ESPEAKNG_PROPERTY_QUESTION_MARK:
return ESPEAKNG_CTYPE_QUESTION_MARK;
}
// 4. Classify the remaining codepoints.
@@ -271,6 +274,10 @@ tokenizer_state_default(espeak_ng_TOKENIZER *tokenizer)
current += utf8_out(c, current);
*current = '\0';
return ESPEAKNG_TOKEN_FULL_STOP;
case ESPEAKNG_CTYPE_QUESTION_MARK:
current += utf8_out(c, current);
*current = '\0';
return ESPEAKNG_TOKEN_QUESTION_MARK;
default:
current += utf8_out(c, current);
*current = '\0';
+1
View File
@@ -52,6 +52,7 @@ typedef enum
ESPEAKNG_TOKEN_WORD_MIXEDCASE,
ESPEAKNG_TOKEN_WORD_CAPITALIZED,
ESPEAKNG_TOKEN_FULL_STOP,
ESPEAKNG_TOKEN_QUESTION_MARK,
} espeak_ng_TOKEN_TYPE;
espeak_ng_TOKEN_TYPE