NRCLex
(C) 2019 Mark M. Bailey, PhD
About
NRCLex measures emotional affect from text. Affect dictionary contains approximately 27,000 words and is based on the National Research Council Canada (NRC) affect lexicon and NLTK WordNet synonym sets.
Lexicon source is (C) 2016 National Research Council Canada (NRC) and this package is for research purposes only. Source: http://saifmohammad.com/WebPages/NRC-Emotion-Lexicon.htm As per the terms of use of the NRC Emotion Lexicon, if you use the lexicon or any derivative from it, cite this paper: Crowdsourcing a Word-Emotion Association Lexicon, Saif Mohammad and Peter Turney, Computational Intelligence, 29 (3), 436-465, 2013.
NLTK data is (C) 2019, NLTK Project. Source: NLTK. Reference: Bird, Steven, Edward Loper and Ewan Klein (2009), Natural Language Processing with Python. O’Reilly Media Inc.
Installation
pip install NRCLex
Affects
Emotional affects measured include:
- fear
- anger
- anticipation
- trust
- surprise
- positive
- negative
- sadness
- disgust
- joy
Sample Usage
from nrclex import NRCLex
Instantiate NRCLex object. By default this loads the bundled lexicon packaged with the library:
text_object = NRCLex()
You can pass your raw text to this method (for best results, text should be unicode):
text_object.load_raw_text(text: str)
You can pass already tokenized text as a list of tokens. This usage does not require TextBlob tokenization:
text_object.load_token_list(list_of_tokens: list)
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
Metadata
Release files for NRCLex 4.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nrclex-4.1.0.tar.gz | 44.1 kB | Without provenance | Details for nrclex-4.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nrclex-4.1.0-py3-none-any.whl | Python 3 | none | any | Details for nrclex-4.1.0-py3-none-any.whl |
Total release size: 88.6 kB
Release files / nrclex-4.1.0.tar.gz
| Download URL | nrclex-4.1.0.tar.gz |
|---|---|
| Size | 44.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0fdf04b0b59bf48d8006ac3f96bfda9bfe55a2a31300326fe345ecd35b6ba4a2
|
|
BLAKE2b-256 checksum How to use checksums |
1ea67218aacd34b4f7b426df240d3d4d67bc35ae5ec9a25f58bf20b1bb871fb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Release files / nrclex-4.1.0-py3-none-any.whl
| Download URL | nrclex-4.1.0-py3-none-any.whl |
|---|---|
| Size | 44.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
61d68d09cd6cddf7f2c4ad12d2b5ea13d376a75bf38c7f96ff306e112e96a386
|
|
BLAKE2b-256 checksum How to use checksums |
2d15339ce55f38f9a4309a9db6600cdce878e1d45d5cc1d04e869fa720a8b2fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Security for NRCLex 4.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.