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的相关 ...
随机推荐
- LINUX系统安装MYSQL命令
1.下载安装包 wget http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz 2. ...
- Pointcut is not well-formed: expecting 'identifier' at character position 0 ^ || Pointcut is not well-formed: expecting ')' at character position 11 ^
错误提示: 解决方法1:指定execution 在执行目标方法之前指定execution 解决方法2:可能是execution写错了.请仔细检查. 其他——execution参数设置(带问好的可以不配 ...
- WebGIS的开发方式
(转)摘抄自<基于WebGIS的校友资源管理系统的设计与实现>_陈刚
- Repeater嵌套(灵活的)
页面代码 <form id="form1" runat="server"> <asp:Repeater ID="rptCategor ...
- Idea下maven的配置和使用
maven的主要功能就是依赖管理,jar包仓库.和C#中的NuGet仓库差不多.另外也提供打包构建,启动插件等功能.下面主要讲一下,在使用Idea开发时,maven的配置和使用. maven的安装和配 ...
- 封装一个类似jquery的ajax方法
//封装一个类似jquery的ajax方法,当传入参数,就可以发送ajax请求 //参数格式如下{ // type:"get"/"post", // dataT ...
- ofbiz数据库表结构设计(3)- 订单ORDER
对于订单来说,主要的表就是ORDER_HEADER和ORDER_ITEM.ORDER_HEADER就是所谓的订单头,一条记录代表一条订单. ORDER_PAYMENT_PREFERENCE是订单的支付 ...
- HDU 4779:Tower Defense
Tower Defense Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others)T ...
- SPOJ QTREE Query on a tree VI
You are given a tree (an acyclic undirected connected graph) with n nodes. The tree nodes are number ...
- 【BZOJ4481&JSOI2015】非诚勿扰(数学期望)
听说JSOI有版权问题就不放图了 如果前面的文章里的图需要删掉请通知我 题意:有一些女的要挑一些男的,挑中的几率均为p.一个男的可以无限次被挑中.若女a选中男b,女c选中男d,a<c,b> ...