i have small python program to extract tweets from twitter stream for keywords.
want to link the keyword with received tweets.how can i do that in python efficiently.
I may have more than 200 keys.
eg:
keywords = "key1,key2,key3"
received 4 tweets and i want to directly link incoming text and key..
like below
1)tweets msgs key1 tweets tweets text --> key1
2)tweets msgs key2 tweets tweets text --> key2
3)tweets msgs key3 tweets tweets text --> key3
4)tweets msgs key1 tweets tweets text --> key1
Update:
Currently am using for loop to iterate the key list and use find to see if the key is present in the tweet text.But i feel there should be better and efficient way of doing this in python.
for title in title_list:
if tweet_lower.find(title) != -1:
setattr(status, 'title',title)
break