I am trying to gather dataset from Twitter accounts who posted a status update in the form of a statement of diagnosis, such as “I was diagnosed with X today”, where X would represent either depression.
I was being able to use TwitterSearch library but it only searches for the keyword not a full sentence.
from TwitterSearch import *
try:
tso = TwitterSearchOrder() # create a TwitterSearchOrder object
tso.set_keywords(['depression', 'diagnosed']) # let's define all words we would like to have a look for
tso.set_language('en') # we want to see English tweets only
tso.set_include_entities(False) # and don't give us all those entity information
ts = TwitterSearch(
consumer_key = 'x',
consumer_secret = 'y',
access_token = 'z',
access_token_secret = 't'
)
print( tweet['user']['screen_name'], tweet['text'] )
However I would like to use regular expression to get tweets that match the sentence.