tc_plot_tree: Visualize a dependency tree

View source: R/rsyntax_convenience.r

tc_plot_treeR Documentation

Visualize a dependency tree

Description

A wrapper for the plot_tree function, that can be used directly on a tCorpus.

Usage

tc_plot_tree(
  tc,
  ...,
  annotation = NULL,
  sentence_i = 1,
  doc_id = NULL,
  pdf_file = NULL
)

Arguments

tc

a tCorpus

...

Arguments passed to plot_tree. Most importantly, this is used to select which specific columns to display on the bottom rows. For instance, tc_plot_tree(tc, token, lemma, POS) shows only these three columns.

annotation

Optionally, the name of a column with an rsyntax annotation.

sentence_i

By default, plot_tree uses the first sentence (sentence_i = 1) in the data. sentence_i can be changed to select other sentences by position (the i-th unique sentence in the data). Note that sentence_i does not refer to the values in the sentence column (for this use the sentence argument together with doc_id)

doc_id

Optionally, the document id can be specified. If so, sentence_i refers to the i-th sentence within the given document.

pdf_file

Directly save the plot as a pdf file

Value

plots a dependency tree.

Examples

if (interactive()) 
  tc_plot_tree(tc_sotu_udpipe, token, lemma, POS)

corpustools documentation built on May 31, 2023, 8:45 p.m.