Learn R Programming

polmineR (version 0.7.9)

kwic: KWIC/concordance output.

Description

Prepare and show concordances / keyword-in-context (kwic). The same result can be achieved by applying the kwic method on either a partition or a context object.

Usage

kwic(.Object, ...)

# S4 method for context kwic(.Object, meta = getOption("polmineR.meta"), cpos = TRUE, verbose = FALSE)

# S4 method for partition kwic(.Object, query, cqp = is.cqp, left = getOption("polmineR.left"), right = getOption("polmineR.right"), meta = getOption("polmineR.meta"), p_attribute = "word", s_attribute = NULL, cpos = TRUE, stoplist = NULL, positivelist = NULL, regex = FALSE, verbose = TRUE, ...)

# S4 method for character kwic(.Object, query, cqp = is.cqp, left = as.integer(getOption("polmineR.left")), right = as.integer(getOption("polmineR.right")), meta = getOption("polmineR.meta"), p_attribute = "word", s_attribute = NULL, cpos = TRUE, stoplist = NULL, positivelist = NULL, regex = FALSE, verbose = TRUE, ...)

Arguments

.Object

a partition or context object

...

further parameters to be passed

meta

metainformation to display

cpos

logical, if TRUE, the corpus positions ("cpos") if the hits will be handed over to the kwic-object that is returned

verbose

logical, whether to be talkative

query

a query, CQP-syntax can be used

cqp

either logical (TRUE if query is a CQP query), or a function to check whether query is a CQP query or not (defaults to is.query auxiliary function)

left

to the left

right

to the right

p_attribute

p-attribute, defaults to 'word'

s_attribute

if provided, the s-attribute will be used to check the boundaries of the text

stoplist

terms or ids to prevent a concordance from occurring in results

positivelist

terms or ids required for a concordance to occurr in results

regex

logical, whether stoplist/positivelist is processed as regular expression

Details

If a positivelist ist supplied, the tokens will be highlighted.

References

Baker, Paul (2006): Using Corpora in Discourse Analysis. London: continuum, pp. 71-93 (ch. 4).

Jockers, Matthew L. (2014): Text Analysis with R for Students of Literature. Cham et al: Springer, pp. 73-87 (chs. 8 & 9).

See Also

To read the whole text, see the read-method.

Examples

Run this code
# NOT RUN {
use("polmineR")
bt <- partition("GERMAPARLMINI", def = list(date = ".*"), regex=TRUE)
kwic(bt, "Integration")
kwic(bt, "Integration", left = 20, right = 20, meta = c("date", "speaker", "party"))
kwic(
  bt, '"Integration" [] "(Menschen|Migrant.*|Personen)"',
  left = 20, right = 20,
  meta = c("date", "speaker", "party")
) 
# }

Run the code above in your browser using DataLab