0

使用感测器分析文本:

我已经很久没有悲伤了。我今天特别高兴。美好的一天。

我首先使用了逐句分割文本

library(sentimentr)

ase1 <- c(
  "I haven't been sad in a long time.",
  "I am extremely happy today.",
  "It's a good day."
)

part1 <- get_sentences(ase1)
sentiment(part1)

   element_id sentence_id word_count sentiment
1:          1           1          8 0.1767767
2:          2           1          5 0.6037384
3:          3           1          4 0.3750000

然后用了一段文字

ase2 <- c(
  "I haven’t been sad in a long time. I am extremely happy today. It’s a good day.")

part2 <- get_sentences(ase2)
sentiment(part2)

   element_id sentence_id word_count   sentiment
1:          1           1          9 -0.03333333
2:          1           2          5  0.60373835
3:          1           3          5  0.33541020

相同的文本,字数和情感分数的差异

请指教?

4

1 回答 1

0
于 2020-09-15T11:41:13.517 回答