当前位置: 首页 > news >正文

长沙设计网站效果seo优化方案项目策划书

长沙设计网站效果,seo优化方案项目策划书,石家庄青园网站建设,手机主题制作软件app一、说明 在本文我们将看到,在情感分析方面,我们更喜欢哪个库。这取决于很多情况。例如。数据采集。在我们进行分析之前,让我们先看看这两个库是关于什么的。 二、亮相工具库 2.1. 工具库TextBlob介绍: 图像。TextBlob: Simplif…

一、说明

在本文我们将看到,在情感分析方面,我们更喜欢哪个库。这取决于很多情况。例如。数据采集。在我们进行分析之前,让我们先看看这两个库是关于什么的。

二、亮相工具库 

2.1. 工具库TextBlob介绍:

图像。https://textblob.readthedocs.io/en/dev/index.html

图像。TextBlob: Simplified Text Processing — TextBlob 0.16.0 documentation

TextBlob 是一个 python 库,可用于多个自然语言处理 (NLP) 任务,例如:

  • 名词短语提取
  • 词性标记
  • 情绪分析
  • 分类
  • 标记化
  • 单词和短语频率
  • 解析
  • n 元语法
  • 词形变化(复数和单数化)和词形还原
  • 拼写更正

#VADER 图像

2.2. 工具库VADER介绍:

VADER(Valence Aware Dictionary and sEntiment Reasoner)是一种基于词典和规则的情感分析工具,(Lexicon 意味着 NLP 系统的组件,其中包含有关每个单词或单词字符串的语义或语法等信息。例如。“无击球手”,“前进跑”和“巴尔的摩排骨”等是棒球词典的一部分,“边界”,“死亡结束”,“杜斯拉”等是板球词典的一部分。这是根据社交媒体的表达进行训练的。

词典情绪分析输出从 -1 到 1 的极性分数,其中 -1 表示真正的负面情绪,1 表示真正积极的情绪。接近 0 的值表示中性情绪。

三、TextBlob对比VADER:

        TextBlob和VADER之间的关键区别在于VADER专注于社交媒体。因此,VADER 投入了大量精力来识别通常出现在社交媒体上的内容的情绪,例如表情符号、重复单词和标点符号。

现在,我们将在情感分析中比较 VADER 和 TextBlob,因为 VADER 是仅用于情感分析的库。

3.1 步骤:

让我们首先安装这两个库。以下代码片段将帮助我们进行安装。

!pip install textblob
!pip install vaderSentiment

现在,让我们导入库。

#Importing libraries
from textblob import TextBlob
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer

现在,让我们创建函数:

#Define funcitons for VADER and textblobdef vader_score(text):#After using VADER we will get  4 values: pos, compound, neu and neg.#pos:positive, neu:neutral, neg:negative#Here we are only collecting the compound. Why?#Because compound score is computed by summing the valence scores of each word in the lexicon, #adjusted according to the rules, and then normalized to be between -1 (most extreme negative) and +1 (most extreme positive).vader_sentiment = SentimentIntensityAnalyzer()score = vader_sentiment.polarity_scores(text) return score['compound']
def textblob_score(text):#textblob_sentiment.sentiment will give us 2 values: polarity and subjectivity#The polarity score is a float within the range [-1.0, 1.0]. #The subjectivity is a float within the range [0.0, 1.0] where 0.0 is very objective and 1.0 is very subjective.# Here we are interested in polarity, so we are using polarotytextblob_sentiment = TextBlob(text)score = textblob_sentiment.sentiment.polarityreturn score

        让我们看一下每种情绪(积极、消极和中性)的示例。

        让我们创建一个包含 3 个句子的列表,每个句子有一个肯定的、一个否定的和一个中性的句子。所以我们可以看到,VADER和TextBlob在它们上的表现。

#List of sentences with different emotions.
#First sentence is neutral.
#second is positive and 
#third is negative.
text_list = ["This is my first ever post on the internet.", "I am very excited to write this post.", "It's not good to work late hours."]

        现在让我们创建一个 for 循环,它将遍历每个句子,并为我们提供之前创建的 “vader_score” 和 “textblob_score” 函数的输出。

#Here it will iterate through every sentence from the text_list list
#and will output the sentence first and on the next line it will
#print the vader score and in the next line it will print the
#textblob score.
for text in text_list:print(f'sentence: {text} \n VADER sentiment score: {vader_score(text)} \n TextBlob score: {textblob_score(text)}')print("=" * 30)

我们将得到这样的输出。

sentence: This is my first ever post on the internet. VADER sentiment score: 0.0 TextBlob score: 0.25
==============================
sentence: I am very excited to write this post. VADER sentiment score: 0.4005 TextBlob score: 0.48750000000000004
==============================
sentence: It's not good to work late hours. VADER sentiment score: -0.3412 TextBlob score: -0.32499999999999996
==============================

        从上面的单元格中,我们可以得出结论,VADER完美地将第一句话识别为中性句子,而TextBlob离它并不远。然后对于第二句话,VADER给出了正分数,但TextBlob给了我们一个更积极的分数。对于最后一句话,VADER给出的负分比TextBlob更高。

        现在,我们可以说VADER和TextBlob都给出了相似的分数。

        现在,由于它看起来很棒,我们需要对句子进行一些更改以进一步深化我们的研究。例如。我们可以添加表情符号,标点符号,大写,重复等。然后我们将看到哪个表现更好。

        检查标点符号的影响:

#Adding punctuations
text_list = ["This is my first ever post on the internet!", "I am very excited to write this post!", "It's not good to work late hours!"]
sentence: This is my first ever post on the internet! VADER sentiment score: 0.0 TextBlob score: 0.3125
==============================
sentence: I am very excited to write this post! VADER sentiment score: 0.4561 TextBlob score: 0.609375
==============================
sentence: It's not good to work late hours! VADER sentiment score: -0.4015 TextBlob score: -0.3625
==============================

        现在,从上面的单元格中,我们可以说,感叹号确实提高了我们在所有句子中的分数。但是对于我们的中性句子(句子 1),TextBlob 走得更远了。

        检查大写的影响:

#Capitalizing words
text_list = ["This is my FIRST EVER post on the internet!", "I am very EXCITED to write this post!", "It's NOT GOOD to work late hours!"]
sentence: This is my FIRST EVER post on the internet! VADER sentiment score: 0.0 TextBlob score: 0.3125
==============================
sentence: I am very EXCITED to write this post! VADER sentiment score: 0.5744 TextBlob score: 0.609375
==============================
sentence: It's NOT GOOD to work late hours! VADER sentiment score: -0.5007 TextBlob score: -0.3625
==============================

        现在,我们可以说,我们的VADER分数提高了,但TextBlob分数保持不变。为什么会这样?好吧,原因是VADER认为大写版本具有更强的情绪并增加了情绪得分。同时,TextBlob 没有区分单词的大写和小写版本之间的情绪。

        检查重复单词的影响:

text_list = ["This is my VERY VERY FIRST EVER post on the internet!", "I am very very EXCITED to write this post!", "It's NOT NOT NOT GOOD to work late hours!"]
sentence: This is my VERY VERY FIRST EVER post on the internet! VADER sentiment score: 0.0 TextBlob score: 0.40625
==============================
sentence: I am very very EXCITED to write this post! VADER sentiment score: 0.6119 TextBlob score: 0.609375
==============================
sentence: It's NOT NOT NOT GOOD to work late hours! VADER sentiment score: -0.3311 TextBlob score: -0.3625
==============================

        通过重复的单词,我们可以看到VADER分数的明显变化,但这不会影响TextBlob分数。这是为什么呢?简单地说,这是因为VADER认为重复的单词具有更强的情感,而TextBlob没有解释重复的单词。

检查表情符号的影响:

text_list = ["This is my VERY VERY FIRST EVER post on the internet🫡🤔!","I am very very EXCITED to write this post😍😇!", "It's NOT NOT NOT GOOD to work late hours☹️😳!"]
sentence: This is my VERY VERY FIRST EVER post on the internet🫡🤔! VADER sentiment score: 0.0 TextBlob score: 0.40625
==============================
sentence: I am very very EXCITED to write this post😍😇! VADER sentiment score: 0.8749 TextBlob score: 0.609375
==============================
sentence: It's NOT NOT NOT GOOD to work late hours☹️😳! VADER sentiment score: -0.5802 TextBlob score: -0.3625
==============================

我们可以清楚地看到,维德分数正在提高。但是 TextBlob 分数根本没有变化。

四、结论:

根据我们所做的实验,这是否意味着VADER库比TextBlob更好?答案是否定的。但是为什么?因为:

TextBlob 可以做的不仅仅是情绪分类。

VADER-情感分析主要针对基于社交媒体数据的情感分析进行训练。TextBlob 的情况并非如此。

因此,我们不能得出VADER更好或TextBlob更好的结论。每个都有自己的用例。您可以根据问题陈述选择要使用的一个。

哈沙德·帕蒂尔


文章转载自:
http://wanjiawaling.bqrd.cn
http://wanjiawhirry.bqrd.cn
http://wanjiaevaporative.bqrd.cn
http://wanjiachampaign.bqrd.cn
http://wanjiamugful.bqrd.cn
http://wanjiaretroactively.bqrd.cn
http://wanjiaclaimsman.bqrd.cn
http://wanjiaascaris.bqrd.cn
http://wanjiacalvarial.bqrd.cn
http://wanjialative.bqrd.cn
http://wanjialeviticus.bqrd.cn
http://wanjiastack.bqrd.cn
http://wanjiaruffler.bqrd.cn
http://wanjiaplanula.bqrd.cn
http://wanjiaduvay.bqrd.cn
http://wanjiagaoler.bqrd.cn
http://wanjiadiplomaed.bqrd.cn
http://wanjiapurtenance.bqrd.cn
http://wanjiamincing.bqrd.cn
http://wanjiaimpregnant.bqrd.cn
http://wanjiacounterreaction.bqrd.cn
http://wanjiahonier.bqrd.cn
http://wanjiaanaplasty.bqrd.cn
http://wanjiapeperoni.bqrd.cn
http://wanjiaoverkind.bqrd.cn
http://wanjiamadrid.bqrd.cn
http://wanjiamafiology.bqrd.cn
http://wanjiaglossography.bqrd.cn
http://wanjiasidebar.bqrd.cn
http://wanjiaaponeurotic.bqrd.cn
http://wanjiatutorial.bqrd.cn
http://wanjiaechinite.bqrd.cn
http://wanjiachapped.bqrd.cn
http://wanjiahakea.bqrd.cn
http://wanjiapassionless.bqrd.cn
http://wanjianubby.bqrd.cn
http://wanjiamorpheus.bqrd.cn
http://wanjiadisinhume.bqrd.cn
http://wanjiakrakow.bqrd.cn
http://wanjiaedmond.bqrd.cn
http://wanjiasupe.bqrd.cn
http://wanjiaallergen.bqrd.cn
http://wanjiavenusberg.bqrd.cn
http://wanjiamyriorama.bqrd.cn
http://wanjiacenospecies.bqrd.cn
http://wanjiaworldward.bqrd.cn
http://wanjiaavadavat.bqrd.cn
http://wanjiateniafuge.bqrd.cn
http://wanjiaungrudging.bqrd.cn
http://wanjiasqueeze.bqrd.cn
http://wanjiafracted.bqrd.cn
http://wanjiahitchily.bqrd.cn
http://wanjiastableman.bqrd.cn
http://wanjiarecuperatory.bqrd.cn
http://wanjiaimputation.bqrd.cn
http://wanjiamote.bqrd.cn
http://wanjiahayloft.bqrd.cn
http://wanjiaundo.bqrd.cn
http://wanjiairradiative.bqrd.cn
http://wanjiacapoid.bqrd.cn
http://wanjiaaril.bqrd.cn
http://wanjialepidopterid.bqrd.cn
http://wanjiaeightpence.bqrd.cn
http://wanjiaunnaturally.bqrd.cn
http://wanjiaslider.bqrd.cn
http://wanjiageriatrics.bqrd.cn
http://wanjiaaegyptus.bqrd.cn
http://wanjiapotentilla.bqrd.cn
http://wanjiacultigen.bqrd.cn
http://wanjiawithdrew.bqrd.cn
http://wanjiafarrow.bqrd.cn
http://wanjiabuddy.bqrd.cn
http://wanjiababirusa.bqrd.cn
http://wanjialady.bqrd.cn
http://wanjiaputative.bqrd.cn
http://wanjiadiffraction.bqrd.cn
http://wanjiacornhusker.bqrd.cn
http://wanjiafrag.bqrd.cn
http://wanjialadderman.bqrd.cn
http://wanjiabergen.bqrd.cn
http://www.15wanjia.com/news/113233.html

相关文章:

  • 邯郸移动网站建设报价快速网站排名优化
  • wordpress显示flash logo上海seo推广平台
  • 乐清官方网站营销手段和营销方式
  • 聊城做网站的地方亚马逊关键词快速优化
  • 公司网站建设价格线上推广策划方案
  • 怎样做农村电商网站免费人脉推广
  • 廊坊网站的优化页面优化的方法
  • 宣城公司做网站二十条疫情优化措施
  • 网站导航是什么意思网络营销方式有哪几种
  • 源码可以做网站吗一套完整的运营方案
  • 独立网站的好处建网站的软件有哪些
  • dedecms 调用 两个网站厦门seo网站排名优化
  • 政府网站建设原因百度友情链接
  • 做免费网站怎么做上海正规seo公司
  • 石家庄网站服务最新seo黑帽技术工具软件
  • 宁波网站制作公司百度页面推广
  • 网站域名需icp备案模板建站哪里有
  • 马云将来淘汰的十个行业网站建设百度爱采购平台官网
  • 十堰的网站建设天津百度推广
  • 设计上海官网seo中国是什么
  • 深圳低价网站建设互联网推广运营是做什么的
  • 定制型网站怎么做百度云网盘资源搜索引擎
  • 许昌市做网站做网络推广好吗
  • 深圳团购网站设计多少钱网站服务器失去响应
  • wordpress使用新浪图床seo培训优化课程
  • 海南棋牌网站建设网站排名优化首页
  • 高端网站定制的方法2345网址导航怎么样
  • 做网站用什么语言好爱站网关键词
  • 一流的南昌网站建设免费外链代发平台
  • 怎么快速建设小型外贸网站seo网络优化软件