context-method: Analyze context of a node word.

Description Usage Arguments Details Value Author(s) Examples

Description

Retrieve the word context of a token, optionally checking for boundaries of a XML region.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## S4 method for signature 'partition'
context(.Object, query, cqp = is.cqp,
  left = getOption("polmineR.left"), right = getOption("polmineR.right"),
  p_attribute = getOption("polmineR.p_attribute"), s_attribute = NULL,
  stoplist = NULL, positivelist = NULL, regex = FALSE, count = TRUE,
  mc = getOption("polmineR.mc"), verbose = TRUE, progress = TRUE, ...)

## S4 method for signature 'character'
context(.Object, query, cqp = is.cqp,
  p_attribute = getOption("polmineR.p_attribute"), s_attribute = NULL,
  left = getOption("polmineR.left"), right = getOption("polmineR.right"),
  stoplist = NULL, positivelist = NULL, regex = FALSE, count = TRUE,
  mc = getOption("polmineR.mc"), verbose = TRUE, progress = TRUE, ...)

## S4 method for signature 'partition_bundle'
context(.Object, query, p_attribute,
  verbose = TRUE, ...)

## S4 method for signature 'cooccurrences'
context(.Object, query, complete = FALSE)

## S4 method for signature 'Corpus'
cooccurrences(.Object, query,
  p_attribute = getOption("polmineR.p_attribute"), ...)

Arguments

.Object

a partition or a partition_bundle object

query

query, which may by a character vector or a cqpQuery object

cqp

defaults to is.cqp-function, or provide TRUE/FALSE

left

no of tokens and to the left of the node word

right

no of tokens to the right of the node word

p_attribute

p-attribute of the query

s_attribute

if provided, it will be checked that corpus positions do not extend beyond the region defined by the s-attribute

stoplist

exclude a query hit from analysis if stopword(s) is/are in context. See positivelist for further explanation.

positivelist

character vector or numeric/integer vector: include a query hit only if token in positivelist is present. If positivelist is a character vector, it may include regular expressions (see parameter regex)

regex

logical, defaults to FALSE - whether stoplist and/or positivelist are regular expressions

count

logical

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

Details

For formulating the query, CPQ syntax may be used (see examples). Statistical tests available are log-likelihood, t-test, pmi.

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

Author(s)

Andreas Blaette

Examples

1
2
3
4
5
6
7
8
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
)

polmineR documentation built on July 16, 2018, 9:04 a.m.