doc_to_tdm: Convert list of documents to sparse term-document matrix

Description Usage Arguments See Also Examples

View source: R/doc_to_tdm.R

Description

doc_to_tdm converts list of documents from stm package prepDocuments function to a sparse term-document matrix.

Usage

1
doc_to_tdm(out, binary = TRUE)

Arguments

out

A list of the output from stm prepDocuments.

binary

A logical scalar. If TRUE (default) then only count one occurrence of a word in a document.

See Also

prepDocuments, textProcessor, scale_text, read_word_embeddings, get_keywords, plot_keywords, score_documents

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
library(stm)

processed <- textProcessor(
    input_data$text,
    data.frame(input_data),
    removestopwords=T, lowercase=T, stem=F
    )
out <- prepDocuments(
    processed$documents, processed$vocab, processed$meta
    )

tdm <- doc_to_tdm(out)

## End(Not run)

wilryh/parrot documentation built on Jan. 9, 2020, 2:16 p.m.