In [1]:
from nltk.twitter import Query, credsfromfile, TweetViewer
import sys
sys.path.append("../bhtsa")
import process_twt

# register a client, search 10 tweets
oauth = credsfromfile()
client = Query(**oauth)
twtNum = 10
client.register(TweetViewer(limit=twtNum))

In [2]:
# search some key words and print them out
# 'pokemongo' for example
tweets_gen = client.search_tweets(keywords='pokemongo', limit=twtNum, lang='en')
tweets = []
slangdict = process_twt.get_slang_dict()
for t in tweets_gen:
    print process_twt.preprocess(t['text'], slangdict=slangdict)


AT_USER no sticker but saw pidgey at the voting location lol! pokemongo northcapemay URL
rt AT_USER world history with pokemongo. share your photos of pokémon at historic places using the ar camera. URL
rt AT_USER i just named my fierce new vaporeon after our fierce new president. i'm calling it. pokemongo vote2016 URL
i wouldn't be so mad about niantic blocking fast maps if they including a fucking tracking feature in their game. pokemongo
nice animation!! pokemon pokemongo URL pikachu charizard
rt AT_USER love a good cookie stop. AT_USER turns up for pokemon! nom smallbiz shoplocal pikachu pokemongo URL
rt AT_USER i just named my fierce new vaporeon after our fierce new president. i'm calling it. pokemongo vote2016 URL
blue/red’s only trainers you could rematch were the elite for and the champion pokemongo pokemongouk
rt AT_USER i just named my fierce new vaporeon after our fierce new president. i'm calling it. pokemongo vote2016 URL
rt AT_USER world history with pokemongo. share your photos of pokémon at historic places using the ar camera. URL

In [ ]: