mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-12-06 00:34:13 +00:00
ucd-tools: Inverted_Terminal_Punctuation eSpeakNG extended property support; use in clause_type_from_codepoint.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
/* Tokenizer APIs.
|
||||
*
|
||||
* Copyright (C) 2005 to 2015 by Jonathan Duddington
|
||||
* email: jonsd@users.sourceforge.net
|
||||
* Copyright (C) 2017 Reece H. Dunn
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -34,20 +32,6 @@
|
||||
#include "synthesize.h"
|
||||
#include "translate.h"
|
||||
|
||||
// punctuations symbols that can end a clause
|
||||
static const unsigned short punct_chars[] = {
|
||||
0x00a1, // inverted exclamation
|
||||
0x00bf, // inverted question
|
||||
0
|
||||
};
|
||||
|
||||
// indexed by entry num. in punct_chars
|
||||
static const unsigned int punct_attributes[] = {
|
||||
CLAUSE_SEMICOLON | CLAUSE_OPTIONAL_SPACE_AFTER, // inverted exclamation
|
||||
CLAUSE_SEMICOLON | CLAUSE_OPTIONAL_SPACE_AFTER, // inverted question
|
||||
0
|
||||
};
|
||||
|
||||
#define ESPEAKNG_CLAUSE_TYPE_PROPERTY_MASK 0xFFF0000000000000ull
|
||||
|
||||
int clause_type_from_codepoint(uint32_t c)
|
||||
@@ -55,11 +39,6 @@ int clause_type_from_codepoint(uint32_t c)
|
||||
ucd_category cat = ucd_lookup_category(c);
|
||||
ucd_property props = ucd_properties(c, cat);
|
||||
|
||||
for (int ix = 0; punct_chars[ix] != 0; ++ix) {
|
||||
if (punct_chars[ix] == c)
|
||||
return punct_attributes[ix];
|
||||
}
|
||||
|
||||
switch (props & ESPEAKNG_CLAUSE_TYPE_PROPERTY_MASK)
|
||||
{
|
||||
case ESPEAKNG_PROPERTY_FULL_STOP:
|
||||
@@ -90,6 +69,8 @@ int clause_type_from_codepoint(uint32_t c)
|
||||
case ESPEAKNG_PROPERTY_EXTENDED_DASH:
|
||||
return CLAUSE_SEMICOLON;
|
||||
case ESPEAKNG_PROPERTY_SEMI_COLON | ESPEAKNG_PROPERTY_OPTIONAL_SPACE_AFTER:
|
||||
case ESPEAKNG_PROPERTY_QUESTION_MARK | ESPEAKNG_PROPERTY_OPTIONAL_SPACE_AFTER | ESPEAKNG_PROPERTY_INVERTED_TERMINAL_PUNCTUATION:
|
||||
case ESPEAKNG_PROPERTY_EXCLAMATION_MARK | ESPEAKNG_PROPERTY_OPTIONAL_SPACE_AFTER | ESPEAKNG_PROPERTY_INVERTED_TERMINAL_PUNCTUATION:
|
||||
return CLAUSE_SEMICOLON | CLAUSE_OPTIONAL_SPACE_AFTER;
|
||||
case ESPEAKNG_PROPERTY_ELLIPSIS:
|
||||
return CLAUSE_SEMICOLON | CLAUSE_SPEAK_PUNCTUATION_NAME | CLAUSE_OPTIONAL_SPACE_AFTER;
|
||||
|
||||
Reference in New Issue
Block a user