An affect generator based on TextBlob and the NRC affect lexicon. Note that lexicon license is for research purposes only.
Project description
NRCLex
(C) 2019 Mark M. Bailey
About
NRCLex will measure emotional affect from a body of text. Affect dictionary contains approximately 27,000 words, and is based on the National Research Council Canada (NRC) affect lexicon (see link below) and the NLTK library's WordNet synonym sets.
Lexicon source is (C) 2016 National Research Council Canada (NRC) and this package is for research purposes only. Source: [lexicons for research] (http://sentiment.nrc.ca/lexicons-for-research/)
NLTK data is (C) 2019, NLTK Project. Source: [NLTK] (https://www.nltk.org/). Reference: Bird, Steven, Edward Loper and Ewan Klein (2009), Natural Language Processing with Python. O’Reilly Media Inc.
Update
- Expanded NRC lexicon from approximately 10,000 words to 27,000 based on WordNet synonyms.
- Minor bug fixes.
Affects
Emotional affects measured include the following:
- fear
- anger
- anticipation
- trust
- surprise
- positive
- negative
- sadness
- disgust
- joy
Sample Usage
from nrclex import NRCLex
#Instantiate text object (for best results, 'text' should be unicode).
text_object = NRCLex('text')
#Return words list.
text_object.words
#Return sentences list.
text_object.sentences
#Return affect list.
text_object.affect_list
#Return affect dictionary.
text_object.affect_dict
#Return raw emotional counts.
text_object.raw_emotion_scores
#Return highest emotions.
text_object.top_emotions
#Return affect frequencies.
text_object.affect_frequencies
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file NRCLex-2.0.1.tar.gz.
File metadata
- Download URL: NRCLex-2.0.1.tar.gz
- Upload date:
- Size: 572.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/2.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fd1427dba85854b54408985b3cf96d1d5bee5c4f3084ab23f69966010ede657
|
|
| MD5 |
3ad0952518d5ecd381866e0cd47ebc9a
|
|
| BLAKE2b-256 |
3f21c83934a2eec611fb1cea39ac72c6053162949ca0891231562b4568d27250
|
File details
Details for the file NRCLex-2.0.1-py2-none-any.whl.
File metadata
- Download URL: NRCLex-2.0.1-py2-none-any.whl
- Upload date:
- Size: 230.7 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/2.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9238cf6f8dbd04b27190fe1c9193ac05184906335beca487b73e6ce29891e59a
|
|
| MD5 |
b2d9250ab4ff488aecb2c2812b1c940f
|
|
| BLAKE2b-256 |
bb9202d8898d015b95bc09c0d3c4e005e08bcb04f859c5067498f62d3eeb174e
|