如何将 R 语料库保存到磁盘 [英] How to save an R Corpus to disk

查看:38
本文介绍了如何将 R 语料库保存到磁盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大型 R 语料库对象,使用 tm 包,由数百万个小文档组成.

I have a large R Corpus object, using the tm package, made up of millions of small documents.

如何将其作为单个文本文件保存到磁盘以供其他程序(例如 word2vec)使用?

How do I save that to disk as a single text file for use with other programs (such as word2vec)?

我试过了

writeCorpus(myCorpus)

但是那写出了一百万个小文本文件,炸毁了我的 Mac!

but that wrote out a million tiny text files that blew up my Mac!

我对 R 不是很精通,所以任何关于如何做到这一点的帮助都会非常感谢.谢谢!

I'm not very proficient in R, so any help on how to do this would be much, much appreciated. Thank you!

推荐答案

尝试:

writeLines(as.character(mycorpus), con="mycorpus.txt")

但是我不知道处理一百万个文档是否会有效

But I don't know if it will be efficient with a million documents

这篇关于如何将 R 语料库保存到磁盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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