Learn R Programming

textplot (version 0.2.2)

textplot_dependencyparser: 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, ...)

# S3 method for default 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", ... )

Value

an object of class ggplot

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

See Also

udpipe

Examples

Run this code
# \dontshow{
if(require(udpipe) && require(ggraph) && require(ggplot2) && require(igraph))
{
# }
library(udpipe)
library(ggraph)
library(ggplot2)
library(igraph)
# \donttest{
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)

# \dontshow{
}
# End of main if statement running only if the required packages are installed
# }

Run the code above in your browser using DataLab