textplot_dependencyparser: Plot output of a dependency parser

View source: R/textplot_dependencies.R

textplot_dependencyparserR Documentation

Plot output of a dependency parser

Description

Plot output of a dependency parser. This plot takes one sentence and shows for the sentence, the words, the parts of speech tag and the dependency relationship between the words.

Usage

textplot_dependencyparser(x, ...)

## Default S3 method:
textplot_dependencyparser(
  x,
  title = "Dependency Parser",
  subtitle = "tokenisation, parts of speech tagging & dependency relations",
  vertex_color = "darkgreen",
  edge_color = "red",
  size = 3,
  base_family = "",
  layout = "linear",
  ...
)

Arguments

x

a data.frame as returned by a call to udpipe containing 1 sentence

...

not used yet

title

character string with the title to use in the plot

subtitle

character string with the title to use in the plot

vertex_color

character with the color of the label of each node. Defaults to darkgreen.

edge_color

character with the color of the edges between the nodes. Defaults to red.

size

size of the labels in the plot. Defaults to 3.

base_family

character passed on to theme_void setting the base font family

layout

the type of layout, defaults to 'linear', passed on to ggraph

Value

an object of class ggplot

See Also

udpipe

Examples


library(udpipe)
library(ggraph)
library(ggplot2)
library(igraph)

x <- udpipe("The economy is weak but the outlook is bright", "english")
textplot_dependencyparser(x)

x <- udpipe("His speech about marshmallows in New York is utter bullshit", "english")
textplot_dependencyparser(x, size = 4)

x <- udpipe("UDPipe provides tokenization, tagging, lemmatization and
             dependency parsing of raw text", "english")
textplot_dependencyparser(x, size = 4)


data("example_udpipe", package = "textplot")
textplot_dependencyparser(example_udpipe, size = 4)



textplot documentation built on July 18, 2022, 1:05 a.m.