Example #1
0
def calculate_all_tweets(input_file):
    sanitizer = TweetSanitizer()
    graph = TweetGraphDegree()
    with open(input_file) as tweets_in:
        for line in tweets_in:
            tweet = sanitizer.sanitize_tweet(line)
            graph.add_tweet(tweet)
            degree = graph.average_degree()
            write_line('{:0.2f}'.format(degree))
def sanitize_all_tweets(input_file):
    sanitizer = TweetSanitizer()
    with open(input_file) as tweets_in:
        for line in tweets_in:
            tweet = sanitizer.sanitize_tweet(line)
            write_line(str(tweet))

        write_line('')
        num_unicode = sanitizer.num_tweets_with_unicode()
        write_line('{0} tweets contained unicode.'.format(num_unicode))
 def setUp(self):
     self.sanitizer = TweetSanitizer()