CODE:

#!/usr/bin/python
# -*- coding: utf-8 -*- '''
Created on 2014-7-9
@author: guaguastd
@name: entities_frequency_map.py
''' if __name__ == '__main__': # import Counter
from collections import Counter # import visualize
from visualize import visualize_frequency_map # pip install prettytable
# from prettytable import PrettyTable # import search
from search import search_for_tweet # 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) for label, data in (('Word', words),
('Screen Name', screen_names),
('Hashtag', hashtags)):
# Build a frequency map for each set of data and plot the values
c = Counter(data)
sTitle = label
xLabel = "Bins (number of times an item appeared)"
yLabel = "Number of items in bin"
visualize_frequency_map(c.values(), sTitle, xLabel, yLabel)

RESULT:

Python 对Twitter中指定话题的Tweet基本元素的频谱分析的更多相关文章

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

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

  2. Python 可视化Twitter中指定话题中Tweet的词汇频率

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

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

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

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

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

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

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

  6. 用 python 修改文件中指定的行数

    #! /bin/python filename='setup.ini' lines=[] with open(filename,'r') as f: lines=f.readlines() lines ...

  7. python 删除文件中指定行

    代码适用情况:xml文件,循环出现某几行,根据这几行中的某个字段删掉这几行这段代码的作用删除jenkins中config.xml中在自动生成pipline报错的时的回滚 start = '<se ...

  8. python返回列表中指定内容的索引

    import numpy as npa=[2,10,2,3,4,10,10]ans = np.where(np.array(a)==10)print(ans) 结果是:(array([1, 5, 6] ...

  9. Python获取list中指定元素的索引

    在平时开发过程中,经常遇到需要在数据中获取特定的元素的信息,如到达目的地最近的车站,橱窗里面最贵的物品等等.怎么办?看下面 方法一: 利用数组自身的特性 list.index(target), 其中a ...

随机推荐

  1. WPF绘制党徽(立体效果,Cool)

    原文:WPF绘制党徽(立体效果,Cool) 前面用WPF方式绘制了党旗(WPF制作的党旗) ,去年3月份利用C# 及GDI+绘制过党徽,这次使用WPF来绘制党徽. ------------------ ...

  2. .Net下一个Winform方案可以让MessageBox.Show它显示在父窗口的中间

    下面的文字,缺省值是在屏幕中间显示. DialogResult dr = MessageBox.Show("是否要删除此数据?", "删除确认", Messag ...

  3. STM32本学习笔记EXTI(外部中断)

    参考资料:STM32数据表.网络信息 =========================================切割线===================================== ...

  4. RESTful API Design With NodeJS & Restify

    http://code.tutsplus.com/tutorials/restful-api-design-with-nodejs-restify--cms-22637 The RESTful API ...

  5. UI —— 计算器

    #import <UIKit/UIKit.h> @interface MyViewController :UIViewController { NSInteger _firstName; ...

  6. android cocos2dx游戏-加入截图和分享微博功能

    本文介绍怎样在游戏中添加分享功能,截屏后分享到微博及其他社交网络的功能. public class ShareSupport { // when you want to use share(),fir ...

  7. GotoTest

    循环标签跳出循环 public class GotoTest { public static void main(String[] args) { int[][] array={ {1,20,3}, ...

  8. Vim经常使用技巧总结1

    我的主力博客:半亩方塘 1. 反复上次的操作在普通模式下用 . 命令 2. 取消上次的操作在普通模式下用 u 命令 3. 整行删除在普通模式下用 dd 命令,此命令在删除行后 不进入插入模式 4. 整 ...

  9. IOS应用上传须要做的工作

    苹果开发人员   https://developer.apple.com/ 证书创建流程 certificates (证书): 是电脑可以增加开发人员计划的凭证 证书分为:开发证书和公布(产品)证书, ...

  10. codeigniter 该脚本在运行300s超时退

    直接看代码, file:system/core/CodeIgniter.php /* 102  * -------------------------------------------------- ...