tf_normalizator: Term Frequencies Normalizator for Document-Term Matrices

View source: R/tf_normalizator.R

tf_normalizatorR Documentation

Term Frequencies Normalizator for Document-Term Matrices

Description

The aims of this function is to normalize the term frequencies in a document-term frequencies, i.e. each frequencies of each documents in the matrix is divided by the sum of all the frequencies of the terms in the document. a

Usage

tf_normalizator(dtm, force = FALSE)

Arguments

dtm

A DocumentTermMatrix filled with the simple term-frequencies weights

force

(lgl) if TRUE (default is FALSE) the function works also for simple_triplet_matrix which are not DocumentTermMatrix

Value

A DocumentTermMatrix for wich the sum of the frequencies of each document is 1 (or 0 if it is an empty one)

Examples

data(liu_dtm)
tf_normalizator(liu_dtm)

UBESP-DCTV/costumer documentation built on Feb. 1, 2023, 4:52 a.m.