def __init__(self, model, twitter_status): # Decode the twitter_status tm0 = time.strptime(twitter_status.created_at[:-6], '%a, %d %b %Y %H:%M:%S') self._time = time.mktime(tm0) self._user = twitter_status._user.screen_name self._message = filters.clean_text(twitter_status.text.encode('ascii', 'replace')) self._id = twitter_status._id # Score the decoded status if model: positive, self._score = model.classify(self._message) else: positive, self._score = False, 0.0 self._replyable = positive and filters.is_allowed_for_replying(self._message)
def __init__(self, model, twitter_status): # Decode the twitter_status tm0 = time.strptime(twitter_status.created_at[:-6], '%a, %d %b %Y %H:%M:%S') self._time = time.mktime(tm0) self._user = twitter_status._user.screen_name self._message = filters.clean_text( twitter_status.text.encode('ascii', 'replace')) self._id = twitter_status._id # Score the decoded status if model: positive, self._score = model.classify(self._message) else: positive, self._score = False, 0.0 self._replyable = positive and filters.is_allowed_for_replying( self._message)
def is_relevant(twitter_status): """We are looking for tweets that contain 'papercut'""" message = filters.clean_text(twitter_status.text.encode( 'ascii', 'replace')) return filters.is_papercut(message)
def is_relevant(twitter_status): """We are looking for tweets that contain 'papercut'""" message = filters.clean_text(twitter_status.text.encode('ascii', 'replace')) return filters.is_papercut(message)