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

Apply clozeDelete() to all texts in kRp.corpus objects

Description

This method calls clozeDelete on all tagged text objects inside the given obj object (using mclapply).

Usage

## S4 method for signature 'kRp.corpus'
clozeDelete(obj, mc.cores = getOption("mc.cores", 1L), ...)

Arguments

obj

An object of class kRp.corpus.

mc.cores

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

...

options to pass through to clozeDelete.

Value

An object of the same class as obj.

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", "Edwards"
    ),
    hierarchy=list(
      Source=c(
        Wikipedia_prev="Wikipedia (old)",
        Wikipedia_new="Wikipedia (new)"
      )
    ),
    # use tokenize() so examples run without a TreeTagger installation
    tagger="tokenize",
    lang="en"
  )

  head(taggedText(myCorpus), n=10)
  myCorpus <- clozeDelete(myCorpus)
  head(taggedText(myCorpus), n=10)
} else {}

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