lex.div,kRp.corpus-method {tm.plugin.koRpus}R Documentation

Apply lex.div() to all texts in kRp.corpus objects

Description

This method calls lex.div on all tagged text objects inside the given txt object (using mclapply).

Usage

## S4 method for signature 'kRp.corpus'
lex.div(
  txt,
  summary = TRUE,
  mc.cores = getOption("mc.cores", 1L),
  char = "",
  quiet = TRUE,
  ...
)

Arguments

txt

An object of class kRp.corpus.

summary

Logical, determines if the summary slot should automatically be updated by calling summary on the result.

mc.cores

The number of cores to use for parallelization, see mclapply.

char

Character vector to specify measures of which characteristics should be computed, see lex.div for details.

quiet

Logical, if FALSE shows a status bar for some measures of each text, see lex.div for details.

...

options to pass through to lex.div.

Value

An object of the same class as txt.

Examples

# use readCorpus() to create an object of class kRp.corpus
# code is only run when the english language package can be loaded
if(require("koRpus.lang.en", quietly = TRUE)){
  myCorpus <- readCorpus(
    dir=file.path(path.package("tm.plugin.koRpus"), "examples", "corpus"),
    hierarchy=list(
      Topic=c(
        Winner="Reality Winner",
        Edwards="Natalie Edwards"
      ),
      Source=c(
        Wikipedia_prev="Wikipedia (old)",
        Wikipedia_new="Wikipedia (new)"
      )
    ),
    # use tokenize() so examples run without a TreeTagger installation
    tagger="tokenize",
    lang="en"
  )
  myCorpus <- lex.div(myCorpus)
  corpusSummary(myCorpus)
} else {}

[Package tm.plugin.koRpus version 0.4-2 Index]