开发者

How to grab streaming data from twitter using nltk - regular expression

I am newbie in Python and given a task from my boss to do this :

  1. Grab streaming data from twitter in JSON
  2. Parsing using NLTK and Regular Expression
  3. Save it to file base or database file, ok

Is there anyone know how to grab a streaming data from twitte开发者_开发问答r using the step above ?

Your help would be very grateful :)


A quick Google search yields Tweepy, which is a python library for accessing the Twitter API. This should get you started. In terms of parsing the data, you'll need to be a little more specific as to what you want to parse.


This should point you in the right direction

import urllib2, simplejson

json = urllib2.urlopen('http://search.twitter.com/search.json?q=from%3Aalexiskold').read()
tweets = simplejson.loads(json)["results"]
for tweet in tweets: print tweet["text"]

it wouldn't eval so i used simplejson http://simplejson.github.com/simplejson/


You posted the same question twice, appearently: I answered in the other post. How to grab streaming data from twitter connect with pycurl using nltk - regular expression

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜