def trainTwitter(username): global model yield ("Training on twitter for @{}".format(username)) t = Twitter() model = NGram(t.getTweets(username), 2) yield "Trained"