我正在尝试从保存在文本文件中的文本中删除停用词(大小为500 KB)。即使在多次使用指令之后以及在删除标点,数字等每次操作之后,我仍然会在单词云中看到停用词。有没有人遇到过同样的问题?有没有解决方法,或者我做错了什么,请指教。这是代码
library(tm)
library(wordcloud)
lords <- Corpus (DirSource('searsoutlet/'))
lords <- tm_map(lords, removeWords, stopwords('english'))
lords <- tm_map(lords, content_transformer(tolower))
lords <- tm_map(lords, removeWords, stopwords('english'))
#wordcloud(lords, scale=c(4,0.5), max.words=100, random.order=1, rot.per=0.35, use.r.layout=FALSE, colors=brewer.pal(10, 'Dark2'))
lords <- tm_map(lords, stripWhitespace)
lords <- tm_map(lords, removeWords, stopwords('english'))
lords <- tm_map(lords,removePunctuation)
lords <- tm_map(lords, removeWords, stopwords('english'))
lords <- tm_map(lords,removeNumbers)
lords <- tm_map(lords, removeWords, stopwords('english'))