Learn R Programming

polmineR (version 0.7.8)

sAttributes,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 sAttributes-method.

Usage

# S4 method for character
sAttributes(.Object, sAttribute = NULL, unique = TRUE,
  regex = NULL)

# S4 method for partition sAttributes(.Object, sAttribute = NULL, unique = TRUE)

Arguments

.Object

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

sAttribute

name of a specific s-attribute

unique

logical, whether to return unique values only

regex

filter return value by applying a regex

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 sAttributes-method: If the sAttribute parameter is NULL (default), the return value is a character vector with all s-attributes present in a corpus.

If sAttribute 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")
  
  sAttributes("GERMAPARLMINI")
  sAttributes("GERMAPARLMINI", "date") # dates of plenary meetings
  
  
  P <- partition("GERMAPARLMINI", date = "2009-11-10")
  sAttributes(P)
  sAttributes(P, "speaker") # get names of speakers
# }

Run the code above in your browser using DataLab