mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-08 23:47:27 +00:00
Add ASCII_Hex_Digit support from PropList.txt.
This commit is contained in:
@@ -339,6 +339,7 @@ typedef enum ucd_property_
|
||||
UCD_PROPERTY_TERMINAL_PUNCTUATION = 0x00000080, /**< @brief Terminal_Punctuation PropList */
|
||||
UCD_PROPERTY_OTHER_MATH = 0x00000100, /**< @brief Other_Math PropList */
|
||||
UCD_PROPERTY_HEX_DIGIT = 0x00000200, /**< @brief Hex_Digit PropList */
|
||||
UCD_PROPERTY_ASCII_HEX_DIGIT = 0x00000400, /**< @brief ASCII_Hex_Digit PropList */
|
||||
} ucd_property;
|
||||
|
||||
/** @brief Return the properties of the specified codepoint.
|
||||
@@ -808,6 +809,7 @@ namespace ucd
|
||||
Terminal_Punctuation = UCD_PROPERTY_TERMINAL_PUNCTUATION, /**< @brief Terminal_Punctuation PropList */
|
||||
Other_Math = UCD_PROPERTY_OTHER_MATH, /**< @brief Other_Math PropList */
|
||||
Hex_Digit = UCD_PROPERTY_HEX_DIGIT, /**< @brief Hex_Digit PropList */
|
||||
ASCII_Hex_Digit = UCD_PROPERTY_ASCII_HEX_DIGIT, /**< @brief ASCII_Hex_Digit PropList */
|
||||
};
|
||||
|
||||
/** @brief Return the properties of the specified codepoint.
|
||||
|
||||
+3
-3
@@ -53,7 +53,7 @@ static int properties_Ll(codepoint_t c)
|
||||
switch (c & 0xFFFFFF00)
|
||||
{
|
||||
case 0x0000:
|
||||
if (c >= 0x0061 && c <= 0x0066) return UCD_PROPERTY_HEX_DIGIT;
|
||||
if (c >= 0x0061 && c <= 0x0066) return UCD_PROPERTY_HEX_DIGIT | UCD_PROPERTY_ASCII_HEX_DIGIT;
|
||||
break;
|
||||
case 0x0300:
|
||||
if (c >= 0x03D0 && c <= 0x03D2) return UCD_PROPERTY_OTHER_MATH; // Ll|Lu
|
||||
@@ -122,7 +122,7 @@ static int properties_Lu(codepoint_t c)
|
||||
switch (c & 0xFFFFFF00)
|
||||
{
|
||||
case 0x0000:
|
||||
if (c >= 0x0041 && c <= 0x0046) return UCD_PROPERTY_HEX_DIGIT;
|
||||
if (c >= 0x0041 && c <= 0x0046) return UCD_PROPERTY_HEX_DIGIT | UCD_PROPERTY_ASCII_HEX_DIGIT;
|
||||
break;
|
||||
case 0x0300:
|
||||
if (c >= 0x03D0 && c <= 0x03D2) return UCD_PROPERTY_OTHER_MATH; // Ll|Lu
|
||||
@@ -201,7 +201,7 @@ static int properties_Nd(codepoint_t c)
|
||||
switch (c & 0xFFFFFF00)
|
||||
{
|
||||
case 0x0000:
|
||||
if (c >= 0x0030 && c <= 0x0039) return UCD_PROPERTY_HEX_DIGIT;
|
||||
if (c >= 0x0030 && c <= 0x0039) return UCD_PROPERTY_HEX_DIGIT | UCD_PROPERTY_ASCII_HEX_DIGIT;
|
||||
break;
|
||||
case 0xFF00:
|
||||
if (c >= 0xFF10 && c <= 0xFF19) return UCD_PROPERTY_HEX_DIGIT;
|
||||
|
||||
+12
-11
@@ -120,17 +120,18 @@ def decomposition_type(data, dtype):
|
||||
return None
|
||||
|
||||
def properties(data):
|
||||
props = 0
|
||||
props += 1 * data.get('White_Space', 0)
|
||||
props += 2 * (decomposition_type(data, '<noBreak>') != None)
|
||||
props += 4 * data.get('Bidi_Control', 0)
|
||||
props += 8 * data.get('Join_Control', 0)
|
||||
props += 16 * data.get('Dash', 0)
|
||||
props += 32 * data.get('Hyphen', 0)
|
||||
props += 64 * data.get('Quotation_Mark', 0)
|
||||
props += 128 * data.get('Terminal_Punctuation', 0)
|
||||
props += 256 * data.get('Other_Math', 0)
|
||||
props += 512 * data.get('Hex_Digit', 0)
|
||||
props = 0
|
||||
props += 1 * data.get('White_Space', 0)
|
||||
props += 2 * (decomposition_type(data, '<noBreak>') != None)
|
||||
props += 4 * data.get('Bidi_Control', 0)
|
||||
props += 8 * data.get('Join_Control', 0)
|
||||
props += 16 * data.get('Dash', 0)
|
||||
props += 32 * data.get('Hyphen', 0)
|
||||
props += 64 * data.get('Quotation_Mark', 0)
|
||||
props += 128 * data.get('Terminal_Punctuation', 0)
|
||||
props += 256 * data.get('Other_Math', 0)
|
||||
props += 512 * data.get('Hex_Digit', 0)
|
||||
props += 1024 * data.get('ASCII_Hex_Digit', 0)
|
||||
return props
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user