1

I have used vader library for labeling of amazon's reviews but it doesn't handle these types of reviews "No problems with it and does job well. Using it for Apple TV and works great. I would buy again no problem". This is positive sentence but the code label it as negative. How can I handle these types of reviews.

import nltk
nltk.download('vader_lexicon')
nltk.download('punkt')
from nltk.sentiment.vader import SentimentIntensityAnalyzer
sid = SentimentIntensityAnalyzer()
output['sentiment'] = output['review_body'].apply(lambda x: sid.polarity_scores(x))
def convert(x):
 if x < 0:
     return "negative"
 elif x > .2:
     return "positive"
 else:
     return "neutral"
output['result'] = output['sentiment'].apply(lambda x:convert(x['compound']))

Here is the sample file:

0 No problems with it and does job well. Using it for Apple TV and works great. I would buy 
again no problem
1 I don't know what happened with other buyers, but I received it today from Yakodo in a good 
  bubble envelope and the product is not a counterfeit: it's a genuine Apple product. It comes 
  into a little box with two information booklets. The adapter is genuine, I'm completely sure 
  because looks and feels the same compared with one from an Apple reseller. The latest iOS 
  (7.1.2) has no issues with it (no warnings) using it with an iPhone 5S and an iPad mini 
  Retina... No issues because it is genuine. Don't hesitate: it's a great deal for a fraction 
  of its price.
2 Keeps me smiling when listening to the music.
3 DOES THE JOB. HAPPY.
4 Don't like it

0 Answers0