如何保存n-gram输出

问题描述 投票:0回答:1

一个希望很简单的问题。如何保存以下代码的 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)

\

save n-gram quanteda
1个回答
0
投票

您可以将其保存为rds对象

saveRDS(toks_ngram, "toks_ngram.rds")
© www.soinside.com 2019 - 2024. All rights reserved.