# NOT RUN {
tokens = tokens_spacy[tokens_spacy$doc_id == 'text3',]
# }
# NOT RUN {
if (interactive()) plot_tree(tokens, token, pos)
## plot with annotations
direct = tquery(label = 'verb', pos = 'VERB', fill=FALSE,
children(label = 'subject', relation = 'nsubj'),
children(label = 'object', relation = 'dobj'))
passive = tquery(label = 'verb', pos = 'VERB', fill=FALSE,
children(label = 'subject', relation = 'agent'),
children(label = 'object', relation = 'nsubjpass'))
if (interactive()) {
tokens %>%
annotate_tqueries('clause', pas=passive, dir=direct) %>%
plot_tree(token, pos, annotation='clause')
}
# }
Run the code above in your browser using DataLab