Comments (5)
try adding this to your list of imports to make it backward compatible for Python 2.7:
from io import open
from vadersentiment.
I am facing this issue as well.
from io import open
This gets rid of the message
with open(lexicon_full_filepath, encoding='utf-8') as f:
But then now the error is showing for
File "/usr/local/lib/python2.7/dist-packages/vaderSentiment/vaderSentiment.py", line 212, in init
lexicon_full_filepath = os.path.join(os.path.dirname(this_module_file_path), lexicon_file)
TypeError: 'encoding' is an invalid keyword argument for this function
from vadersentiment.
Thank you for your quick response. Did that. Worked like a charm.
from vadersentiment.
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
from io import open
analyzer = SentimentIntensityAnalyzer()
ERROR:
TypeErrorTraceback (most recent call last)
<ipython-input-8-c96d329cbe73> in <module>()
1 from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
2 from io import open
----> 3 analyzer = SentimentIntensityAnalyzer()
/home/kap/anaconda3/envs/py36/lib/python2.7/site-packages/vaderSentiment/vaderSentiment.pyc in
__init__(self, lexicon_file, emoji_lexicon)
210 _this_module_file_path_ = os.path.abspath(getsourcefile(lambda: 0))
211 lexicon_full_filepath = os.path.join(os.path.dirname(_this_module_file_path_), lexicon_file)
--> 212 with open(lexicon_full_filepath, encoding='utf-8') as f:
213 self.lexicon_full_filepath = f.read()
214 self.lexicon = self.make_lex_dict()
TypeError: 'encoding' is an invalid keyword argument for this function
I tried running the 3 line code inside a Jupyter notebook with python 3.6 and outside of jupyter in a terminal within python 2.7 and produced the same error. I used Ubuntu OS. Maybe put 'from io import open' in the vaderSentiment.py file? I would need instructions to produce complied bytecode to overwrite the existing one..... I've never done that before. Any suggestions or solutions?
from vadersentiment.
sudo nano /home/kap/anaconda3/envs/py36/lib/python2.7/site-packages/vaderSentiment/vaderSentiment.py
put from io import open in this file not on yours
from vadersentiment.
Related Issues (20)
- 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
- Compound score diverges for long sequences
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.