Comments (5)
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.
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.
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.
thanks @sungmoonc and @guitarfrk75 - appreciate the effort!
from vadersentiment.
@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)
- Dictionary contains phrases like "fed up" that will never hit because of how the sentence is tokenized HOT 1
- Is NLP still required when using VADER?
- vaderSentiment data output in a different order than specified in the docs
- Wrong weight assigned for hashtags with capitals
- Doubt about threshold values used in VADER categorization
- is this thing still alive?
- incorrect result while running on large dataset HOT 2
- Demo None Type not Iterable HOT 2
- Adding Turkish words HOT 2
- help with adding values to vader_lexicon.txt HOT 1
- Download additional DATASETS AND TESTING RESOURCES mentioned in README HOT 3
- Total dataset is decreasing after processed by VADER
- VADER can't parse the word 'bad ass'? HOT 2
- Positive score always 0? HOT 2
- `SPECIAL_CASES` do not work HOT 3
- Support for new Emojis
- list index out of range error persists... HOT 2
- Supporting Aspect Based sentiment analysis
- Add Julia Fork Link To ReadMe
- the sentimentIntensityAnalyzer VADER is giving results only on emojicon logic and NOT text HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vadersentiment.