《電子技術(shù)應用》
您所在的位置:首頁 > 通信與網(wǎng)絡 > 設(shè)計應用 > 基于爬蟲和TFIDF-NB算法的微博情感分析
基于爬蟲和TFIDF-NB算法的微博情感分析
2021年電子技術(shù)應用第4期
楊 戈1,,2,,楊麓濤1
1.北京師范大學珠海分校 智能多媒體技術(shù)重點實驗室,,廣東 珠海519087; 2.北京大學深圳研究生院 深圳物聯(lián)網(wǎng)智能感知技術(shù)工程實驗室,,廣東 深圳518055
摘要: 針對微博網(wǎng)絡輿情信息量大,、無規(guī)則、隨機變化的特點,,提出TFIDF-NB(Term Frequency Inverse Document Frequency-Naive Bayes)用于微博情感分析,,設(shè)計與實現(xiàn)了一個基于Scrapy框架的微博評論爬蟲,將某熱點事件的若干條微博評論進行爬取并存進數(shù)據(jù)庫,,然后進行文本分割,、LDA(Latent Dirichlet Allocation)主題聚類,最后使用TFIDF-NB算法進行情感分類,。實驗結(jié)果表明,,TFIDF-NB算法平均準確率高于線性支持向量機算法和K近鄰算法,在精確率和召回率方面高于K近鄰算法,,具有較好的情感分類效果,。
中圖分類號: TN011;TP391.41
文獻標識碼: A
DOI:10.16157/j.issn.0258-7998.200748
中文引用格式: 楊戈,,楊麓濤. 基于爬蟲和TFIDF-NB算法的微博情感分析[J].電子技術(shù)應用,,2021,47(4):59-62,,66.
英文引用格式: Yang Ge,,Yang Lutao. Sentiment analysis of Weibo based on TFIDF-NB algorithm[J]. Application of Electronic Technique,2021,,47(4):59-62,,66.
Sentiment analysis of Weibo based on TFIDF-NB algorithm
Yang Ge1,2,,Yang Lutao1
1.Key Laboratory of Intelligent Multimedia Technology,,Beijing Normal University(Zhuhai Campus),Zhuhai 519087,,China,; 2.Engineering Lab on Intelligent Perception for Internet of Things(ELIP),Shenzhen Graduate School,,Peking University,, Shenzhen 518055,China
Abstract: In view of the large amount of public opinion information on Weibo, irregular and random changes, this paper proposes a Weibo sentiment analysis method based on TFIDF-NB(Term Frequency Inverse Document Frequency-Naive Bayes) algorithm. By coding a Weibo comment crawler based on the Scrapy framework, several Weibo comments on a hot event are crawled and stored in the database. Then text segmentation and LDA(Latent Dirichlet Allocation) topic clustering are performed. And finally the TFIDF-NB algorithm is used for sentiment classification. Experimental results show that the accuracy of the algorithm is higher than that of the standard linear Support Vector Machine algorithm and the K-Nearest Neighbor algorithm, and it is higher than the K-Nearest Neighbor algorithm in terms of accuracy and recall, and it has a better effect on sentiment classification.
Key words : Weibo public opinion,;web crawler,;sentiment classification

0 引言

    網(wǎng)絡輿情是指網(wǎng)絡用戶對社會各方面熱點問題所發(fā)表的見解和建議的輿論,是社會輿情的一種體現(xiàn),,是公眾對社會中各種熱點事件和問題所表達的態(tài)度,、想法、情緒等的集合,?;ヂ?lián)網(wǎng)的快速發(fā)展使得網(wǎng)絡輿情的形成和傳播速度不斷提升,對社會的影響巨大,。

    文獻[1]證明了網(wǎng)絡輿情的發(fā)展具有混沌的特性,,即表現(xiàn)為亂序、無規(guī)則,、隨機變化,。在網(wǎng)絡輿情傳播的過程中,,微博給網(wǎng)絡輿情的形成、發(fā)酵和傳播提供了一個強大的互聯(lián)網(wǎng)平臺,,給其用戶提供了一個向全世界分享信息,、發(fā)表評論和表達訴求的平臺,這些輿論內(nèi)容在短時間內(nèi)會大規(guī)模地擴散,,甚至會影響事件的走向,。

    本文首先實現(xiàn)一個基于Scrapy框架的微博評論爬蟲,將某熱點事件的若干條微博評論進行爬取并存進數(shù)據(jù)庫,,然后進行文本分割和LDA(Latent Dirichlet Allocation)主題聚類,,最后采用TFIDF-NB(Term Frequency Inverse Document Frequency-Navie Bayes)算法進行文本情感分類

    (1)爬蟲

    爬蟲全稱為網(wǎng)絡爬蟲,,是一種可以對互聯(lián)網(wǎng)上的信息進行自動化瀏覽的網(wǎng)絡腳本或程序,,可實現(xiàn)對海量互聯(lián)網(wǎng)信息進行瀏覽、爬取等操作,,并將抓取到的信息存儲于本地中,。

    網(wǎng)絡爬蟲可以分為4種[2]:通用網(wǎng)絡爬蟲[3]、主題網(wǎng)絡爬蟲[4],、增量式網(wǎng)絡爬蟲[5],、深層網(wǎng)絡爬蟲[6-7]

    (2)情感分類

    情感分析是指識別文本中潛在的想法,、情感和態(tài)度的方法[8],。情感分類是情感分析的核心內(nèi)容,情感分類的作用是識別文本數(shù)據(jù)中的觀點,,對情感的積極或消極情緒進行分類[9],。

    目前情感分類主要有兩種方法,一種是基于詞典的方法[10-13],,另一種是基于機器學習的方法[14-16],。




本文詳細內(nèi)容請下載:http://wldgj.com/resource/share/2000003464




作者信息:

楊  戈1,2,,楊麓濤1

(1.北京師范大學珠海分校 智能多媒體技術(shù)重點實驗室,,廣東 珠海519087;

2.北京大學深圳研究生院 深圳物聯(lián)網(wǎng)智能感知技術(shù)工程實驗室,,廣東 深圳518055)

此內(nèi)容為AET網(wǎng)站原創(chuàng),,未經(jīng)授權(quán)禁止轉(zhuǎn)載。