Skip to main content

Provides all Unicode Emojis as an enum.

Project description

Unicode Emoji

This library provides all unicode emojis as an enum. You can use it to:

  • Turn emojis into descriptions;
  • Use emojis from code by textual description;
  • Detecting emojis in text;

Turn an emoji into a description

You can turn an emoji into a description (for example for sentiment analysis) by converting a string into an Emoji enum:

from UnicodeEmoji import Emoji

print(Emoji("😸").name)

# >>> 'grinning_cat_with_smiling_eyes'

Using Emojis from code by description

Sometimes it is easier to use textual descriptions of emojis in your code instead of the unicode representation directly.

This is especially the case for emojis that are composed of multiple parts, for example the woman technologist emoji 👩‍💻 which in some editors and terminals renders as 👩💻.

It can also be easier to differentiate between hard to spot differences, for example the grinning cat 😺 and cat face 🐱

from UnicodeEmoji import Emoji

print(f"Can you see the difference between a grinning cat {Emoji.grinning_cat} and a cat face {Emoji.cat_face}?")

# >>> Can you see the difference between a grinning cat 😺 and a cat face 🐱?

Detecting emojis in text

It can also be useful to detect if a string contains an emoji:

from UnicodeEmoji import Emoji

input = "Hi there! 😄"

all_emojis = [str(emoji) for emoji in Emoji]
input_contains_emoji = any(c in all_emojis for c in input)

print(input_contains_emoji)

# >>> True

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

UnicodeEmoji-0.0.2.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

UnicodeEmoji-0.0.2-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file UnicodeEmoji-0.0.2.tar.gz.

File metadata

  • Download URL: UnicodeEmoji-0.0.2.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for UnicodeEmoji-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2ee96f0993832518c362e29b73b38f6a2af80413cbd49e3a6ef1e71b5dba5d08
MD5 1e4c8c9f35fddf80df2caaf52e84f1d4
BLAKE2b-256 a87dfb26463ba7e1ea9ce1944af016661c5f0b439181b99081296507a5b52cc7

See more details on using hashes here.

File details

Details for the file UnicodeEmoji-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: UnicodeEmoji-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for UnicodeEmoji-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4920404742d0c91a106eaccce717b8cfe1a4ece30919251bf1a6087c5393e1d5
MD5 5666a7ab90a7e2216061ef97e2b64b75
BLAKE2b-256 8419037d02f817eb4dc7c8cada5ba98750497a3ce107e1fc9220ab8cee73e49a

See more details on using hashes here.

Supported by

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