Python 可视化Twitter中指定话题中Tweet的词汇频率
2017-05-05 09:53
399 查看
CODE:
RESULT:
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-8 @author: guaguastd @name: plot_frequencies_words.py ''' if __name__ == '__main__': #import json # import Counter from collections import Counter # import search from search import search_for_tweet # import visualize from visualize import visualize_for_frequencies # import login, see http://blog.csdn.net/guaguastd/article/details/31706155 from login import twitter_login # get the twitter access api twitter_api = twitter_login() # import tweet from tweet import extract_tweet_entities while 1: query = raw_input('\nInput the query (eg. #MentionSomeoneImportantForYou, exit to quit): ') if query == 'exit': print 'Successfully exit!' break statuses = search_for_tweet(twitter_api, query) status_texts,screen_names,hashtags,words = extract_tweet_entities(statuses) word_counts = sorted(Counter(words).values(), reverse=True) visualize_for_frequencies(word_counts, "Word Rank", "Freq")
RESULT:
Input the query (eg. #MentionSomeoneImportantForYou, exit to quit): #MentionSomeoneImportantForYou Length of statuses 100 Length of statuses 196
相关文章推荐
- Python 可视化Twitter中指定话题中Tweet的词汇频率
- Python 对Twitter中指定话题的Tweet基本元素的频谱分析
- Python 对Twitter中指定话题的Tweet基本元素的频谱分析
- Python 对Twitter中指定话题的被转载Tweet数量的频谱分析
- Python 对Twitter中指定话题的被转载Tweet数量的频谱分析
- Python 对Twitter tweet的元素 (Word, Screen Name, Hash Tag)的词汇多样性分析
- Python 提取Twitter特定话题中转载tweet的用户
- Python 对Twitter tweet的元素 (Word, Screen Name, Hash Tag)的词汇多样性分析
- Python 查找Twitter中特定话题中最流行的10个转发Tweet
- Python 查找Twitter中特定话题中最流行(转载最多)的10个Tweet
- Python 对Twitter tweet的元素 (Word, Screen Name, Hash Tag)的频率分析
- python 实现文章中词汇的频率统计并进行显示(针对英文文章)
- word frequency counter python 页面词汇频率小代码
- 使用Python收集指定twitter用户的followers复现
- Python 提取Twitter用户的Tweet
- Python 获取Twitter话题 (API)
- python爬虫爬取指定用户微博图片及内容,并进行微博分类及使用习惯分析,生成可视化图表
- 【转】Python数据可视化利器Matplotlib,colors系列,颜色的指定形式
- python.递归遍历指定的目录
- 保存指定文件夹下的目录和文件名到文件中 Python 脚本