context {polmineR} | R Documentation |
Analyze context of a node word.
Description
Retrieve the word context of a token, optionally checking for boundaries of a XML region.
Usage
context(.Object, ...)
## S4 method for signature 'slice'
context(
.Object,
query,
cqp = is.cqp,
check = TRUE,
left = getOption("polmineR.left"),
right = getOption("polmineR.right"),
p_attribute = getOption("polmineR.p_attribute"),
region = NULL,
boundary = NULL,
stoplist = NULL,
positivelist = NULL,
regex = FALSE,
count = TRUE,
mc = getOption("polmineR.mc"),
verbose = FALSE,
progress = TRUE,
...
)
## S4 method for signature 'partition'
context(
.Object,
query,
cqp = is.cqp,
check = TRUE,
left = getOption("polmineR.left"),
right = getOption("polmineR.right"),
p_attribute = getOption("polmineR.p_attribute"),
region = NULL,
boundary = NULL,
stoplist = NULL,
positivelist = NULL,
regex = FALSE,
count = TRUE,
mc = getOption("polmineR.mc"),
verbose = FALSE,
progress = TRUE,
...
)
## S4 method for signature 'subcorpus'
context(
.Object,
query,
cqp = is.cqp,
check = TRUE,
left = getOption("polmineR.left"),
right = getOption("polmineR.right"),
p_attribute = getOption("polmineR.p_attribute"),
region = NULL,
boundary = NULL,
stoplist = NULL,
positivelist = NULL,
regex = FALSE,
count = TRUE,
mc = getOption("polmineR.mc"),
verbose = FALSE,
progress = TRUE,
...
)
## S4 method for signature 'matrix'
context(
.Object,
corpus,
registry = Sys.getenv("CORPUS_REGISTRY"),
left,
right,
p_attribute,
region = NULL,
boundary = NULL
)
## S4 method for signature 'corpus'
context(
.Object,
query,
cqp = is.cqp,
p_attribute = getOption("polmineR.p_attribute"),
region = NULL,
boundary = NULL,
left = getOption("polmineR.left"),
right = getOption("polmineR.right"),
stoplist = NULL,
positivelist = NULL,
regex = FALSE,
count = TRUE,
mc = getOption("polmineR.mc"),
verbose = FALSE,
progress = TRUE,
...
)
## S4 method for signature 'character'
context(
.Object,
query,
cqp = is.cqp,
p_attribute = getOption("polmineR.p_attribute"),
region = NULL,
boundary = NULL,
left = getOption("polmineR.left"),
right = getOption("polmineR.right"),
stoplist = NULL,
positivelist = NULL,
regex = FALSE,
count = TRUE,
mc = getOption("polmineR.mc"),
verbose = FALSE,
progress = TRUE,
...
)
## S4 method for signature 'partition_bundle'
context(
.Object,
query,
p_attribute,
stoplist = NULL,
positivelist = NULL,
regex = FALSE,
verbose = TRUE,
...
)
## S4 method for signature 'cooccurrences'
context(.Object, query, check = TRUE, complete = FALSE)
Arguments
.Object |
a partition or a partition_bundle object |
... |
Further parameters. |
query |
A query, which may by a character vector or a CQP query. |
cqp |
defaults to is.cqp-function, or provide TRUE/FALSE |
check |
A |
left |
A single |
right |
A single |
p_attribute |
The p-attribute of the query. |
region |
An s-attribute, given by a length-one |
boundary |
If provided, a length-one character vector specifying a s-attribute. It will be checked that corpus positions do not extend beyond the region defined by the s-attribute. |
stoplist |
Exclude match for query if stopword(s) is/are are present in context. See positivelist for further explanation. |
positivelist |
A |
regex |
A |
count |
logical |
mc |
Whether to use multicore; if |
verbose |
Report progress? A |
progress |
A |
corpus |
A length-one |
registry |
The registry directory with the registry file for |
complete |
enhance completely |
Details
For formulating the query, CPQ syntax may be used (see examples). Statistical tests available are log-likelihood, t-test, pmi.
If .Object
is a matrix
, the context
-method will call
RcppCWB::region_matrix_context()
, the worker behind the
context()
-method.
Value
depending on whether a partition
or a partition_bundle
serves as
input, the return will be a context object, or a context_bundle
object.
Note that the number of objects in the context_bundle
may differ from the
number of objects in the input bundle
object: NULL
objects that result
if no hit is obtained are dropped.
Author(s)
Andreas Blaette
Examples
use("polmineR")
p <- partition("GERMAPARLMINI", interjection = "speech")
y <- context(p, query = "Integration", p_attribute = "word")
y <- context(p, query = "Integration", p_attribute = "word", positivelist = "Bildung")
y <- context(
p, query = "Integration", p_attribute = "word",
positivelist = c("[aA]rbeit.*", "Ausbildung"), regex = TRUE
)