基于Python的微博情感分析研究设计

随着互联网的快速发展,各类社交媒体平台如微信、QQ等也与日俱增,而微博更是集成了传统网站、论坛、博客等的优点,并加上了人与人之间的互动性、关系亲密程度等多种智能算法,并以简练的形式让数据爆发性的传播,促进了人与人之间的交流。网民可以通过微博来分享自己的生活,同时抒发自己的喜怒哀乐。因此对微博每天产生的信息量的分析和利用的需求显得更为迫切。

情感分析,也称倾向性分析、意见抽取和意见挖掘。主要是通过对带有情感色彩的主观性文本进行分析、处理、归纳然后进行推理的过程。而微博,人口基数大,涉及的话题广泛,对人们的日常生活产生了不可估量的影响,而对微博的情感分析,更是有着十分重要的意义。为此,本文针对了微博文本的情感分析进行了如下几个工作。

首先,使用微博官方的API对微博进行抓取,进行分类标注。然后,对微博文本进行预处理,主要包括去掉无意义,对微博文本没有影响的词语。其次,使用SVM算法对文本进行初步的筛选,主要是去除特别明显的广告等无关性的微博。最后使用朴素贝叶斯对微博进行情感分析,将微博分为积极、消极、客观三类,同时使用AdaBoost算法对朴素贝叶斯算法进行加强。

这些带有情感信息的微博是非常宝贵的资源,通过情感分析可以获取网民的此时的心情,对某个事件或事物的看法,可以挖掘其潜在的商业价值,还能对社会的稳定做出一定的贡献。

关键词:情感分析    AdaBoost    朴素贝叶斯    文本分类   数据挖掘

 

ABSTRACT

With the rapid development of Internet, various social medias like WeChat, QQ and Weibo are also growing with each passing day. Weibo which not only integrates the advantages of traditional websites, forums, blogs, but also leads into the introduction of a comprehensive interactive relationship between content, quality of intimacy and multiple algorithm promote the data communication explosively. And people can communicate more and more conveniently. Users can share their own lives by Weibo, and express their emotions. So, the need for analysis and use of information generated by Weibo every day is urgent.

Sentiment analysis is a process of analyzing, summarizing and reasoning subjective texts with emotion. And Weibo, based on a large population , involving a wide range of topics, has a great impact on people's daily life. And the emotional analysis of Weibo is a very important significance. In result, this paper focuses on the emotional analysis of Weibo text as follows.

First of all, micro-blog's official API is used for micro-blog crawl and then classifying weibo. After that, the Weibo text needs to be preprocessed by removing meaningless text, which does not affect the words. Secondly, the SVM algorithm is used for the preliminary screening of the text, mainly to remove the particularly obvious advertising and other unrelated with Weibo. Finally, using Bayes algorithm to analyze Weibo. Weibo text is divided into three types: positive, negative and objective, and AdaBoost algorithm is used to strengthen the Bayes algorithm.

The emotional information of Weibo is a very valuable resource. Through the analysis of Internet users, we can get emotional feelings, views of things or events at this time, also we can mine the potential commercial value and make a contribution for social stability.

Key Words: Sentiment analysis    AdaBoost    Naive-Bayes    Text Categorization    Data Mining


目  录

前   言 1

第一章 概述 2

1.1 研究背景和现状 2

1.2 情感分析的概念 2

1.3 本文的内容安排 4

第二章 微博的获取与清理 6

2.1 概述 6

2.2 微博的反爬虫机制 6

2.2.1 通过Headers反爬虫 6

2.2.2 基于用户行为的爬虫 6

2.2.3 动态页面的反爬虫 7

2.2.4 微博的反爬虫 7

2.3 微博的获取 7

2.3.1 微博API的获取 7

2.3.2 模拟登录 8

2.3.3 微博抓取与存储 9

2.4 微博的分词与降噪 9

2.4.1 概念 9

2.4.2 分词 9

2.4.3 删除URL 10

2.4.4 删除用户名 11

2.4.5 去除停用词 11

2.5 本章小结 11

第三章 SVM初步分类 12

3.1 概念 12

3.1.1 线性分类 12

3.2 SVC 13

3.2.1 线性支持向量分类机 13

3.2.2 算法描述 14

3.3 实验 15

3.3.1 选取特征 15

3.3.2 降噪 15

3.3.3 特征降维 15

3.3.4 将文本样本变成特征显示 16

3.3.5 将文本随机分成训练集、测试集 16

3.3.6 进行训练和预测 16

3.4 本章小结 17

第四章 利用贝叶斯定理进行情感分析 18

4.1 引言 18

4.2 贝叶斯定理 18

4.2.1 高斯朴素贝叶斯 20

4.2.2 伯努利贝叶斯 20

4.2.3 多项式朴素贝叶斯定理 21

4.3 本文中的多项式朴素贝叶斯 21

4.3.1 算法过程 21

4.3.2 拉普拉斯平滑 22

4.4 实验 22

4.4.1 分词 22

4.4.2 特征提取 23

4.4.3 向量化 23

4.4.4 朴素贝叶斯分类 24

4.4.5 测试 24

4.4.6 计算准确率 25

4.5 本章小结 25

第五章 利用AdaBoost加强分类器 26

5.1 集成学习 26

5.1.1 发展历史 26

5.1.2 Bagging方法 26

5.1.3 Boosting方法 26

5.2 ADABOOST 27

5.2.1 概念 27

5.2.2 27

5.2.3 29

5.3 ADABOOST提升朴素贝叶斯文本分类 32

5.4 多类问题 33

5.4.1 AdaBoost.M1算法 33

5.4.2 AdaBoost.SAMME 34

5.4.3 AdaBoost.SAMME.R 34

5.5 实验 35

5.5.1 二分类 36

5.5.2 多分类 37

5.6 本章小结 39

第六章 总结与展望 40

6.1 本文主要内容总结 40

6.2 存在问题及未来研究展望 40

参考文献 42

致    谢 44

 

  • 0
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值