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的词汇频率的更多相关文章

  1. Python 对Twitter中指定话题的Tweet基本元素的频谱分析

    CODE: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-9 @author: guaguastd @name: en ...

  2. Python 对Twitter中指定话题的被转载Tweet数量的频谱分析

    CODE: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-10 @author: guaguastd @name: r ...

  3. Python 查找Twitter中特定话题中最流行的10个转发Tweet

    CODE: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-4 @author: guaguastd @name: fi ...

  4. http 中指定head中Content-Encoding属性为gzip 转换过程中的一些问题

    项目环境: 对接的服务放在微服务中 提供接口给应用层调用 ,微服务放需要 接受参数 并且转换成压缩格式给 第三方服务 本来以为需要自己压缩,httpclint 中已经封装好了GzipCompressi ...

  5. 提取json字符串中指定格式中的参数值

    直接上代码: import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; p ...

  6. python glob 用通配符查找指定目录中的文件 - 开源中国社区

    python glob 用通配符查找指定目录中的文件 - 开源中国社区 python glob 用通配符查找指定目录中的文件

  7. python 统计字符串中指定字符出现次数的方法

    python 统计字符串中指定字符出现次数的方法: strs = "They look good and stick good!" count_set = ['look','goo ...

  8. python提取mysql中指定列参数,并循环打印

    试验环境: Python 3.7.0 Mysql 5.0 实验目的: 使用python将数据库中指定的列中的数值取出来,并循环遍历,用以当成参数传递给需要它的方法. 本次实验取的是para列的数据 实 ...

  9. Ubuntu18.0 解决python虚拟环境中不同用户下或者python多版本环境中指定虚拟环境的使用问题

    一. 不同用户下配置virtualenvwrapper的问题 问题描述: 安装virtualnev和virtualnevwrapper之后,在.bashrc进行virtualenvwrapper的相关 ...

随机推荐

  1. 2018 ACM南京网络赛H题Set解题报告

    题目描述 给定\(n\)个数$a_i$,起初第\(i\)个数在第\(i\)个集合.有三种操作(共\(m\)次): 1 $u$ $v$ 将第$u$个数和第$v$个数所在集合合并 2 $u$ 将第$u$个 ...

  2. NBUT 1618 投放炸弹(树状数组)

    [1618] 投放炸弹 时间限制: 1000 ms 内存限制: 65535 K 问题描述 我们定义一个炸弹能炸毁的地方要求曼哈顿距离小于等于某个值. 曼哈顿距离——两点在南北方向上的距离加上在东西方向 ...

  3. 购物(sum)

    购物(sum) 题目描述 visit_world 有一个商店,商店里卖N个商品,第ii 个的价格为 a[[i] 我们称一个正整数K 是美妙的,当且仅当我们可以在商店里选购若干个商品,使得价格之和落在区 ...

  4. Codeforces Round #315 (Div. 2) B 水题强行set

    B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  5. BZOJ 3897: Power

    3897: Power Time Limit: 30 Sec  Memory Limit: 512 MBSubmit: 218  Solved: 83[Submit][Status][Discuss] ...

  6. Select语句执行顺序《转》

    原文发布时间为:2010-10-12 -- 来源于本人的百度文章 [由搬家工具导入] 目的在于理解如何Select 【搜索所得】: 标准的 SQL 的解析顺序为:(1).FROM 子句, 组装来自不同 ...

  7. AVRStudio 6 添加调试功能

    下载这个文件并安装就可以了:http://avr-jungo-usb.software.informer.com/download/ 具体可以看这个贴子:http://electronics.stac ...

  8. [LeetCode] Length of Last Word 字符串查找

    Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the l ...

  9. MSP430 G2553 寄存器列表与引脚功能

    USCI_B0 USCI_B0 发送缓冲器UCB0TXBUF 06Fh USCI_B0 接收缓冲器UCB0RXBUF 06Eh USCI_B0 状态UCB0STAT 06Dh USCI B0 I2C ...

  10. Day 20 Object_oriented_programing(摘)

    面向对象变成介绍 面向过程编程 核心是过程(流水线式思维),过程即解决问题的步骤,面向过程的设计就好比精心设计好一条流水线,考虑周全什么时候处理什么东西.主要应用在一旦完成很少修改的地方,如linux ...