Example #1
0
def get_hash_mentions(tweets, count=3):
    """ returns stats about hashtags and mentions from tweets
        tweets: a list of strings
    """
    hashtags = strings_startswith(tweets, '#')
    mentions = strings_startswith(tweets, '@')
    freq_hashtags =  sort_dct(histogram(hashtags))
    freq_mentions =  sort_dct(histogram(mentions))
    return freq_hashtags[:count], freq_mentions[:count]
Example #2
0
def get_stats(tweets, scr_name, count=2):
    """ returns stats about hashtags and user mentions 
        tweets: a dict of tweet dicts from rest api
    """
    hashtags = get_hashtags(tweets)
    mentions = get_mentions(tweets)
    
    freq_hashtags =  sort_dct(histogram(hashtags))
    freq_mentions =  sort_dct(histogram(mentions))
    freq_mentions = remove_self(freq_mentions, scr_name)
    return freq_hashtags[:count], freq_mentions[:count]