Dtm2Lexicon: Turn a document term matrix into a list for LDA Gibbs...

View source: R/topic_modeling_core.R

Dtm2LexiconR Documentation

Turn a document term matrix into a list for LDA Gibbs sampling

Description

Represents a document term matrix as a list.

Usage

Dtm2Lexicon(dtm, ...)

Arguments

dtm

A document term matrix (or term co-occurrence matrix) of class dgCMatrix.

...

Other arguments to be passed to TmParallelApply.

Value

Returns a list. Each element of the list represents a row of the input matrix. Each list element contains a numeric vector with as many entries as tokens in the original document. The entries are the column index for that token, minus 1.

Examples

## Not run: 
# Load pre-formatted data for use
data(nih_sample_dtm)

result <- Dtm2Lexicon(dtm = nih_sample_dtm, 
                      cpus = 2)

## End(Not run)

TommyJones/textmineR documentation built on July 26, 2023, 9:51 p.m.