NRCLex

An affect generator based on TextBlob and the NRC affect lexicon. Note that lexicon license is for research purposes only.

https://github.com/DemetersSon83/NRCLex

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 5 committers (20.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.8%) to scientific vocabulary

Keywords

affect emotion lexicon natural-language-processing nltk nrc textblob-sentiment-analysis
Last synced: 9 months ago · JSON representation

Repository

An affect generator based on TextBlob and the NRC affect lexicon. Note that lexicon license is for research purposes only.

Basic Info
  • Host: GitHub
  • Owner: DemetersSon83
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 708 KB
Statistics
  • Stars: 73
  • Watchers: 3
  • Forks: 44
  • Open Issues: 5
  • Releases: 0
Topics
affect emotion lexicon natural-language-processing nltk nrc textblob-sentiment-analysis
Created over 6 years ago · Last pushed over 3 years ago
Metadata Files
Readme License

README.md

NRCLex

(C) 2019 Mark M. Bailey, PhD

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: 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.

Update

  • Finally got around to cleaning this up a bit. Updated PyPI package with current version. Thanks to all the contributors for cleaning up my terrible code!
  • Expanded NRC lexicon from approximately 10,000 words to 27,000 based on WordNet synonyms.
  • Minor bug fixes.
  • Contributor updated NTC library.

Installation

pip install NRCLex

Affects

Emotional affects measured include the following:

  • fear
  • anger
  • anticipation
  • trust
  • surprise
  • positive
  • negative
  • sadness
  • disgust
  • joy

Sample Usage

from nrclex import NRCLex

#Instantiate NRCLex object, you can pass your own dictionary filename in json format.

text_object = NRCLex(lexicon_file='nrc_en.json')

#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 your already tokenized text as a list of tokens, if you want to use an already tokenized input. This usage assumes that the text is correctly tokenized and does not make use of TextBlob.

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

Owner

  • Name: Mark Bailey
  • Login: DemetersSon83
  • Kind: user

Interested in complexity, agent-based modeling, AI safety, and topology. I have two dogs and way too many houseplants.

GitHub Events

Total
  • Watch event: 4
  • Fork event: 5
Last Year
  • Watch event: 4
  • Fork event: 5

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 22
  • Total Committers: 5
  • Avg Commits per committer: 4.4
  • Development Distribution Score (DDS): 0.182
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
metalcorebear 4****r 18
Riyadh 3****g 1
Giovanni c****4@g****m 1
Adriano Vega Llobell a****a@h****m 1
Mohamed Mostafa m****1@c****k 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 17
  • Total pull requests: 8
  • Average time to close issues: 8 months
  • Average time to close pull requests: 17 days
  • Total issue authors: 13
  • Total pull request authors: 6
  • Average comments per issue: 1.88
  • Average comments per pull request: 1.13
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 3.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • aeshna25 (2)
  • Yangyi-Zhang (1)
  • KavehKadkhoda (1)
  • el-grudge (1)
  • xiaoqingwan4 (1)
  • emdylee (1)
  • Taram1980 (1)
  • jeremychang9 (1)
  • Saif-NRC (1)
  • jokoro (1)
  • stormbeforesunsetbee (1)
  • treize-khushrenada (1)
Pull Request Authors
  • riyadhctg (2)
  • federicamontana (1)
  • Starkie (1)
  • mmsa (1)
  • stormbeforesunsetbee (1)
  • Jivanni (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

setup.py pypi
  • collections *
  • json *
  • textblob *