Skip to main content

emosent-py

emosent-py is a Python utility package to get Sentiment Rankings for Unicode Emojis.

Based on the research by Kralj Novak P, Smailović J, Sluban B, Mozetič I (2015) on Sentiment of Emojis.

Journal Link: https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0144296

CSV Data acquired from CLARIN repository, Repository Link: http://hdl.handle.net/11356/1048

This project is inspired by emoji-sentiment, a similar utility written in JavaScript.

Emoji Support

The complete listed of Emojis to Sentiment Ranking supported by this project can be found at Emoji Sentiment Ranking v1.0.

Installation

You can install emosent-py from using pip:

pip install emosent-py

Usage

Example 1

from emosent import get_emoji_sentiment_rank
get_emoji_sentiment_rank('❤')

Output:

{'unicode_codepoint': '0x2764',
 'occurrences': 8050,
 'position': 0.746943086,
 'negative': 355.0,
 'neutral': 1334.0,
 'positive': 6361.0,
 'unicode_name': 'HEAVY BLACK HEART',
 'unicode_block': 'Dingbats',
 'sentiment_score': 0.746}

Example 2

from emosent import get_emoji_sentiment_rank

# This function returns the emoji sentiment rank 
# mapped to the specified character.
get_emoji_sentiment_rank('😂')

Output:

{'unicode_codepoint': '0x1f602',
 'occurrences': 14622,
 'position': 0.805100583,
 'negative': 3614.0,
 'neutral': 4163.0,
 'positive': 6845.0,
 'unicode_name': 'FACE WITH TEARS OF JOY',
 'unicode_block': 'Emoticons',
 'sentiment_score': 0.221}

Example 3

from emosent import get_emoji_sentiment_rank_multiple

# Parses the input text character by character and 
# extracts emoji sentiment ranks and their respective positions in the text.
get_emoji_sentiment_rank_multiple('well done buddy! 😁👏')

Output:

# Here, the emojis are found at positions 17 and 18 in the specified text.
[{'text_position': 17,
  'emoji_sentiment_rank': {'unicode_codepoint': '0x1f601',
   'occurrences': 2189,
   'position': 0.796151187,
   'negative': 278.0,
   'neutral': 648.0,
   'positive': 1263.0,
   'unicode_name': 'GRINNING FACE WITH SMILING EYES',
   'unicode_block': 'Emoticons',
   'sentiment_score': 0.45}},
 {'text_position': 18,
  'emoji_sentiment_rank': {'unicode_codepoint': '0x1f44f',
   'occurrences': 2336,
   'position': 0.787130164,
   'negative': 243.0,
   'neutral': 634.0,
   'positive': 1459.0,
   'unicode_name': 'CLAPPING HANDS SIGN',
   'unicode_block': 'Miscellaneous Symbols and Pictographs',
   'sentiment_score': 0.521}}]

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE.txt file for more details.

Release files for emosent-py 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for emosent-py 0.1.7
File Size Uploaded
emosent-py-0.1.7.tar.gz 31.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for emosent-py 0.1.7
File Interpreter ABI Platform
emosent_py-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 61.9 kB

Release files / emosent-py-0.1.7.tar.gz

Download URL emosent-py-0.1.7.tar.gz
Size 31.9 kB
Tags Source
SHA-256 checksum
How to use checksums
dfaf0a84ddb396b9bc1f739005bff1ea8b125f610f811b9b54d86cf0f6486475
BLAKE2b-256 checksum
How to use checksums
1de413cd7faa3dc7ed0f97884e5fc9b237460c4a28babc58f09259e78ed11205
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / emosent_py-0.1.7-py3-none-any.whl

Download URL emosent_py-0.1.7-py3-none-any.whl
Size 30.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ebf7622e0b4c5edf084c2c3f2537b756574042784d906934b2ff3cfad3adea9b
BLAKE2b-256 checksum
How to use checksums
a68728534f58608892f540117ca7158512167598216d0b82963e790a98e8bd50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page