Skip to main content

Emoji translation for Python

Project description

emoji_translate

Emoji translation for Python. This project relies on previous works, like emoji, emojilib, and vaderSentiment.

The primary differentiator of this work is the incorporation of keyword alternatives to the standard unicode emoji descriptions, which result in more natural translations. The translation can also be randomized if desired.

Example

from emoji_translate.emoji_translate import Translator

emo = Translator(exact_match_only=False, randomize=True)

# basic translation
print(emo.emojify('The house is on fire!'))     # > 'The 🏠 is on 🔥!'
print(emo.demojify('The 🏠 is on 🔥!'))         # > 'The house is on fire!'

# targeting sentiment
print(emo.remove_positive_emojis('That new SNL skit 😂😂'))    # > 'That new SNL skit'

print(emo.add_positive_emojis('I cannot believe it!', num=1))   # > 'I cannot believe it! 💪'
print(emo.add_negative_emojis('I cannot believe it!', num=2))   # > 'I cannot believe it! 🙄😱'
print(emo.add_neutral_emojis('I cannot believe it!', num=3))    # > 'I cannot believe it! 🚝🐮🛶'

NOTE: Emoji sentiment (polarity) was computed by concatenating the emoji short_name and keywords and passing them all into vaderSentiment.SentimentIntensityAnalyzer.

Installation

Via pip:

pip install emoji_translate

From master branch:

$ git clone https://github.com/fabriceyhc/emoji_translate.git
$ cd emoji_translate
$ python setup.py install

Roadmap

The following enhancements are planned for sometime in the future. Feel free to reach out / submit pull requests if you want to beat me to it.

  1. Creating a static / functional version of the package that does not require the creation of Emojify object.
  2. Incorporating part-of-speech (POS) information during emoji translation, possibly via spaCy.
  3. Using an alternative to VADER for sentiment analysis on the emojis, possibly offering a variety of options.

Authors

Fabrice Harel-Canada / @fabriceyhc

Download files

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

Source Distribution

emoji_translate-0.1.1.tar.gz (173.3 kB view details)

Uploaded Source

Built Distribution

emoji_translate-0.1.1-py3-none-any.whl (174.8 kB view details)

Uploaded Python 3

File details

Details for the file emoji_translate-0.1.1.tar.gz.

File metadata

  • Download URL: emoji_translate-0.1.1.tar.gz
  • Upload date:
  • Size: 173.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for emoji_translate-0.1.1.tar.gz
Algorithm Hash digest
SHA256 21a0495d14258e1be644ad7e3a331a537f2c4ba78f00859061c98990eff2da82
MD5 b04657505ddaa94db69a7034974dea77
BLAKE2b-256 34e08eaa05c9140f0646e85ab3de18dcb95834e2175d9414aad80e01daad43e7

See more details on using hashes here.

File details

Details for the file emoji_translate-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for emoji_translate-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0331c0d817a96203c95cb7a5c614394370e83a80662c41b8416b6211185dbad0
MD5 9176a54c5a0792b5cf74800f33f1933d
BLAKE2b-256 5ff2f0e493080deac42a0970bd7624181eb8d4aa779f7496314527637531d6c0

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