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}?")
# >>> Easy emojis in Python 🐍!
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for UnicodeEmoji-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef9a3f351de417715af43800258878115aff45e7b0e37b7addd3c73fe1241334 |
|
MD5 | 01007921d16e66be40824a90b8c2572d |
|
BLAKE2b-256 | 302788d7d0e7b76838223a705b1e74554f08c54deecd3b7f6045aca7d9758301 |