我在
tidytext
包中使用停用词数据集删除停用词。我正在使用以下代码:R
最终输出如下:
library(tidyverse)
library(tidytext)
library(dplyr)
data(stop_words)
example_words <- c("the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog","i'm","don’t","it’s","i’ve")
filtered_words <- example_words[!example_words %in% stop_words$word]
filtered_words
我们可以看到像“don't”“it's”“i've”这样的停用词仍然出现在过滤后的输出中。但这些停用词实际上出现在停用词数据集中,并且不会以某种方式被删除。那么谁能帮我弄清楚为什么它不删除停用词数据集中出现的一些词?