WeightFunction: Weighting Function

Description Usage Arguments Value Examples

View source: R/weight.R

Description

Construct a weighting function for term-document matrices.

Usage

1
WeightFunction(x, name, acronym)

Arguments

x

A function which takes a TermDocumentMatrix with term frequencies as input, weights the elements, and returns the weighted matrix.

name

A character naming the weighting function.

acronym

A character giving an acronym for the name of the weighting function.

Value

An object of class WeightFunction which extends the class function representing a weighting function.

Examples

1
2
weightCutBin <- WeightFunction(function(m, cutoff) m > cutoff,
                               "binary with cutoff", "bincut")

Example output

Loading required package: NLP

tm documentation built on Nov. 18, 2020, 5:07 p.m.