NRC の感情を数える
tidytext パッケージに含まれる4つ目の辞書が nrc 辞書です。まずは感情の出現数を数えることから始めましょう。
この演習はコースの一部です
Rで始めるテキスト分析
演習の手順
- ふだんは私が用意しますが、最初に
tidyverseとtidytextパッケージを読み込みましょう。 nrcで各感情に対応する単語数を数えてください。- カウントは降順に並べ替えましょう。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Load the tidyverse and tidytext packages
___(___)
___(___)
# Count the number of words associated with each sentiment in nrc
___(___) %>%
___(___) %>%
# Arrange the counts in descending order
___(___)