Represent documents as a matrix of word counts.

document_term_matrix(corpus)

# S3 method for corpus
document_term_matrix(corpus)

Arguments

corpus

A corpus, as returned vy corpus.

Examples

# NOT RUN {
init_textanalysis()

# build document
doc1 <- string_document("First document.")
doc2 <- string_document("Second document.")

corpus <- corpus(doc1, doc2)

update_lexicon(corpus)
m <- document_term_matrix(corpus)
# }