# NOT RUN {
tokens = tokens_spacy[tokens_spacy$doc_id == 'text4',]
## use a tquery to label the nodes that you want to manipulate
tq = tquery(label='verb', children(relation='nsubj'))
## apply query to select nodes
tokens2 = select_nodes(tokens, tq)
selected_nodes(tokens2)$nodes
tokens2 = subset_nodes(tokens2, verb$relation == 'ROOT')
selected_nodes(tokens2)$nodes
# }
Run the code above in your browser using DataLab