# NOT RUN {
tokens = tokens_spacy[tokens_spacy$doc_id == 'text3',]
## two simple example tqueries
passive = tquery(pos = "VERB*", label = "verb", fill=FALSE,
children(relation = "agent",
children(label="subject")),
children(relation = "nsubjpass", label="object"))
active = tquery(pos = "VERB*", label = "verb", fill=FALSE,
children(relation = c("nsubj", "nsubjpass"), label = "subject"),
children(relation = "dobj", label="object"))
tokens = annotate_tqueries(tokens, "clause", pas=passive, act=active, overwrite=T)
cast_text(tokens, 'clause')
## group annotations
cast_text(tokens, 'clause', text = c('verb','object'))
## use grouping to sort
cast_text(tokens, 'clause', subject = 'subject',
verb = 'verb', object = 'object')
# }
Run the code above in your browser using DataLab