![](/img/trans.png)
[英]R text mining package: Allowing to incorporate new documents into an existing corpus
[英]R text mining package updating the corpus by modifying or deleting existing documents
我想通过做这样简单的事情来修改由语料库索引的现有文档
myCorpus[[10]] = "hey I am the new content of this document"
这有效吗?
目前尚不清楚你想对你的语料库做什么。 附加你的语料库或修改第10个元素?
我想说,作为一种语法,它是正确的,但语义是错误的。
从概念上讲,语料库是元数据和TextDocument列表。 因此,您可以使用'[['或'$'作为任何R列表访问此列表。
所以,如果你这样做(最好使用< - than =甚至在这里它们是等价的)
myCorpus[[10]] <- "hey I am the new content of this document"
这将创建或更改第10个元素,但类字符元素不是TextDocument 。 所以你不能在课堂上应用使用方法
所以要更新10个文本文档的内容:
Content(myCorpus[[10]]) <- "hey I am the new content of this document"
要创建新元素,请使用:
tmUpdate(ovid, DirSource(txt))
将检查源是否存在文档集中尚不存在的新文件。 被解析并添加到现有文档集合中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.