如何重新连接到 R tm 包中的 PCorpus?

How to reconnect to the PCorpus in the R tm package?

我创建了一个 PCorpus,据我所知它存储在 HDD 上,代码如下:

pc = PCorpus(vs, readerControl = list(language = "pl"), dbControl = list(dbName = "pcorpus", dbType = "DB1"))

以后如何重新连接到该数据库?

据我所知,你不能。 'database'实际上是一个filehash对象,您可以重新连接并加载,如下所示,

db <- dbInit("pcorpus")
pc<-dbLoad(db)

但它加载每个文件作为它自己的对象。您需要使用 writeCorpus 显式保存到磁盘并每次调用 PCorpus 重新加载。 PCorpus 对象只是提供了一种将 Corpus 对象创建到磁盘而不是内存的方法。