如何将列表转换为R中的语料库? [英] How transform a list into a corpus in r?
问题描述
In this question I asked how to split a huge dataframe to create a corpus. Thanks to the answer I was able to create a list from a dataframe. My problem was still obtaining a corpus from the list I created in order to do some text mining and cluster the data according to the search term.
推荐答案
为解决此问题,我将tm包的as.VCorpus函数应用于我之前创建的列表:
To solve this problem I just applied the as.VCorpus function of the tm package to the list I created before:
new_corpus <- as.VCorpus(new_list)
检查新对象是否为语料库:
Check if the new object is a corpus:
class(new_corpus)
[1] "VCorpus" "Corpus"
因此,我创建了一个易失性语料库".如R文档中所述:
I thus created a "volatile corpus". As written in the R documentation:
易失性语料库已完全保留在内存中,因此所有更改仅影响相应的R对象.
A volatile corpus is fully kept in memory and thus all changes only affect the corresponding R object.
这篇关于如何将列表转换为R中的语料库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!