Git Product home page Git Product logo

nrclex's People

Contributors

jivanni avatar metalcorebear avatar riyadhctg avatar starkie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nrclex's Issues

Explanation

Hey, thanks for the library! Though would like to understand the output better. For some sentences, the emotion score is constant, though the sentence doesn't have that variety of emotion.

Found anomaly in the package output

Hey, I am using the NRCLEX package, from PyPi and noticed that instead of 10 the package is returning 11 emotions.
Here it's taking anticip as well as anticipation. And anticip is an empty dictionary key. Attaching a screenshot of the output for your reference.
image

Importation Fail: FileNotFoundError: [Errno 2] No such file or directory: 'lexicon.pkl'

Hello, I installed NCLex through pip on Anaconda. However, an error occurred when I try to import it:

FileNotFoundError Traceback (most recent call last)
in
----> 1 from nrclex import NRCLex

C:\ProgramData\Anaconda3\envs\keyword2\lib\site-packages\nrclex.py in
28 self.affect_frequencies = dict(affect_frequencies)
29
---> 30 class NRCLex:
31
32 """Lexicon source is (C) 2016 National Research Council Canada (NRC) and library is for research purposes only. Source: http://sentiment.nrc.ca/lexicons-for-research/"""

C:\ProgramData\Anaconda3\envs\keyword2\lib\site-packages\nrclex.py in NRCLex()
33
34 #lexicon = {'fawn': ['negative'], 'pardon': ['positive'], 'cussed': ['anger']}
---> 35 with open('lexicon.pkl', 'r') as pkl_file:
36 lexicon = pickle.load(pkl_file)
37

FileNotFoundError: [Errno 2] No such file or directory: 'lexicon.pkl'

There were also "UnicodeDecodeError: 'cp950' codec can't decode byte 0xe2 in position" happened multiple times during the installation. I'm not sure where I did wrong. Maybe this is the reason why the error occurred.

Eventually, I downloaded NRCLex locally, and it works well.
Hope that everything is fine, cheers.

anticip or anticipation

Hi,
What a great package, thank you.

What do you think about the following outcome:

input code:
text = 'In three years, everyone will be happy.'
emotion = NRCLex(text)
result = emotion.affect_frequencies
result
output:
{'fear': 0.0,
'anger': 0.0,
'anticip': 0.0,
'trust': 0.25,
'surprise': 0.0,
'positive': 0.25,
'negative': 0.0,
'sadness': 0.0,
'disgust': 0.0,
'joy': 0.25,
'anticipation': 0.25}

There is 2 items that are anticip and anticipation, clearly one of them is extra but in the following example we have just one of them:

input code:
text = 'Marie is a published author.'
emotion = NRCLex(text)
result = emotion.affect_frequencies
result
output:
{'fear': 0.0,
'anger': 0.0,
'anticip': 0.0,
'trust': 0.5,
'surprise': 0.0,
'positive': 0.5,
'negative': 0.0,
'sadness': 0.0,
'disgust': 0.0,
'joy': 0.0}

Thank you for your time.

Where can I get Indonesian lexicon?

Hi! I appreciate your work, but I been struggling on finding the Indonesian lexicon like the one provided in the original website.

I want to use this library for my research. Thank you

Citation to NRC Emotion Lexicon and Broken URL to the lexicon

Dear Mark,

My name is Saif Mohammad, one of the creators of the NRC Emotion Lexicon: http://saifmohammad.com

It was great to see the tool you have built using the NRC Emotion Lexicon. Can you please add to the About page how people can cite the lexicon:

"Crowdsourcing a Word-Emotion Association Lexicon, Saif Mohammad and Peter Turney, Computational Intelligence, 29 (3), 436-465, 2013."

Citing it gives us credit for the work and the terms of use of the lexicon require that the paper be cited if the lexicon is used: http://saifmohammad.com/WebPages/NRC-Emotion-Lexicon.htm
(scroll to the bottom)

Also, I noticed that the url you have for the lexicon points to a now defunct page. Please use this url if you intend to point to the NRC Emotion lexicon: http://saifmohammad.com/WebPages/NRC-Emotion-Lexicon.htm

Or this url if you intend to point to the many emotion lexicons developed at NRC: http://saifmohammad.com/WebPages/lexicons.html

If you would like to chat with me or I can clarify anything, please do not hesitate to reach out. You can reach me at [email protected]. I am always keen to learn how people use the lexicon.

Thank you and best wishes. 
-Saif

affect_frequencies returned with ambiguous keys

testing string: "give me money when in need"

when returning an NRCLex text object with .affect_frequencies::

{'fear': 0.0,
'anger': 0.16666666666666666,
'anticip': 0.0,
'trust': 0.16666666666666666,
'surprise': 0.16666666666666666,
'positive': 0.16666666666666666,
'negative': 0.0,
'sadness': 0.0,
'disgust': 0.0,
'joy': 0.16666666666666666,
'anticipation': 0.16666666666666666}

^ both 'anticip' and 'anticipation' were returned. I saw a recent change in the repo here would likely fix the problem. May I know when the next release date will be?

Inconsistent behavior with the anticipation behavior

Hi,

When using NRCLex, sometimes the affect frequencies shows the anticipation emotion (not anticip), but not every time.

Here is an example:

In: NRCLex("another day, another opportunity").affect_frequencies
Out: {'fear': 0.0, 'anger': 0.0, 'anticip': 0.0, 'trust': 0.0, 'surprise': 0.0, 'positive': 0.5, 'negative': 0.0, 'sadness': 0.0, 'disgust': 0.0, 'joy': 0.0, 'anticipation': 0.5}

In: NRCLex("another day").affect_frequencies
Out: {'fear': 0.0, 'anger': 0.0, 'anticip': 0.0, 'trust': 0.0, 'surprise': 0.0, 'positive': 0.0, 'negative': 0.0, 'sadness': 0.0, 'disgust': 0.0, 'joy': 0.0}

Any explanation for why this might be? Is there a way to get the same returns every time?

Capitalization Affecting Outcome

Hi,

Thank you for the project. I saw different outputs when alternating the capitalization of input, for example:

text = "I love to visit historical places"
emotion = NRCLex(text)
print(emotion.top_emotions)

yields [('positive', 0.6666666666666666)], with raw emotion score {'joy': 1, 'positive': 2}.

while if I change text to "I Love to visit historical places", the top_emotions becomes [('positive', 1.0)].

How do we explain this? I understand this might not be an issue, but I am curious as a beginner in NLP.

nrc_en.json missing affect words

Thank you for building this repository! In the description, you stated that "Affect dictionary contains approximately 27,000 words." But there are less than 10,000 words in nrc_en.json. Could you update the file to include more words?

installation

Hi please how do I install it in my terminal? I've checked online and didn't get any help.
Thanks.

affect_frequencies 'anticip' instead of 'anticipation'

affect_frequencies has 'anticip' key with value that is always zero because only 'anticipation' is used in lexicon. Suggesting changing 'anticip' to 'anticipation' in the affect_percent variable in the build_word_affect() function in nrclex.py.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.