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

匆匆过客 提交于 2019-12-08 09:07:30

问题


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?


回答1:


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)

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.



来源:https://stackoverflow.com/questions/28377646/how-to-reconnect-to-the-pcorpus-in-the-r-tm-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!