NRC 감성 시각화
시각화는 단순한 집계보다 데이터의 패턴을 더 잘 파악하게 해 준다는 점을 확인했죠. 이제 nrc 사전의 감성을 시각화해 보겠습니다. tidyverse와 tidytext 패키지는 미리 불러왔어요.
이 연습은 강의의 일부입니다
R로 시작하는 텍스트 분석
연습 안내
nrc사전을 추출하고, 감성별로 개수를 센 다음, 그 개수로 다시 정렬하여 새로운 범주형 열sentiment2를 만드세요.- 새 감성 범주 열을 사용해
sentiment_counts를 시각화하세요. - 제목은 "Sentiment Counts in NRC", x축은 "Sentiment", y축은 "Counts"로 바꾸세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Pull in the nrc dictionary, count the sentiments and reorder them by count
sentiment_counts <- ___(___) %>%
___(___) %>%
___(sentiment2 = ___(___, ___))
# Visualize sentiment_counts using the new sentiment factor column
___(___, aes(___, ___)) +
geom_col() +
coord_flip() +
# Change the title to "Sentiment Counts in NRC", x-axis to "Sentiment", and y-axis to "Counts"
___(
___ = ___,
___ = ___,
___ = ___
)