I am working on sentiments and would like to replace the emoticons with words expressing the mood of the emoticon using qdap in R.
Can someone help me how to do it. I will further use the output to get the overall sentiment of the text.
I am working on sentiments and would like to replace the emoticons with words expressing the mood of the emoticon using qdap in R.
Can someone help me how to do it. I will further use the output to get the overall sentiment of the text.
Something like this would work:
text <- "I like :) chicken but not beef :("
library(qdapDictionaries)
mgsub(as.character(emoticon[[2]]), as.character(emoticon[[1]]), text)
## "I like Smile chicken but not beef Sad"
If I am understanding you correctly and you are talking about plain emoticons, you can just do a pattern match and replace
R> text = c(":)", ":(")
R> gsub(":)", "happy", text)
[1] "happy" ":("