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.0.tar.gz (172.6 kB view details)

Uploaded Source

Built Distribution

emoji_translate-0.1.0-py3-none-any.whl (426.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: emoji_translate-0.1.0.tar.gz
  • Upload date:
  • Size: 172.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7

File hashes

Hashes for emoji_translate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a630633b5b6538b1f1fee35561082022b9e42b96551f469c7fc9b5d18589aed
MD5 b75be6c1c4eafd753949f24c77e765dd
BLAKE2b-256 4fad34812b7a340efc28b7bfcf236e6e5867c6d01e81df0b60dcd3b181f27e5a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: emoji_translate-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 426.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7

File hashes

Hashes for emoji_translate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c3001b9a8cb8de98dad2a786e9b8474707ff67e23f8f804bcc224cfe182475d
MD5 eb1ccaca5fd33dbd227c22ba24af91b3
BLAKE2b-256 0fd743aafe150d7dd1594a0b9c8fd0949c24b47fa6f92298f85b286f191b0642

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