Skip to content Skip to sidebar Skip to footer

Tweepy Tracking Multiple Terms

I am doing content analysis on tweets. I'm using tweepy to return tweets that match certain terms and then writing N amount of tweets to a CSv file for analysis. Creating the files

Solution 1:

You could check the tweet text against your matching terms. Something like:

>>> a = "hello this is a tweet"
>>> terms = [ "this "]
>>> matches = []
>>> for i, term in enumerate( terms ):
...     if( term in a ):
...             matches.append( i )
... 
>>> matches
[0]
>>> 

Which would give you all of the terms that that specific tweet, a, matched. Which in this case was just the "this" term.


Post a Comment for "Tweepy Tracking Multiple Terms"