【发布时间】:2017-04-22 17:05:59
【问题描述】:
我想将语料库中包含“kind”的每个单词都替换为“Kindertoekomst”。我可以正常做:
Woorden<-c("kinderen", "kleinkind")
Woorden[grepl("kind", Woorden)]<-"Kindertoekomst"
但我想在我的 Corpus 中进行。
我设法用
做到了这一点Kind<-grepl("kind", Woorden)
docs <- tm_map(docs, function(x) stri_replace_all_fixed(x, Woorden[as.logical(Kind)], "kindertoekomst", vectorize_all = FALSE))
但是我不能再使用其他功能了:
dtm <- DocumentTermMatrix(docs)
错误:inherits(doc, "TextDocument") 不是 TRUE
并且 corpus_clean
请帮帮我:)
【问题讨论】:
标签: r string replace text-mining tm