mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-10 08:13:55 +00:00
Add Pattern_White_Space support from PropList.txt.
This commit is contained in:
@@ -360,6 +360,7 @@ enum
|
||||
UCD_PROPERTY_OTHER_ID_CONTINUE = 0x0000000008000000ull, /**< @brief Other_ID_Continue */
|
||||
UCD_PROPERTY_SENTENCE_TERMINAL = 0x0000000010000000ull, /**< @brief Sentence_Terminal */
|
||||
UCD_PROPERTY_VARIATION_SELECTOR = 0x0000000020000000ull, /**< @brief Variation_Selector */
|
||||
UCD_PROPERTY_PATTERN_WHITE_SPACE = 0x0000000040000000ull, /**< @brief Pattern_White_Space */
|
||||
};
|
||||
|
||||
/** @brief Return the properties of the specified codepoint.
|
||||
@@ -850,6 +851,7 @@ namespace ucd
|
||||
Other_ID_Continue = UCD_PROPERTY_OTHER_ID_CONTINUE, /**< @brief Other_ID_Continue */
|
||||
Sentence_Terminal = UCD_PROPERTY_SENTENCE_TERMINAL, /**< @brief Sentence_Terminal */
|
||||
Variation_Selector = UCD_PROPERTY_VARIATION_SELECTOR, /**< @brief Variation_Selector */
|
||||
Pattern_White_Space = UCD_PROPERTY_PATTERN_WHITE_SPACE, /**< @brief Pattern_White_Space */
|
||||
};
|
||||
|
||||
/** @brief Return the properties of the specified codepoint.
|
||||
|
||||
+12
-6
@@ -22,8 +22,8 @@
|
||||
|
||||
static int properties_Cc(codepoint_t c)
|
||||
{
|
||||
if (c >= 0x0009 && c <= 0x000D) return UCD_PROPERTY_WHITE_SPACE;
|
||||
if (c == 0x0085) return UCD_PROPERTY_WHITE_SPACE;
|
||||
if (c >= 0x0009 && c <= 0x000D) return UCD_PROPERTY_WHITE_SPACE | UCD_PROPERTY_PATTERN_WHITE_SPACE;
|
||||
if (c == 0x0085) return UCD_PROPERTY_WHITE_SPACE | UCD_PROPERTY_PATTERN_WHITE_SPACE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ static int properties_Cf(codepoint_t c)
|
||||
case 0x2000:
|
||||
if (c == 0x200C) return UCD_PROPERTY_JOIN_CONTROL | UCD_PROPERTY_OTHER_GRAPHEME_EXTEND;
|
||||
if (c == 0x200D) return UCD_PROPERTY_JOIN_CONTROL;
|
||||
if (c >= 0x200E && c <= 0x200F) return UCD_PROPERTY_BIDI_CONTROL;
|
||||
if (c >= 0x200E && c <= 0x200F) return UCD_PROPERTY_BIDI_CONTROL | UCD_PROPERTY_PATTERN_WHITE_SPACE;
|
||||
if (c >= 0x202A && c <= 0x202E) return UCD_PROPERTY_BIDI_CONTROL;
|
||||
if (c >= 0x2061 && c <= 0x2064) return UCD_PROPERTY_OTHER_MATH;
|
||||
if (c >= 0x2066 && c <= 0x2069) return UCD_PROPERTY_BIDI_CONTROL;
|
||||
@@ -1678,6 +1678,12 @@ static int properties_So(codepoint_t c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int properties_Zs(codepoint_t c)
|
||||
{
|
||||
if (c == 0x0020) return UCD_PROPERTY_WHITE_SPACE | UCD_PROPERTY_PATTERN_WHITE_SPACE;
|
||||
return UCD_PROPERTY_WHITE_SPACE;
|
||||
}
|
||||
|
||||
ucd_property ucd_properties(codepoint_t c, ucd_category category)
|
||||
{
|
||||
switch (category)
|
||||
@@ -1704,9 +1710,9 @@ ucd_property ucd_properties(codepoint_t c, ucd_category category)
|
||||
case UCD_CATEGORY_Sk: return properties_Sk(c);
|
||||
case UCD_CATEGORY_Sm: return properties_Sm(c);
|
||||
case UCD_CATEGORY_So: return properties_So(c);
|
||||
case UCD_CATEGORY_Zl: return UCD_PROPERTY_WHITE_SPACE;
|
||||
case UCD_CATEGORY_Zp: return UCD_PROPERTY_WHITE_SPACE;
|
||||
case UCD_CATEGORY_Zs: return UCD_PROPERTY_WHITE_SPACE;
|
||||
case UCD_CATEGORY_Zl: return UCD_PROPERTY_WHITE_SPACE | UCD_PROPERTY_PATTERN_WHITE_SPACE;
|
||||
case UCD_CATEGORY_Zp: return UCD_PROPERTY_WHITE_SPACE | UCD_PROPERTY_PATTERN_WHITE_SPACE;
|
||||
case UCD_CATEGORY_Zs: return properties_Zs(c);
|
||||
default: return 0; // Co Cs Ii Lt Me Sc
|
||||
};
|
||||
}
|
||||
|
||||
@@ -151,6 +151,7 @@ def properties(data):
|
||||
props += (2 ** 27) * data.get('Other_ID_Continue', 0)
|
||||
props += (2 ** 28) * data.get('Sentence_Terminal', 0)
|
||||
props += (2 ** 29) * data.get('Variation_Selector', 0)
|
||||
props += (2 ** 30) * data.get('Pattern_White_Space', 0)
|
||||
return props
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user