Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Commit

Permalink
extract English tweets
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-wittmer committed Apr 7, 2016
1 parent 2a05738 commit 8a60d52
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions script.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import json

# Open the data and read each JSON object into a list
data_file = open('sample_data.json', 'r')
data_file = open('collection_brands.11.json', 'r')
tweets = data_file.readlines()
data_file.close()

# Load each JSON object and print the tweetId
# Load each JSON object and add English tweets to new list
english_tweets = []
for line in tweets:
values = json.loads(line)
print values["tweetId"]
if values['tweetOwner']['language'] == 'en':
english_tweets.append(values)

# Print the number of English tweets retrieved
print len(english_tweets)

0 comments on commit 8a60d52

Please sign in to comment.