简体   繁体   English

无法在整洁文本中使用NRC词典。 match.arg(lexicon)中的错误:“ arg”应为“ afinn”,“ bing”,“ loughran”之一

[英]Unable to use NRC lexicon in tidytext. Error in match.arg(lexicon) : 'arg' should be one of “afinn”, “bing”, “loughran”

I am learning sentiment analysis in R using tidytext package. 我正在使用tidytext包学习R中的情感分析。 However, i am unable to set nrc as lexicon. 但是,我无法将nrc设置为词典。 Whenever i type get_sentiments ("nrc"), the above error is displayed. 每当我键入get_sentiments(“ nrc”)时,都会显示上述错误。 It says that lexicon coud only be "afinn", "bing" or "loughran". 它说词汇词典只能是“ afinn”,“ bing”或“ loughran”。 I tried updating the package (tidytext) and also installed 'syuzhet' package but still the problem exists. 我尝试更新软件包(tidytext),还安装了“ syuzhet”软件包,但问题仍然存在。 Please help! 请帮忙!

You can just replace; 您可以替换;

nrc_joy <- get_sentiments("nrc") %>% 
  filter(sentiment == "joy")

with; 与;

nrc_joy <- get_sentiments("afinn") %>% 
  filter(value == 2 |value == 3 | value == 4 | value == 5)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Tidytext 错误“~/Library/Caches/textdata/nrc/NRC-Emotion-Lexicon/NRC-Emotion-Lexicon-v0.92/NRC-Emotion-Lexicon-Wordlevel-v0.92.txt”不存在 - Tidytext error '~/Library/Caches/textdata/nrc/NRC-Emotion-Lexicon/NRC-Emotion-Lexicon-v0.92/NRC-Emotion-Lexicon-Wordlevel-v0.92.txt' does not exist emmeans错误:match.arg(type)中的错误:&#39;arg&#39;应该是“link”,“response”,“terms”之一 - emmeans error: Error in match.arg(type) : 'arg' should be one of “link”, “response”, “terms” 对多个 arguments 使用 match.arg 时出错 - Error in using match.arg for multiple arguments 警告:match.arg中的错误:&#39;arg&#39;必须为NULL或字符向量 - Warning: Error in match.arg: 'arg' must be NULL or a character vector match.arg(mvnTest)中的错误:“ arg”的长度必须为1 - Error in match.arg(mvnTest) : 'arg' must be of length 1 Rigraph degree()&#39;match.arg中的错误&#39; - R igraph degree() 'Error in match.arg' R 中的情绪数据集使用 AFINN 词典抛出错误 - sentiments dataset in R throwing error with AFINN lexicon match.arg(regions) 中的错误:“arg”必须为 NULL 或字符向量 - Error in match.arg(regions) : 'arg' must be NULL or a character vector Python 中的 match.arg 等效项? - match.arg equivalent in Python? match.arg 行为不一致 - match.arg behaviour not coherent
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM