Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. def get_non_empty_lines(filename):
  2.     with open(filename) as fp:
  3.         for line in fp:
  4.             stripped_line = line.strip()
  5.             if stripped_line:
  6.                 yield stripped_line
  7.                
  8. for line in get_non_empty_lines('tweets.json'):
  9.     tweet = json.loads(line)
  10.     tokens = preprocess(tweet['text'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement