[英]Remove specific words from a corpus
After this process how is it possible to remove specific words from myDfm corpus?在此过程之后,如何从 myDfm 语料库中删除特定单词?
dflemma <-
spacy_parse(structure(df2$term, names = df2$id), lemma = TRUE, pos = FALSE) %>%
group_by(id = sub("(.+)-(.+)", "\\1", doc_id)) %>%
summarise(text = paste(lemma, collapse = " "))
myCorpus <- corpus(dflemma[["text"]], docnames = dflemma[["id"]])
mystopwords <- c("can")
myDfm <- myCorpus %>%
tokens(remove_punct = TRUE, remove_numbers = TRUE, remove_symbols = TRUE) %>%
tokens_remove(pattern = c(stopwords(source = "smart"), mystopwords)) %>%
dfm(verbose = FALSE)
You want你要
dfm_remove(myDfm, pattern = words_to_remove)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.