A set of functions to check whether the input values to the Rcpp wrappers for the C functions of the Corpus Workbench potentially causing crashes are valid. These auxiliary functions are called by the cl_ and cqp_ functions.

check_registry(registry)

check_corpus(corpus, registry, cl = TRUE, cqp = TRUE)

check_s_attribute(
  s_attribute,
  corpus,
  registry = Sys.getenv("CORPUS_REGISTRY")
)

check_p_attribute(
  p_attribute,
  corpus,
  registry = Sys.getenv("CORPUS_REGISTRY")
)

check_strucs(corpus, s_attribute, strucs, registry)

check_region_matrix(region_matrix)

check_query(query)

check_cpos(
  corpus,
  p_attribute = "word",
  cpos,
  registry = Sys.getenv("CORPUS_REGISTRY")
)

check_id(corpus, p_attribute, id, registry = Sys.getenv("CORPUS_REGISTRY"))

Arguments

registry

path to registry directory

corpus

name of a CWB corpus

cl

A logical value, whether CL availability of corpus is required for positive result.

cqp

A logical value, whether CQP availability of corpus is required for positive result.

s_attribute

a structural attribute

p_attribute

a positional attribute

strucs

strucs (indices of structural attributes)

region_matrix

a region matrix

query

a CQP query

cpos

vector of corpus positions

id

id (encoded p-attribute), integer value