The frequency analysis of Python's Boven (Word, screen Name) for Sina Weibo

Source: Internet
Author: User

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/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.