Python 可视化Twitter中指定话题中Tweet的词汇频率
CODE:
#!/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
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZ3VhZ3Vhc3Rk/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="">
Python 可视化Twitter中指定话题中Tweet的词汇频率的更多相关文章
- Python 对Twitter中指定话题的Tweet基本元素的频谱分析
CODE: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-9 @author: guaguastd @name: en ...
- Python 对Twitter中指定话题的被转载Tweet数量的频谱分析
CODE: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-10 @author: guaguastd @name: r ...
- Python 查找Twitter中特定话题中最流行的10个转发Tweet
CODE: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-4 @author: guaguastd @name: fi ...
- http 中指定head中Content-Encoding属性为gzip 转换过程中的一些问题
项目环境: 对接的服务放在微服务中 提供接口给应用层调用 ,微服务放需要 接受参数 并且转换成压缩格式给 第三方服务 本来以为需要自己压缩,httpclint 中已经封装好了GzipCompressi ...
- 提取json字符串中指定格式中的参数值
直接上代码: import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; p ...
- python glob 用通配符查找指定目录中的文件 - 开源中国社区
python glob 用通配符查找指定目录中的文件 - 开源中国社区 python glob 用通配符查找指定目录中的文件
- python 统计字符串中指定字符出现次数的方法
python 统计字符串中指定字符出现次数的方法: strs = "They look good and stick good!" count_set = ['look','goo ...
- python提取mysql中指定列参数,并循环打印
试验环境: Python 3.7.0 Mysql 5.0 实验目的: 使用python将数据库中指定的列中的数值取出来,并循环遍历,用以当成参数传递给需要它的方法. 本次实验取的是para列的数据 实 ...
- Ubuntu18.0 解决python虚拟环境中不同用户下或者python多版本环境中指定虚拟环境的使用问题
一. 不同用户下配置virtualenvwrapper的问题 问题描述: 安装virtualnev和virtualnevwrapper之后,在.bashrc进行virtualenvwrapper的相关 ...
随机推荐
- VS2015 +.NETMVC5 +EF实践
-- 当做笔记,以上图片按照顺序来的. 跟着 http://www.cnblogs.com/sanshi/ 一步步来的
- ci日志记录
log_message($level, $message) 参数: $level (string) -- Log level: 'error', 'debug' or 'info' $message ...
- 刷题总结——Collecting Bugs(poj2096)
题目: Description Ivan is fond of collecting. Unlike other people who collect post stamps, coins or ot ...
- MFC 对话框阴影效果
在 OnInitDialog(Cdialog)里面添加 SetClassLong(this->m_hWnd, GCL_STYLE, GetClassLong(this->m_hWnd, G ...
- 轮播图原生js实现和jquery实现和js面向对象方式实现
原生JS实现 html: <!DOCTYPE html> <html lang="en"> <head> <meta charset=&q ...
- 在react当中巧用扩展运算符
...props可以把没有写到的属性补充完整 ...style 可以把style 属性在styles当中展开
- 【10】【转】node 之 pipe机制----未理解
转载地址:http://blog.csdn.net/vieri_32/article/details/48376547 前言 前几天别人请教我关于pipe的问题,我发现我虽然用了nodejs很久,但是 ...
- Java语法糖(一)
概述 语法糖(Syntactic Sugar):主要作用是提高编码效率,减少编码出错的机会. 解语法糖发生在Java源码被编译成Class字节码的过程中,还原回简单的基础语法结构. 语法糖之一:泛型( ...
- FCKEDITOR配置说明
原文发布时间为:2009-10-12 -- 来源于本人的百度文章 [由搬家工具导入] fckeditor config.js配置2009-02-13 14:36 FCKConfig.CustomCon ...
- .net web api返回结果为json
web api写api接口时默认返回的是把你的对象序列化后以XML形式返回,那么怎样才能让其返回为json呢,下面为大家介绍几种不错的方法 web api写api接口时默认返回的是把你的对象序列化后以 ...