matrix: Term

您所在的位置:网站首页 r语言removesparseterms matrix: Term

matrix: Term

2024-02-06 21:12| 来源: 网络整理| 查看: 265

In tm: Text Mining Package

Description Usage Arguments Value See Also Examples

Description

Constructs or coerces to a term-document matrix or a document-term matrix.

Usage 1 2 3 4TermDocumentMatrix(x, control = list()) DocumentTermMatrix(x, control = list()) as.TermDocumentMatrix(x, ...) as.DocumentTermMatrix(x, ...) Arguments x

a corpus for the constructors and either a term-document matrix or a document-term matrix or a simple triplet matrix (package slam) or a term frequency vector for the coercing functions.

control

a named list of control options. There are local options which are evaluated for each document and global options which are evaluated once for the constructed matrix. Available local options are documented in termFreq and are internally delegated to a termFreq call.

This is different for a SimpleCorpus. In this case all options are processed in a fixed order in one pass to improve performance. It always uses the Boost (https://www.boost.org) Tokenizer (via Rcpp) and takes no custom functions as option arguments.

Available global options are:

bounds

A list with a tag global whose value must be an integer vector of length 2. Terms that appear in less documents than the lower bound bounds$global[1] or in more documents than the upper bound bounds$global[2] are discarded. Defaults to list(global = c(1, Inf)) (i.e., every term will be used).

weighting

A weighting function capable of handling a TermDocumentMatrix. It defaults to weightTf for term frequency weighting. Available weighting functions shipped with the tm package are weightTf, weightTfIdf, weightBin, and weightSMART.

...

the additional argument weighting (typically a WeightFunction) is allowed when coercing a simple triplet matrix to a term-document or document-term matrix.

Value

An object of class TermDocumentMatrix or class DocumentTermMatrix (both inheriting from a simple triplet matrix in package slam) containing a sparse term-document matrix or document-term matrix. The attribute weighting contains the weighting applied to the matrix.

See Also

termFreq for available local control options.

Examples 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20data("crude") tdm


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3