wTfIdf: Internal Supreme function

Description Usage Arguments Details Value Note Examples

Description

Weight a document-term matrix by term frequency - inverse document frequency.

Usage

1
wTfIdf(dtm, normalize = TRUE)

Arguments

dtm

a document-term matrix in term frequency format.

normalize

a Boolean value indicating whether the tf-idf scores should be normalized. Default is TRUE.

Details

In order for the weights to fall in the [0, 1] interval and for the documents to be represented by vectors of equal length, the weights are normalized by cosine normalization.

Value

The weighted document-term matrix.

Note

This function is slightly different from weightTfIdf in the package tm because of the different normalization approach.

Examples

1
2
3
4
5
6
## Not run: 
library(Supreme)
data("dtm")
dtm_normalized <- wTfIdf(dtm, normalize = TRUE)

## End(Not run)

paolofantini/Supreme documentation built on May 24, 2019, 6:14 p.m.