情感分析专用词

如何制作另一个图表/ wordcloud,显示“正”和“负”中包含的特定单词的数量?

我已经完成了所有数据清理和转换。我想除了绘制图表外,没有什么可做的。

谢谢

#read csv

dalgona= read.csv("dalgona.csv")

Dalgona = data.frame(dalgona)

#Cleaning

corpus = iconv(dalgona$Content)

corpus = Corpus(VectorSource(corpus))

corpus = tm_map(corpus, tolower)

corpus = tm_map(corpus, removePunctuation)

corpus = tm_map(corpus, removeNumbers)


cleanset = tm_map(corpus, removeWords, stopwords('english'))
removeURL = function(x)gsub('http[[:alnum:]]*','',x)
cleanset = tm_map(cleanset, content_transformer(removeURL))
cleanset = tm_map(cleanset, stripWhitespace)


#Term Document Matrix

tdm = TermDocumentMatrix(cleanset)
tdm = as.matrix(tdm)      


tweets = iconv(dalgona$Content, to = 'UTF-8')

s = get_nrc_sentiment(tweets)

#barplot

barplot(colSums(s), las =2, col = rainbow(10), ylab ='Count', main ='Sentiment Scores for Dalgona Coffee')



  [1]: https://i.stack.imgur.com/azd95.jpg
评论