Bing の tidy な極性判定:Call me Ishmael(ggplot2 付き)!
Bing 辞書を使う最後の演習です!この演習では、パイプ演算子(%>%)を使って、Moby Dick のセンチメントのタイムラインを作成します。
最後に、以下のコード構造に沿ってシンプルな可視化も作成します。ビジュアルについては、次の章でさらに詳しく扱います。
ggplot(pivoted_data, aes(index_column, polarity_column)) +
geom_smooth(se = FALSE)
この演習はコースの一部です
Rで学ぶSentiment Analysis
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
moby_polarity <- moby %>%
# Inner join to lexicon
___(bing, by = c("___" = "___")) %>%
# Count the sentiment scores
___(___, ___) %>%
# Pivot the sentiment into positive and negative columns
___(names_from = ___, values_from = ___, values_fill = ___) %>%
# Add polarity column
mutate(___ = ___ - __) %>% arrange(index)
# Examine a portion
moby_polarity[190:195,]