私は、「kind」と「Kindertoekomst」を含むコーパス内のすべての単語を置き換えたいと思います。私は正常にそれをすることができます:R:データマイニング。部分文字列を含む単語の置換
Woorden<-c("kinderen", "kleinkind")
Woorden[grepl("kind", Woorden)]<-"Kindertoekomst"
しかし、私はコーパス内でそれをしたいと思います。
私は
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)
エラー:(DOC、 "TextDocument")を継承TRUE
ではありませんおよび corpus_clean < - tm_map(docs、content_transformer(tolower)) UseMethod( "content"、x)のエラー: 「コンテンツ」の該当メソッドがクラス「文字」
のオブジェクトに適用されていない私を助けてください:)