Skip to main content

emoji-data from Unicode® Emoji

Project description

emoji-data

CircleCI Codacy Badge Documentation Status


A library represents emoji sequences and characters from the data files listed in Unicode® Technical Standard #51(UNICODE EMOJI)

How to use

Examples below also in a notebook

Class EmojiSequence is most useful:

from emoji_data import EmojiSequence

EmojiSequence.initial()

initial() MUST be called - it loads emoji data files into the class' meta data

Iterate print Emojis

>>> for s, es in EmojiSequence:
>>>    print(' '.join('{:02X}'.format(n) for n in es.codes), s)

231A 
231B 
23E9 
23EA 
23EB 
23EC 
23F0 
23F3 
# ...
1F469 1F3FE 200D 1F33E 👩🏾‍🌾
1F469 1F3FE 200D 1F373 👩🏾‍🍳
1F469 1F3FE 200D 1F393 👩🏾‍🎓
1F469 1F3FE 200D 1F3A4 👩🏾‍🎤
1F469 1F3FE 200D 1F3A8 👩🏾‍🎨
1F469 1F3FE 200D 1F3EB 👩🏾‍🏫
1F469 1F3FE 200D 1F3ED 👩🏾‍🏭
1F469 1F3FE 200D 1F4BB 👩🏾‍💻
1F469 1F3FE 200D 1F4BC 👩🏾‍💼
1F469 1F3FE 200D 1F527 👩🏾‍🔧
1F469 1F3FE 200D 1F52C 👩🏾‍🔬
1F469 1F3FE 200D 1F680 👩🏾‍🚀
1F469 1F3FE 200D 1F692 👩🏾‍🚒
# ...

Check if hex list represents an Emoji

>>> hexes_list = [
        '1F6A3',
        '1F468 1F3FC 200D F68F',
        '1F468 1F3FB 200D 2708 FE0F',
        '023A',
        '1F469 200D 1F52C',
        '1F468 200D 1F468 200D 1F467 200D 1F467',
        '1F441 FE0F 200D 1F5E8 FE0E'
    ]

>>> for hexes in hexes_list:
>>>     try:
>>>         es = EmojiSequence.from_hexes(hexes.split())
>>>     except KeyError:
>>>         print('{} is NOT Emoji!'.format(hexes))
>>>     else:
>>>         print('{} is Emoji {}'.format(hexes, es.string))

1F6A3 is Emoji 🚣
1F468 1F3FC 200D F68F is NOT Emoji!
1F468 1F3FB 200D 2708 FE0F is Emoji 👨🏻‍✈️
023A is NOT Emoji!
1F469 200D 1F52C is Emoji 👩‍🔬
1F468 200D 1F468 200D 1F467 200D 1F467 is Emoji 👨‍👨‍👧‍👧
1F441 FE0F 200D 1F5E8 FE0E is NOT Emoji!

Check if a string is Emoji

>>> print('👨' in EmojiSequence)
>>> print('©' in EmojiSequence) # 00AE, unqualified
>>> print('5️⃣' in EmojiSequence)
>>> print('9⃣' in EmojiSequence)  # 0039 20E3, unqualified

True
False
True
False

Search Emojis inside texts

>>> pat = EmojiSequence.pattern

>>> strings = [
        "First:👨🏻‍⚕️. Second:👨🏻.",
        "I love 👨‍👨‍👧‍👧. It's ⛈️. I am 😀."
    ]

>>> for s in strings:
>>>     m = pat.search(s)
>>>     while m:
>>>         print('matched: [{} : {}] : {}'.format(m.start(), m.end(), m.group()))
>>>         m = pat.search(s, m.end())
>>>     print()

matched: [6 : 11] : 👨🏻‍⚕️
matched: [20 : 22] : 👨🏻

matched: [7 : 14] : 👨‍👨‍👧‍👧
matched: [21 : 23] : ⛈️
matched: [30 : 31] : 😀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emoji-data-0.1.3.tar.gz (138.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

emoji_data-0.1.3-py3-none-any.whl (110.7 kB view details)

Uploaded Python 3

File details

Details for the file emoji-data-0.1.3.tar.gz.

File metadata

  • Download URL: emoji-data-0.1.3.tar.gz
  • Upload date:
  • Size: 138.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for emoji-data-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5fc78fac63787b1c3b774b5aa51fdcbdeb0f9098b0bf662ee631ac29291e86e1
MD5 e0201369070f848e7dd8e6fabf46a474
BLAKE2b-256 24678cfc71d42d72a0f45ff4bb42e952d0798ef059c9ae33beea75b4d13375be

See more details on using hashes here.

File details

Details for the file emoji_data-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: emoji_data-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 110.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for emoji_data-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1d1ab61f3699364b9aab532c4ddf47894e1439ca7f05bc83e69ea1170b2fbb3e
MD5 325c44d104b2274787c4636a86998f8b
BLAKE2b-256 0b097e0d772b2238fa207aa8f38d0816db21a7b1af6620718eb2c9f3e61d5d8d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page