def cb_search(self, status, filter_language): author = status.author.screen_name text = status.text author = author.encode("utf-8") text = text.encode("utf-8") lang = language.get_language(text) if lang[1] == filter_language: print "%s: %s" % (author.rjust(21), text) return True
def cb_search(self, status): tweet_id = status.id_str author = status.author.screen_name text = status.text author = author.encode("utf-8") text = text.encode("utf-8") lang = language.get_language(text) if lang[1] == self.language: self._output.writerow([0, tweet_id, author, text]) self.counter += 1 if self.counter < self.count: return True return False
def cb_search(self, status, filter_language): author = status.author.screen_name text = status.text author = author.encode("utf-8") text = text.encode("utf-8") lang = language.get_language(text) if lang[1] == filter_language: tweet = Tweet(status.id_str, author, text) sentiment = self.model.predict(tweet) if len(author) > 10: author = "%s..." % author[:7] sentiment = ("[%s] " % TEXT_LABELS[sentiment]).rjust(11) print "%s %s: %s" % (sentiment, author.rjust(10), text) return True