Skip to main content

EmotionExtractor

Extract emotion words from sentence or list of tokens.

Installation

pip install EmotionExtractor

Usage

from emotionextractor.emotionextractor import EmotionExtractor

ee = EmotionExtractor()

sentence = "I am happy to see you succeed"
tokens = ["I", "am", "happy", "to", "see", "you", "succeed"]

ee.extract_emotion(sentence)
#or 
ee.extract_emotion(tokens)

#output
# ['happy', 'succeed']

extract_emotion(...) can take several other optional parameters in addition to input sentence/word tokens:

:param bool lemmatize: Set to True to enable lemmatization. default is False
:param bool clean_stopwords: Set to False to disable stop words removal. default is True
:param bool strict_mode: Set to True to enable strict choice of emotion words based on adj and adv. default is True
:param bool remove_pos: Set to True if you'd like to only allow certain Parts of speech (POS). default s false
:param list allowed_pos: List of POS you want to allow from nltk TAGSET: https://github.com/nltk/nltk/blob/develop/nltk/app/chunkparser_app.py
a more readable list from third party: https://www.guru99.com/pos-tagging-chunking-nltk.html When it is not set, and remove_pos is set to True, then by default this POS whitelist is used: ["RB", "RBS", "RBR", "JJ", "JJR", "JJS"]
:param str filter: It can be set to either 'N' or 'P'. default is None.

Troubleshooting

If you recieve error regarding nltk version not found try:

pip install --upgrade nltk

Additional Note

More info will be shared soon about the lexicon used

Release files for EmotionExtractor 0.0.3

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

Source distribution (sdist)

Source distribution for EmotionExtractor 0.0.3
File Size Uploaded
EmotionExtractor-0.0.3.tar.gz 84.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for EmotionExtractor 0.0.3
File Interpreter ABI Platform
EmotionExtractor-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 168.2 kB

Release files / EmotionExtractor-0.0.3.tar.gz

Download URL EmotionExtractor-0.0.3.tar.gz
Size 84.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b5ddc9f06ceeed7c77716799b965c632de2be892da5edcf18b74573f4b693594
BLAKE2b-256 checksum
How to use checksums
7db1d861f98480f04ec1f0867ea69cf8c5371ac8f38ddb2fe66f84164e43591a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / EmotionExtractor-0.0.3-py3-none-any.whl

Download URL EmotionExtractor-0.0.3-py3-none-any.whl
Size 83.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e2d395b85f0eb87bba2d56472a657e136a033556239e28b77798662848d4311
BLAKE2b-256 checksum
How to use checksums
50eaef40d6ff373fc4e9cbf71668bfd851cad67c5ea0e7c3e0d53533b912edb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

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