Twitter Sentiment Analysis - Natural Language Processing With Python and NLTK p.20

preview_player
Показать описание
Finally, the moment we've all been waiting for and building up to. A live test!

We've decided to employ this classifier to the live Twitter stream, using Twitter's API.

After this, we output the findings to a text file, which we intend to graph!

Рекомендации по теме
Комментарии
Автор

"Error Reason" : Process of conversion of string into JSON takes time which make twitter to automatically disconnect your app.
The error can be solve by using following "code snippet":

def tweet2json(data):
tweet_data=json.loads(data)
print(tweet_data["text"])

class listener(StreamListener):
def on_data(self, data):
try:
_thread.start_new_thread(tweet2json(data), data)
except :
print (" ")
return(True)

pratyushkhare
Автор

I'm getting a 401(unauthorized) with your code @6:40, even though i validated that all keys and secrets are correct . Do you ahve any idea what might cause this?

julians.
Автор

that "return true except: return true" was a real gamer moment!

apan
Автор

Truly Awesome tutorial man!! But what if we want more than 3 classes (pos, neg, neutral) like anger, happy, sad etc. Do you know any dataset or library of this type so that i can train it to make a more beautiful graph!!!

vasugupta
Автор

Hey thnks for your tutorials, i have tried all of them and got the positive results!!But i have tried dis above video, and i m getting this below error:

Traceback (most recent call last):
File "E:/ddd/streamtweets.py", line 5, in <module>
import sentiment_mod as s
ImportError: No module named sentiment_mod

So, can u plz tell me dat from where u have imported sentiment_mod file ??? I am waiting for ur positive reply though i want the solution ASAP bcz i am working on my research work and i want dis code..

shivaniraval
Автор

Hi guys, I've been following along the tutorials, Im developing an app to track the flu using twitter, I'm using sentiment analysis to ascertain whether a tweet containing the word flu is someone saying they have the flu or someone talking about the bird flu or flu shot etc. I created a training set and labelled each, all the algorithms used are returning between 70 and 90 % accuracy when running against the test data..I ran my own test on a list of tweet samples however, I'm getting very erratic behavior. one run will be 99% pos then next run on same data will be 99% neg any ideas?

daviddunne
Автор

Hi! I solved the error by wrapping the tweets in ascii, like this:
tweet = ascii(all_data["text"])
Maybe this will help.

cintiacamachobadillo
Автор

Twitter apps requires an application to be completed for getting their API services. Right now I have to show project to my Teacher, and there is a deadline, I have been waiting for atleast a week now, but still my application for the API service is pending. Can someone lend me their consumer key and access token for a few days, later you can regenerate them. Help would be appreciated. Thank You!

shubhamkokaneyt
Автор

Hi Harrison, where would I find training sets to train my algorithms adequately? In your examples, we were given the training sets to play with. We have taken the already categorize positive / negative data off movie review websites - how does one get access to the data to train the algorithms? Do you just use free api's for rotten tomato etc and download the reviews as well as their ratings and then classify them as positive / negative for training purposes?

simonchan
Автор

Hi Sentdex ... I am trying to use NLP for Twitter Sentiment Analysis. As you know my dataset would be from twitter but what Features I should select and What Algo should i use instead for better accuracy.

syedfurqanalishah
Автор

@sentdex I am getting this strange error. Somebody on stackexchange suggested that I should upgrade scikit-learn however didnt work...Any ideas??

AttributeError: 'LinearSVC' object has no attribute 'classes_'

dimitris_
Автор

For those who have diffuculty in pickling to featuresets:
save_word_features= open("/pickled_algos/featuresets.pickle", "wb")
pickle.dump(word_features, save_word_features)
save_word_features.close()

mk-ujvi
Автор

Hey is there a module called sentiment_mod you need to download? I can get it running up until this point but then when i add in the sentiment i get the following error
"import sentiment_mod as s
ImportError: No module named 'sentiment_mod'" I've looked for sentiment modules but cant find it. Any help would be great! love the videos!

mokeykenlon
Автор

Hii, Actually i was trying to execute the code but as an output instead of tweets I'm getting some random integer numbers not a single text, Even i also tried with different searches still getting the same .. Need help

jeffythomas
Автор

need help, even after adding "tweet = ascii(all_data["text"])" or putting the code into "try -except" block I.m still getting the
--> No active exception to reraise... How to fix it? Im running this script on Anaconda.

ankitjais
Автор

i am getting 401 error, i have already copy the c access, c token, and all that stuff but still getting error. Any suggestion ?

juanfelix
Автор

Hi it's great playlist for sentiment analysis !!!
But,
my program couldn't retrieve tweets!!
I am able to retrieve tweets if i remove this line --
sentiment_value, confidence = s.sentiment(tweet)

print(tweet)

can you help me please!! what should i've to do !!(looks like this program is unable to analysis the tweets Thanks..!

kashyapraval
Автор

I am trying to run the code in which everything is pickle dumped on linux but getting a memory error Mln classifier . please help

nitinveer
Автор

Hi, I have a doubt. I'm getting either (neg, 0) or (neg, 1). Can you please tell me why is this happening?

akshitabansal
Автор

Thanks for the series... I just started NLP... After this series any recommendations on the way forward?

Viz_With_Akeelah
join shbcf.ru