如何解决为什么这些停用词没有从我的数据中删除?
数据的标记化
tidy_text <- data %>%
unnest_tokens(word,q_content)
去除停用词
data("stop_words")
stop_words
tidy_text <- tidy_text %>% anti_join(stop_words,by ="word")
tidy_text %>% count(word,sort = TRUE)
输出包括最重要的 10 个单词
1 im 13012
2 dont 11197
3 feel 9168
4 time 6697
5 life 4464
6 ive 4403
7 people 4233
8 told 4150
9 friends 4045
10 love 3281
解决方法
正如@Maurits Evers 所解释的那样,您数据中的词与 stop_words
不完全匹配。在加入之前,您可以从 '
中的单词中删除 stop_words
。试试:
library(dplyr)
tidy_text <- tidy_text %>%
anti_join(stop_words %>%
mutate(word = gsub("'","",word)),by ="word")
tidy_text %>% count(word,sort = TRUE)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。