Created
April 19, 2014 21:28
-
-
Save doeg/11098045 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
class Tweet: | |
def __init__(self, attributes): | |
self.attributes = attributes | |
self.id = attributes['id'] | |
self.raw_text = attributes['text'] | |
self.just_text = self.just_text() | |
self.is_mention = self.is_mention() | |
self.author = attributes['user']['screen_name'] | |
def just_text(self): | |
return re.sub(r'^(@\w+\s)+', '', self.raw_text) | |
def is_mention(self): | |
return not not self.attributes['entities']['user_mentions'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment