emoji_data.definitions module¶
Regular expressions for Emoji Definitions
ref: http://www.unicode.org/reports/tr51/#Definitions
- class emoji_data.definitions.QualifiedType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum
- FULLY_QUALIFIED = 'fully-qualified'¶
- MINIMALLY_QUALIFIED = 'minimally-qualified'¶
- UNQUALIFIED = 'unqualified'¶
- emoji_data.definitions.detect_qualified(s: str) QualifiedType [source]¶
Detect qualified type of emoji string
qualified emoji character — An emoji character in a string that
has default emoji presentation or
is the first character in an emoji modifier sequence or
is not a default emoji presentation character, but is the first character in an emoji presentation sequence.
fully-qualified emoji — A qualified emoji character, or an emoji sequence in which each emoji character is qualified.
minimally-qualified emoji — An emoji sequence in which the first character is qualified but the sequence is not fully qualified.
unqualified emoji — An emoji that is neither fully-qualified nor minimally qualified.
- Parameters:
s (str) – string to detect
- Return type:
- emoji_data.definitions.is_default_emoji_presentation_character(c: str) bool [source]¶
detect default emoji presentation character
A character that, by default, should appear with an emoji presentation, rather than a text presentation.
default_emoji_presentation_character := \p{Emoji_Presentation}
These characters have the Emoji_Presentation property.
- emoji_data.definitions.is_default_text_presentation_character(c: str) bool [source]¶
detect default text presentation character
A character that, by default, should appear with a text presentation, rather than an emoji presentation.
- emoji_data.definitions.is_emoji_character(c: str) bool [source]¶
detect emoji character
A character that has the Emoji property.
emoji_character := \p{Emoji}
These characters are recommended for use as emoji.
- emoji_data.definitions.is_emoji_core_sequence(s: str) bool [source]¶
emoji core sequence — A sequence of the following form:
emoji_core_sequence := emoji_character | emoji_presentation_sequence | emoji_keycap_sequence | emoji_modifier_sequence | emoji_flag_sequence
- emoji_data.definitions.is_emoji_flag_sequence(s: str) bool [source]¶
emoji flag sequence — A sequence of two Regional Indicator characters, where the corresponding ASCII characters are valid region sequences as specified by Unicode region subtags in [CLDR], with idStatus = “regular”, “deprecated”, or “macroregion”.
See also
emoji_flag_sequence := regional_indicator regional_indicator regional_indicator := \p{Regional_Indicator}
A singleton Regional Indicator character is not a well-formed emoji flag sequence.
- emoji_data.definitions.is_emoji_keycap_sequence(s: str) bool [source]¶
A sequence of the following form:
emoji_keycap_sequence := [0-9#*] \x{FE0F 20E3}
These sequences are in the emoji-sequences.txt file listed under the type_field Emoji_Keycap_Sequence
- emoji_data.definitions.is_emoji_modifier(c: str) bool [source]¶
detect emoji modifier
A character that can be used to modify the appearance of a preceding emoji in an emoji modifier sequence.
- emoji_data.definitions.is_emoji_modifier_base(c: str) bool [source]¶
Detect emoji modifier base
A character whose appearance can be modified by a subsequent emoji modifier in an emoji modifier sequence.
- emoji_data.definitions.is_emoji_modifier_sequence(s: str) bool [source]¶
Detect emoji modifier sequence
A sequence of the following form:
emoji_modifier_sequence := emoji_modifier_base emoji_modifier
- emoji_data.definitions.is_emoji_presentation_selector(c: str) bool [source]¶
detect emoji presentation selector
The character U+FE0F VARIATION SELECTOR-16 (VS16), used to request an emoji presentation for an emoji character. (Also known as emoji variation selector in prior versions of this specification.)
- emoji_data.definitions.is_emoji_presentation_sequence(s: str) bool [source]¶
detect emoji presentation sequence
A variation sequence consisting of an emoji character followed by a emoji presentation selector.
emoji_presentation_sequence := emoji_character emoji_presentation_selector
The only valid emoji presentation sequences are those listed in emoji-variation-sequences.txt
- emoji_data.definitions.is_emoji_sequence(s: str) bool [source]¶
emoji sequence — A core sequence, tag sequence, or ZWJ sequence, as follows:
emoji_sequence := emoji_core_sequence | emoji_zwj_sequence | emoji_tag_sequence
Note
all emoji sequences are single grapheme clusters: there is never a grapheme cluster boundary within an emoji sequence. This affects editing operations, such as cursor movement or deletion, as well as word break, line break, and so on. For more information, see [UAX29].
- emoji_data.definitions.is_emoji_tag_sequence(s: str) bool [source]¶
emoji tag sequence (ETS) — A sequence of the following form:
emoji_tag_sequence := tag_base tag_spec tag_end tag_base := emoji_character | emoji_modifier_sequence | emoji_presentation_sequence tag_spec := [\x{E0020}-\x{E007E}]+ tag_end := \x{E007F}
The tag_spec consists of all characters from U+E0020 TAG SPACE to U+E007E TAG TILDE. Each tag_spec defines a particular visual variant to be applied to the tag_base character(s). Though tag_spec includes the values U+E0041 TAG LATIN CAPITAL LETTER A .. U+E005A TAG LATIN CAPITAL LETTER Z, they are not used currently and are reserved for future extensions.
The tag_end consists of the character U+E007F CANCEL TAG, and must be used to terminate the sequence.
A sequence of tag characters that is not part of an emoji_tag_sequence is not a well-formed emoji tag sequence.
- emoji_data.definitions.is_emoji_zwj_element(s: str) bool [source]¶
emoji ZWJ element — An element that can be used in an emoji ZWJ sequence, as follows:
emoji_zwj_element := emoji_core_sequence | emoji_tag_sequence
- emoji_data.definitions.is_emoji_zwj_sequence(s: str) bool [source]¶
emoji sequence — A core sequence, tag sequence, or ZWJ sequence, as follows:
emoji_sequence := emoji_core_sequence | emoji_zwj_sequence | emoji_tag_sequence
Note
all emoji sequences are single grapheme clusters: there is never a grapheme cluster boundary within an emoji sequence. This affects editing operations, such as cursor movement or deletion, as well as word break, line break, and so on. For more information, see [UAX29].
- emoji_data.definitions.is_regional_indicator(s: str) bool [source]¶
A singleton Regional Indicator character is not a well-formed emoji flag sequence.
- emoji_data.definitions.is_text_presentation_selector(c: str) bool [source]¶
detect text presentation selector
The character U+FE0E VARIATION SELECTOR-15 (VS15), used to request a text presentation for an emoji character. (Also known as text variation selector in prior versions of this specification.)
- emoji_data.definitions.is_text_presentation_sequence(s: str) bool [source]¶
detect text presentation selector
The character U+FE0E VARIATION SELECTOR-15 (VS15), used to request a text presentation for an emoji character. (Also known as text variation selector in prior versions of this specification.)
- emoji_data.definitions.is_qualified_emoji_character(s: str, i: int) bool [source]¶
An emoji character in a string that
has default emoji presentation or
is the first character in an emoji modifier sequence or
is not a default emoji presentation character, but is the first character in an emoji presentation sequence.