一个希望很简单的问题。如何保存以下代码的 ngram 输出?
\
library("quanteda")
## Package version: 2.1.2
data(data_corpus_inaugural)
toks <- data_corpus_inaugural %>%
tokens(remove_punct = TRUE,
remove_symbol = TRUE,
padding = TRUE) %>%
tokens_tolower()
tokens <- dfm(toks)
toks <- my_corpus %>%
tokens(remove_punct = TRUE,
remove_symbol = TRUE,
padding = TRUE)
toks_ngram <- tokens_ngrams(toks, n = 2:7)
\
您可以将其保存为rds对象
saveRDS(toks_ngram, "toks_ngram.rds")