dtm_lfilter: Left filter for DTMs

View source: R/dtm_lfilter.R

dtm_lfilterR Documentation

Left filter for DTMs

Description

Left filter for document-term matrix structure (as provided by tm). I.e. return a DocumentTermMatrix for the target dtm documents considering all (and only) the terms in the reference dtm, filling with zeros the terms which are not present. Final order of token are the same as in target

Usage

dtm_lfilter(target, reference)

Arguments

target

(DocumentTermMatrix) This is the dtm considered for the list of documents, i.e. the returned dtm will have the exact documents (with the same order) of this one.

reference

(DocumentTermMatrix) This is the dtm considered for the list of terms, i.e. the returned dtm will have the exact term (with the same order) of this one.

Details

This is usefull in Machine Learning, i.e. to use a machine reference-trained on the target dtm.

Value

(DocumentTermMatrix) with weights for the terms in reference and documents in target DTMs.

See Also

tm, slam

Examples

library(tm)
data(acq)
data(crude)

reference <- DocumentTermMatrix(acq)
to_adjust <- DocumentTermMatrix(crude)

dtm_lfilter(reference, to_adjust)

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