tree_structure: Show the structure of s-attributes

tree_structureR Documentation

Show the structure of s-attributes

Description

Show the structure of s-attributes. If x is a subcorpus, the s-attribute used for corpus subsetting is highlighted.

Usage

tree_structure(x, ...)

## S4 method for signature 'xml_node'
tree_structure(x, s_attribute = NULL, prefix = 0, indent = 3, root = TRUE)

## S4 method for signature 'xml_document'
tree_structure(x, s_attribute = NULL, prefix = 0, indent = 3, root = TRUE)

## S4 method for signature 'subcorpus'
tree_structure(x)

## S4 method for signature 'corpus'
tree_structure(x, s_attribute = NULL)

Arguments

x

Object for which to visualise structure.

...

Further arguments.

s_attribute

Name of the s-attribute used for subsetting, will be highlighted.

prefix

Number of blank spaces.

indent

Number of spaces to indent.

root

Whether branch is root.

Examples

xml_sample <- system.file(
  package = "GermaParl2",
  "extdata", "cwb", "indexed_corpora",
  "germaparl2mini"
)
if (nchar(xml_sample) > 0L && interactive()){
  use(pkg = "GermaParl2", corpus = "GERMAPARL2MINI")
  
  corpus("GERMAPARL2MINI") %>%
    tree_structure()
    
  corpus("GERMAPARL2MINI") %>%
    subset(speaker_name == "Konrad Adenauer") %>%
    tree_structure()
 
  corpus("GERMAPARL2MINI") %>%
    subset(speaker_name == "Konrad Adenauer") %>%
    subset(p) %>%
    tree_structure()
  
  corpus("GERMAPARL2MINI") %>%
    subset(ne_type) %>%
    tree_structure()
}

polmineR documentation built on Nov. 2, 2023, 5:52 p.m.