Giter Site home page Giter Site logo

Error message.. about vadersentiment HOT 5 CLOSED

cjhutto avatar cjhutto commented on July 2, 2024
Error message..

from vadersentiment.

Comments (5)

guitarfrk75 avatar guitarfrk75 commented on July 2, 2024 2

I have the same issue. It appears to be driven by the change from Python 2 to 3. To correct the issue, change this part of line 23 from:
lambda (w, m): (w, float(m)
to:
lambda wm: (wm[0], float(wm[1])

You also have to add parentheses around the print statements on lines 358 to 363 and I had to commend out reload(sys) on line 20.

It now appears to be working, but watch the tutorial code for other differences between 2 and 3.

from vadersentiment.

sungmoonc avatar sungmoonc commented on July 2, 2024

It seems like Python 3.5 new grammar issue. http://stackoverflow.com/questions/15712210/python-3-2-lambda-syntax-error How do I fix that?

from vadersentiment.

sungmoonc avatar sungmoonc commented on July 2, 2024

This is awesome. Thanks a lot!

On Jan 24, 2016, at 4:03 PM, guitarfrk75 [email protected] wrote:

I have the same issue. It appears to be driven by the change from Python 2 to 3. To correct the issue, change this part of line 23 from:
lambda (w, m): (w, float(m)
to:
lambda wm: (wm[0], float(wm[1])

You also have to add parentheses around the print statements on lines 358 to 363 and I had to commend out reload(sys) on line 20.

It now appears to be working, but watch the tutorial code for other differences between 2 and 3.


Reply to this email directly or view it on GitHub #5 (comment).

from vadersentiment.

cjhutto avatar cjhutto commented on July 2, 2024

thanks @sungmoonc and @guitarfrk75 - appreciate the effort!

from vadersentiment.

 avatar commented on July 2, 2024

@guitarfrk75 I did what you said, but got a new error:

UnicodeDecodeError                        Traceback (most recent call last)
 <ipython-input-34-6f8e4787c376> in <module>()
 ----> 1 from vaderSentiment.vaderSentiment import sentiment as vaderSentiment

 /Users/yobichi/mc2/lib/python3.5/site-packages/vaderSentiment/vaderSentiment.py in <module>()
      28 except:
      29     f = os.path.join(os.path.dirname(__file__),'vader_sentiment_lexicon.txt')
 ---> 30     word_valence_dict = make_lex_dict(f)
      31 
      32 # for removing punctuation

 /Users/yobichi/mc2/lib/python3.5/site-packages/vaderSentiment/vaderSentiment.py in make_lex_dict(f)
      21 
      22 def make_lex_dict(f):
 ---> 23     return dict(map(lambda wm: (wm[0], float(wm[1])), [wmsr.strip().split('\t')[0:2] for wmsr in open(f) ]))
      24 
      25 f = 'vader_sentiment_lexicon.txt' # empirically derived valence ratings for words, emoticons, slang, swear words, acronyms/initialisms

 /Users/yobichi/mc2/lib/python3.5/site-packages/vaderSentiment/vaderSentiment.py in <listcomp>(.0)
      21 
      22 def make_lex_dict(f):
 ---> 23     return dict(map(lambda wm: (wm[0], float(wm[1])), [wmsr.strip().split('\t')[0:2] for wmsr in open(f) ]))
      24 
      25 f = 'vader_sentiment_lexicon.txt' # empirically derived valence ratings for words, emoticons, slang, swear words, acronyms/initialisms

 /Users/yobichi/mc2/bin/../lib/python3.5/encodings/ascii.py in decode(self, input, final)
      24 class IncrementalDecoder(codecs.IncrementalDecoder):
      25     def decode(self, input, final=False):
 ---> 26         return codecs.ascii_decode(input, self.errors)[0]
      27 
      28 class StreamWriter(Codec,codecs.StreamWriter):

 UnicodeDecodeError: 'ascii' codec can't decode byte 0xde in position 6573: ordinal not in range(128)

Do you have any idea? Thanks!

from vadersentiment.

Related Issues (20)

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.