emoji_data.sequence module¶
- class emoji_data.sequence.EmojiSequence¶
Bases:
object
Emoji and Text Presentation Sequences used to represent emoji
see: http://www.unicode.org/reports/tr51/#Emoji_Sequences
- __init__(code_points, type_field='', description='', comment='')¶
- pattern: Pattern = re.compile('\\U0001F468\\U0001F3FB\\u200D\\u2764\\uFE0F\\u200D\\U0001F48B\\u200D\\U0001F468\\U0001F3FB|\\U0001F468\\U0001F3FB\\u200D\\u2764\\uFE0F\\u200D\\U0001F48B\\u200D\\U0001F468\\U0001F3FC|\\U0001F468\\U000)¶
Compiled regular expression pattern object for all-together Emoji sequences.
- classmethod initial()¶
Initial the class
Load Emoji Sequences from package data file into class internal dictionary
- classmethod release()¶
- classmethod items()¶
Return an iterator of all string -> emoji-sequence pairs of the class
- Return type:
- classmethod keys()¶
Return an iterator of each emoji-sequence’s key string of the class
- classmethod values()¶
Return an iterator of all emoji-sequences of the class
- Return type:
- classmethod from_string(s)¶
Get an
EmojiSequence
instance from string
- classmethod from_characters(value)¶
Get an
EmojiSequence
instance fromEmojiCharacter
object or list- Parameters:
value (EmojiCharacter | Iterable[EmojiCharacter]) – Single or iterable object of
EmojiCharacter
, composing the sequence- Returns:
Instance from internal dictionary
- Raises:
KeyError – When passed-in value not found in internal dictionary
TypeError – When passed-in value is not
EmojiCharacter
object or list
- Return type:
- classmethod from_hex(value)¶
Get an
EmojiSequence
instance by unicode code point(s)- Parameters:
value (Union[str, int, Iterable[str], Iterable[int]]) –
A single or sequence of HEX string/code.
it could be:
one or more code-point(s) in HEX format string, separated by spaces
a single code-point integer
An iterable object whose members are code-point string in HEX format
An iterable object whose members are code-point integer
- Returns:
Instance returned from the class’s internal dictionary
- Raises:
KeyError – When passed-in value not found in the class’ internal dictionary
- Return type:
- property type_field: str¶
A convenience for parsing the emoji sequence files, and is not intended to be maintained as a property.
may be one of:
“Basic_Emoji”
“Emoji_Keycap_Sequence”
“Emoji_Flag_Sequence”
“Emoji_Tag_Sequence”
“Emoji_Modifier_Sequence”
“RGI_Emoji_ZWJ_Sequence”
- property characters: List[EmojiCharacter]¶
Emoji character objects list which makes up the Emoji Sequence
- property hex: str¶
Python style hex string of each emoji-characters’s code-point, separated by spaces
eg:
0xa9 0xfe0f
- property regex_pattern¶
Compiled regular expression pattern of the Emoji Sequence
- property code_points: List[int]¶
List of unicode integer value of the characters who make up Emoji Sequence
- property code_points_string: str¶
Unicode style hex string of each emoji-characters’s code-point, separated by spaces
eg:
00A9 FE0F
- classmethod find_all(s)¶
Find out all emoji sequences in a string, and return them in a list
Item of the returned list is as same as that in the iterator of
find()
The function equals:
list(EmojiSequence.find(s))
or
[x for x in EmojiSequence.find(s)]
- classmethod find(s)¶
Return an iterator which yields all emoji sequences in a string, without actually storing them all simultaneously.
- Parameters:
s (str) – The string to find emoji sequences in it
- Returns:
Item of the iterator is a 3-member tuple:
The found
EmojiSequence
objectBegin position of the emoji sequence in the string
End position of the emoji sequence in the string
- Return type:
Iterable[Tuple[EmojiSequence, int, int]]