Learn R Programming

polmineR (version 0.7.0)

context: Analyze context of a node word

Description

Retrieve the word context of a token, checking for the boundaries of a XML region. For formulating the query, CPQ syntax may be used (see examples). Statistical tests available are log-likelihood, t-test, pmi.

Usage

"context"(.Object, query, cqp = is.cqp, pAttribute = getOption("polmineR.pAttribute"), sAttribute = NULL, left = getOption("polmineR.left"), right = getOption("polmineR.right"), stoplist = NULL, positivelist = NULL, count = TRUE, method = "ll", mc = getOption("polmineR.mc"), verbose = TRUE, progress = FALSE)
"context"(.Object, ...)
"context"(.Object, pAttribute = getOption("polmineR.pAttribute"), ...)
"context"(.Object, query, verbose = TRUE, ...)
"context"(.Object, query, complete = FALSE)

Arguments

.Object
a partition or a partitionBundle object
query
query, which may by a character vector or a cqpQuery object
cqp
defaults to is.cqp-function, or provide TRUE/FALSE
pAttribute
p-attribute of the query
sAttribute
if provided, it will be checked that cpos do not extend beyond the region defined by the s-attribute
left
no of tokens and to the left of the node word
right
no of tokens to the right of the node word
stoplist
exclude a query hit from analysis if stopword(s) is/are in context
positivelist
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)
count
logical
method
either "LL" (default) or "pmi", if NULL, calculating the statistics will be skipped
mc
whether to use multicore; if NULL (default), the function will get the value from the options
verbose
report progress, defaults to TRUE
progress
logical, whether to show progress bar
...
further parameters
complete
enhance completely

Value

depending on whether a partition or a partitionBundle serves as input, the return will be a context object, or a contextBundle object

Examples

Run this code
## Not run: 
#   use("polmineR.sampleCorpus")
#   p <- partition("PLPRBTTXT", list(text_type="speech"))
#   a <- context(p, query="Integration", pAttribute="word")
# ## End(Not run)

Run the code above in your browser using DataLab