build_structure_for_list: Build Data Structure for a List of Corpus Objects

Description Usage Arguments Value Author(s) See Also Examples

View source: R/build_structure_for_list.R

Description

Builds a structure for a list of Corpus Objects. The structure is based on the structKey given with the default being a Term Frequency Matrix

Usage

1
build_structure_for_list(structKey = "tf", corpusList = NULL, tokenizer)

Arguments

structKey

key of structure to be generated Possible Values are: "tf" for Term frequency Matrix "dtm" for DocumentTermMatrix (tm Package Object) "m" for a Matrix of terms "v" for a sorted Vector of terms "tfidf" for a term frequency inverse document frequency Matrix

corpusList

a List of VCorpus which generate from tm package: c(VCorpus1, ..., VCorpusN)

tokenizer

tokenizer based on the RWeka Package

Value

List of given data structure

Author(s)

MFinst

See Also

tm Package for VCorpus

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (structKey = "tf", corpusList = NULL, tokenizer)
{
    if (is.null(corpusList)) {
        print("corpus is NULL!")
        return(NULL)
    }
    structureCount = length(corpusList)
    result_structList = list()
    for (i in 1:structureCount) {
        struct = matrix_gen(corpus = corpusList[[i]], struct = structKey,
            dtmTokenizer = tokenizer)
        result_structList[[i]] = struct
        print(paste(i, " struct calculated"))
    }
    return(result_structList)
  }

mfinst/TM-CoCit-Support-FM documentation built on March 4, 2020, 8:38 p.m.