corpora2list: Corpora into list and back to corpora

View source: R/utils_for_tm.R

corpora2listR Documentation

Corpora into list and back to corpora

Description

These functions are useful to create a list of documents from a VCorpus object (corpora2list) saving all the information to came back to the original structure (list2corpora).

Usage

corpora2list(corpora)

list2corpora(corpora_list)

Arguments

corpora

A VCorpus

corpora_list

A corpora_list object

Details

The aims is to provide a suitable input to function optimizated to used list objects to manage the content of the documents, and next to come back to the original structure of VCorpus.

Value

corpora2list returns a List of documents with metadata stored as attributes, i.e. document-specific metadata are stored in a list attribute named "metadata" of length equal of the lenght of the corpora; the dmeta corpora-specific metadata are stored in an attribute named "dmeta".

list2corpora returns a VCorpus.

Functions

  • corpora2list: Create a corpora_list object from a corpora.

  • list2corpora: Recreate a corpora from a corpora_list object.

Examples


data(liu_4h28)
corpora  <- data2corpus(liu_4h28)
doc_list <- corpora2list(corpora)

corpora_back <- list2corpora(doc_list)

UBESP-DCTV/costumer documentation built on Feb. 1, 2023, 4:52 a.m.