如何重新连接到 R tm 包中的 PCorpus? [英] How to reconnect to the PCorpus in the R tm package?

查看:26
本文介绍了如何重新连接到 R tm 包中的 PCorpus?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I create a PCorpus, which as far as I understand is stored on HDD, with the following code:

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

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

How may I reconnect to that database later?

推荐答案

据我所知,你不能.数据库"实际上是一个文件哈希对象,您可以按如下方式重新连接和加载,

You can't as far as I'm aware. The 'database' is actually a filehash object, which you can reconnect to and load as follows,

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

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

but it loads each file as it's own object. You need to save to disk explicitly using writeCorpus and reload with a call to PCorpus each time. The PCorpus object just provides a way of creating a Corpus object to disk rather than memory.

这篇关于如何重新连接到 R tm 包中的 PCorpus?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆