text2vec (version 0.4.0)

get_tf: Term-frequency scaling matrix

Description

This function creates a term-frequency (TF) scaling matrix from a document-term matrix.

Usage

get_tf(dtm, norm = c("l1", "l2"))

Arguments

dtm

a document-term matrix of class dgCMatrix or dgTMatrix.

norm

character the method used to normalize term vectors. "l1" by default, i.e., scale by the number of words in the document.

Value

ddiMatrix TF scaling diagonal sparse matrix.

See Also

get_idf, get_dtm, create_dtm