Learn R Programming

polmineR (version 0.7.9)

s_attributes,character-method: Get s-attributes.

Description

Structural annotations (s-attributes) of a corpus provide metainformation for regions of tokens. Gain access to the s-attributes available for a corpus or partition, or the values of s-attributes in a corpus/partition with the s_attributes-method.

Usage

# S4 method for character
s_attributes(.Object, s_attribute = NULL,
  unique = TRUE, regex = NULL, ...)

# S4 method for partition s_attributes(.Object, s_attribute = NULL, unique = TRUE, ...)

Arguments

.Object

either a partition object or a character vector specifying a CWB corpus

s_attribute

name of a specific s-attribute

unique

logical, whether to return unique values only

regex

filter return value by applying a regex

...

to maintain backward compatibility, of argument sAttribute is used

Value

a character vector

Details

Importing XML into the Corpus Workbench (CWB) turns elements and element attributes into so-called s-attributes. There are two uses of the s_attributes-method: If the s_attribute parameter is NULL (default), the return value is a character vector with all s-attributes present in a corpus.

If s_attribute is the name of a specific s-attribute (a length 1 character vector), the values of the s-attributes available in the corpus/partition are returned.

If a character vector of s-attributes is provided, the method will return a data.table.

Examples

Run this code
# NOT RUN {
use("polmineR")
  
s_attributes("GERMAPARLMINI")
s_attributes("GERMAPARLMINI", "date") # dates of plenary meetings
  
P <- partition("GERMAPARLMINI", date = "2009-11-10")
s_attributes(P)
s_attributes(P, "speaker") # get names of speakers
# }

Run the code above in your browser using DataLab