ferozah avatar

[데이터분석] 문재인 대통령, 평창올림픽 환영사에서 가장 많이 언급된 단어는?(재미로보는 개회식 환영사 워드클라우드)

ferozah

Published: 12 Feb 2018 › Updated: 12 Feb 2018[데이터분석] 문재인 대통령, 평창올림픽 환영사에서 가장 많이 언급된 단어는?(재미로보는 개회식 환영사 워드클라우드)

[데이터분석] 문재인 대통령, 평창올림픽 환영사에서 가장 많이 언급된 단어는?(재미로보는 개회식 환영사 워드클라우드)

안녕하세요. ferozah 입니다.

steem_with_ferozah.png

지난 번 스팀잇 1월 데이터 분석에 이어 이번 시간에는 재미로 한 번 확인해 보는 "문재인 대통령, 올림픽 개회식 사전 리셉션 환영사" 에 대한 워드 클라우드 입니다.

원문은 청와대 홈페이지 입니다.

대통령연설.png

R 프로그래밍 코드 입니다.

library(KoNLP)
library(SnowballC)
library(RColorBrewer)
library(wordcloud)  

데이터분석, 정확히 텍스트 마이닝에 필요한 라이브러리를 include 합니다.
KoNLP와 SnowballC는 한글 자연어 처리 합니다. RcolorBrewer은 워드 클라우드를 표현할 때 글자 색깔이나 모양을 정하는 용도 입니다. wordcloud는 말그대로 워드 클라우드를 그리기 위한 함수입니다.

text <- readLines("moon_address.txt")
parsed <- sapply(text,extractNoun,USE.NAMES = F)

대통령의 연설문(moon_address.txt)을 읽어와서 명사를 추출 합니다.

wordcloud(words=top100$word, freq=top15$freq, min.freq = 2, scale=c(2,0.5), max.words = 500, random.order = FALSE, rot.per = 0.1,colors=brewer.pal(8, "Dark2"))

추출된 단어 중 2번이상 등장하는 단어들만 필터링하여 워드 클라우드로 표현 합니다.
'우리'와 '평화'라는 단어가 가장 많이 언급 되었네요. 평창 올림픽을 평화 올림픽에 빗대어 이야기 하는데 문재인 대통령 연설문에서도 그 맥락이 드러납니다.

moon_address_wordcloud.png

오늘은 추가로 Bar chart 도 만들어 보았습니다.
각 단어들이 몇번씩 등장 했는지 Bar chart로 보여 줍니다.

ggplot(data=top10, aes(x=reorder(word,freq), y=freq, group=1, fill=word)) + geom_bar(stat="identity", aes(fill=word), position=position_dodge(), colour="black")  + theme(legend.position="right", legend.direction="vertical") + coord_flip() + geom_text(data=top10, aes(label=top10$freq), position=position_identity(), vjust=0.5, hjust=-0.2)

moon_address_bar.png

문재인 대통령 연설문으로 확인해본 워드 클라우드와 Bar chart 였습니다!
우리와 평화라는 단어로 대표되는 평창올림픽에서 우리나라 선수들의 선전을 기원합니다!

Leave [데이터분석] 문재인 대통령, 평창올림픽 환영사에서 가장 많이 언급된 단어는?(재미로보는 개회식 환영사 워드클라우드) to:

Written by

IT엔지니어/육아대디/독서가/뉴비입니다. 잘 부탁드립니다!

Read more #kr posts


Best Posts From ferozah

We have not curated any of ferozah's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From ferozah