Retrieve the word context of a token, optionally checking for boundaries of a XML region.
# S4 method for partition
context(.Object, query, cqp = is.cqp,
left = getOption("polmineR.left"), right = getOption("polmineR.right"),
pAttribute = getOption("polmineR.pAttribute"), sAttribute = NULL,
stoplist = NULL, positivelist = NULL, count = TRUE,
mc = getOption("polmineR.mc"), verbose = TRUE, progress = FALSE)# S4 method for character
context(.Object, query,
pAttribute = getOption("polmineR.pAttribute"), ...)
# S4 method for partitionBundle
context(.Object, query, verbose = TRUE, ...)
# S4 method for cooccurrences
context(.Object, query, complete = FALSE)
# S4 method for Corpus
cooccurrences(.Object, query,
pAttribute = getOption("polmineR.pAttribute"), ...)
a partition or a partitionBundle object
query, which may by a character vector or a cqpQuery object
defaults to is.cqp-function, or provide TRUE/FALSE
no of tokens and to the left of the node word
no of tokens to the right of the node word
p-attribute of the query
if provided, it will be checked that cpos do not extend beyond the region defined by the s-attribute
exclude a query hit from analysis if stopword(s) is/are in context
character vector or numeric vector: include a query hit only if token in positivelist is present. If positivelist is a character vector, it is assumed to provide regex expressions (incredibly long if the list is long)
logical
whether to use multicore; if NULL (default), the function will get the value from the options
report progress, defaults to TRUE
logical, whether to show progress bar
further parameters
enhance completely
depending on whether a partition or a partitionBundle serves as input, the return will be a context object, or a contextBundle object
For formulating the query, CPQ syntax may be used (see examples). Statistical tests available are log-likelihood, t-test, pmi.
# NOT RUN {
use("polmineR.sampleCorpus")
p <- partition("PLPRBTTXT", list(text_type="speech"))
a <- context(p, query="Integration", pAttribute="word")
# }
Run the code above in your browser using DataLab