emoji_data.sequence module

class emoji_data.sequence.EmojiSequence(code_points: Iterable[int] | int, status: str = '', type_field: str = '', description: str = '', comment: str = '')

Bases: object

Emoji and Text Presentation Sequences used to represent emoji

see: http://www.unicode.org/reports/tr51/#Emoji_Variation_Sequences

property characters: List[EmojiCharacter]

Emoji character objects list which makes up the Emoji Sequence

Type:

List[EmojiCharacter]

property code_points: List[int]

List of unicode integer value of the characters who make up Emoji Sequence

Type:

List[int]

property comment: str
property description: str
classmethod find(s: str) List[Tuple[EmojiSequence, int, int]]

Finds out all emoji sequences in a string, and return them in a list

classmethod from_emoji_character(value: EmojiCharacter | Iterable[EmojiCharacter]) EmojiSequence

Get an EmojiSequence instance by EmojiCharacter object or list

Parameters:

value – Single or iterable object of EmojiCharacter, composing the sequence

Returns:

Instance from internal dictionary

Return type:

EmojiSequence

Raises:

KeyError – When passed-in value not found in internal dictionary

classmethod from_hex(value: str | int | Iterable[str] | Iterable[int]) EmojiSequence

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 points in hex format string, separated by spaces

    • one code point integer

    • An iterable object whose members are code point in hex format string

    • An iterable object whose members are code point integer

Returns:

Instance returned from the class’s internal dictionary

Return type:

EmojiSequence

Raises:

KeyError – When passed-in value not found in the class’ internal dictionary

classmethod from_text(value: str) EmojiSequence

Get an EmojiSequence instance by text

Parameters:

value (str) – Emoji string

Returns:

Instance from internal dictionary

Return type:

EmojiSequence

Raises:
  • RuntimeError – When non-emoji character in text

  • KeyError – When passed-in value not found in internal dictionary

classmethod initial()

Initial the class

Load Emoji Sequences from package data file into class internal dictionary

classmethod items() Iterable[Tuple[str, EmojiSequence]]

Return an iterator of all string -> emoji-sequence pairs of the class

classmethod iter_find(s: str) Iterable[Tuple[EmojiSequence, int, int]]

Return an iterator which yields all emoji sequences in a string, without actually storing them all simultaneously.

Item of the iterator is a 3-member tuple:

  1. 0: The found EmojiSequence object

  2. 1: Begin position of the emoji sequence string

  3. 2: End position of the emoji sequence string

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 express pattern object for all-together Emoji sequences.

property regex: str

Regular express of the Emoji Sequence

Type:

str

property regex_compiled

Compiled regular express pattern of the Emoji Sequence

classmethod release()
property status: str
property string: str

string of the Emoji Sequence

Type:

str

property type_field: str

A convenience for parsing the emoji sequence files, and is not intended to be maintained as a property.

one of the following:

  • “Basic_Emoji”

  • “Emoji_Keycap_Sequence”

  • “Emoji_Flag_Sequence”

  • “Emoji_Tag_Sequence”

  • “Emoji_Modifier_Sequence”

Type:

str

classmethod values() Iterable[EmojiSequence]

Return an iterator of all emoji-sequences of the class