Learn R Programming

polmineR (version 0.6.1)

cpos: get corpus positions

Description

If the cpos-method isapplied on "character", "partition", or "tempcorpus" object, the result is a two-column matrix with the start end end corpus positions of the matches for a query (CQP syntax can be used.) If the cpos-method is called on a "matrix" object, the cpos matrix is unfolded.

Usage

cpos(.Object, ...)
"cpos"(.Object, query, pAttribute = getOption("polmineR.pAttribute"), encoding = NULL, verbose = TRUE)
"cpos"(.Object, query, pAttribute = NULL, verbose = TRUE)
"cpos"(.Object, query, shift = TRUE)
"cpos"(.Object)

Arguments

.Object
a "character" vector indicating a CWB corpus, a "partition" object, a "tempcorpus" object, or a "matrix" with corpus positions
...
further arguments
query
a character vector (length 1) providing a (single) query: either a single token to look up, or a CQP query.
pAttribute
the p-attribute to search. Needs to be stated only if query is not a CQP query. Defaults to NULL.
encoding
the encoding of the corpus (if NULL, the encoding provided in the registry file of the corpus will be used)
verbose
logical, whether to be talkative
shift
logical, if true, the cpos resulting from the query performed on the tempcorpus will be shifted so that they match the positions of the corpus from which the tempcorpus was generated

Value

Unless .Object is a "matrix", you get a matrix with two columns, the first column giving the start cpos of the hits obtained, the second column giving the end cpos of the respective hit. The number of rows is the number of hits. If there are no hits, a NULL object will be returned.