- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试关注this情感分析在线教程。代码:
new_sentiments <- sentiments %>% #From the tidytext package
filter(lexicon != "loughran") %>% #Remove the finance lexicon
mutate( sentiment = ifelse(lexicon == "AFINN" & score >= 0, "positive",
ifelse(lexicon == "AFINN" & score < 0,
"negative", sentiment))) %>%
group_by(lexicon) %>%
mutate(words_in_lexicon = n_distinct(word)) %>%
ungroup()
产生错误:
>Error in filter_impl(.data, quo) :
>Evaluation error: object 'lexicon' not found.
相关的,也许是在我看来,“情绪”表表现得很奇怪(已损坏?)。这是“情绪”的要点:
> head(sentiments,3)
> element_id sentence_id word_count sentiment
> chapter
> 1 1 1 7 0 The First Book of Moses:
> Called Genesis
> 2 2 1 NA 0 The First Book of Moses:
> Called Genesis
> 3 3 1 NA 0 The First Book of Moses: >
> Called Genesis
> category
> 1 The First Book of Moses: Called Genesis
> 2 The First Book of Moses: Called Genesis
> 3 The First Book of Moses: Called Genesis
如果我对 bing、AFINN 或 NRC 使用 Get_Sentiments,我会得到看起来合适的响应:
> get_sentiments("bing")
> # A tibble: 6,788 x 2
> word sentiment
> <chr> <chr> > 1 2-faced negative
> 2 2-faces negative
> 3 a+ positive
> 4 abnormal negative
我尝试删除(remove.packages)并重新安装 tidytext;行为没有改变。我正在运行 R 3.5
即使我完全误解了这个问题,我也会很感激任何人能给我的任何见解。
最佳答案
以下说明将修复 new_sentiments
数据集,如 Data Camp tutorial 中所示。 .
bing <- get_sentiments("bing") %>%
mutate(lexicon = "bing",
words_in_lexicon = n_distinct(word))
nrc <- get_sentiments("nrc") %>%
mutate(lexicon = "nrc",
words_in_lexicon = n_distinct(word))
afinn <- get_sentiments("afinn") %>%
mutate(lexicon = "afinn",
words_in_lexicon = n_distinct(word))
new_sentiments <- bind_rows(bing, nrc, afinn)
names(new_sentiments)[names(new_sentiments) == 'value'] <- 'score'
new_sentiments %>%
group_by(lexicon, sentiment, words_in_lexicon) %>%
summarise(distinct_words = n_distinct(word)) %>%
ungroup() %>%
spread(sentiment, distinct_words) %>%
mutate(lexicon = color_tile("lightblue", "lightblue")(lexicon),
words_in_lexicon = color_bar("lightpink")(words_in_lexicon)) %>%
my_kable_styling(caption = "Word Counts per Lexicon")
后续图表也将起作用!
关于R情感分析; 'lexicon' 未找到; 'sentiments' 已损坏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51127671/
我正在使用reactjs-popup,它的 Prop 之一是contentStyle,它允许您传递css-in-js对象来设置库中内部div的样式。 但是,当我传递带有 @media 的 css 对象
在查看了一些服务/工具之后,我得出了一个结论。大多数 Text-to-Speech 工具的技术含量太高、太机械化——换句话说,就是质量差的 c 语音。 是的,最重要的是,看起来它们带有“硬编码”语音模
我正在尝试使用 Emotion.sh在我的 React 测试元素中,但我使用与 example 中相同的代码得到以下错误 需要考虑的可能有冲突的事情:1、之前用的是npm,现在用的是yarn;2. 我
通过以下链接,我有了一些想法。我想问问我是做对了还是做错了。如果我走错了路,请指导我。 链接 Using libsvm for text classification c# How to use li
以下设置不显示background-image。作为调试步骤,我尝试在 const background 中设置 background: pink,这确实有效,确认 emotion 正在正确运行。 打
我有一个 data.frame,其中包含周数 week 和文本评论 text。我想将 week 变量视为我的分组变量,并对它运行一些基本的文本分析(例如 qdap::polarity)。一些评论文本有
我正在研究 Kaggle 电影情感分析,我发现电影评论已使用 Standford Parser 进行了解析。在探索数据集时,我发现相同的语句给出了不同的设置- their parents , wise
我正在尝试使用Affectiva emotion sdk 制作一个演示程序。但是,当我调用 detector.setLicensePath() 时,会抛出一个异常(见下图)。有谁知道如何解决这个问题?
我想设置一个使用 Material-UI v4.11.4 的 Typescript 项目来使用情感进行样式设置,为 MUI v5 版本做准备。目标是在项目中引入情感,以便开发人员可以开始使用新样式,而
我是一名优秀的程序员,十分优秀!