CODE:
#!/usr/bin/python
#-*-coding:utf-8-*-
' Created on
2014-7-9
@author: guaguastd
@name: weibofrequencyanalysis.py
'
if __name__ = = ' __main__ ':
# get Weibo_api to access Sina APIs
from Sinaweibologin Import sinaweibologin
Sinaweiboapi = Sinaweibologin ()
# import Sinaweibo from
Sinaweibo Import extractweiboentities
# import sinaweobostatuses from
sinaweibostatuses import publictimeline
# Import sinaweibofrequency from
sinaweibofrequency import weibofrequencyanalysis
# Get the new 5 Weibo
Weibonum = 5
statuses = Publictimeline (Sinaweiboapi, weibonum)
status_texts,screen_names,words = Extractweiboentities (statuses) for
label, data in ("Word", Words),
(' Screen Name ', screen_names):
Weibofrequencyanalysis (label, data, Weibonum)
Result:
+------------------------------------------+-------+
| Word | Count |
+------------------------------------------+-------+
| Http://t.cn/8snKY0S | 1 |
| Onlookers Cannci hundred bags 2014 new style cowhide female bag | 1 |
| Fashion trend Single Shoulder bag | 1 |
| Romantic RI series "Like Please praise | 1 | | | 1 |
+------------------------------------------+-------+
+--------------------+-------+
| Screen Name | Count |
+--------------------+-------+
| 1 |
| Mobile phone User 2360148561 | 1 |
| Current Explosion v | 1 |
| Star falls in love with a bubble face cat | 1 |
| Beauty Boom Health | 1 |
+--------------------+-------+
Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/extra/