Skip to content

Instantly share code, notes, and snippets.

@doeg
Created April 19, 2014 21:28
Show Gist options
  • Save doeg/11098045 to your computer and use it in GitHub Desktop.
Save doeg/11098045 to your computer and use it in GitHub Desktop.
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