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

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_translate-0.1.1.tar.gz (173.3 kB view hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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