Learn R Programming

polmineR (version 0.7.0)

resetRegistry: reset CORPUS_REGISTRY

Description

A utility function to reset the environment variable CORPUS_REGISTRY. That may be necessary if you want use a CWB corpus that is not stored in the usual place. In particular, resetting the environment variable is required if you want to use a corpus delivered in a R package,

Usage

resetRegistry(registryDir = NULL)
readRegistry(corpus)
parseRegistry(corpus)
parseInfoFile(corpus)

Arguments

registryDir
path to the registry directory to be used
corpus
the CWB name of the corpus

Value

the registry directory used before resetting CORPUS_REGISTRY

Details

Resetting the CORPUS_REGISTRY environment variable is achieved by unloading and reloading the C library 'rcqp' that is the backend for the rcqp package. It may not be the most artful way to do things, but it works.

To get the path to a package that contains a CWB corpus, use system.file.

Examples

Run this code
## Not run: 
# sampleCorpusPkgDir <- system.file(package="polmineR.sampleCorpus")
# sampleCorpusRegistryDir <- file.path(sampleCorpusPkgDir, "extdata", "cwb", "registry")
# oldRegistryDir <- resetRegistry(sampleCorpusRegistryDir)
# sampleCorpusPartition <- partition("PLPRBTTXT", def=list(text_id=".*"), method="grep", verbose=F)
# resetRegistry(oldRegistryDir)
# ## End(Not run)

Run the code above in your browser using DataLab