reselect_nodes: Within a chain of reshape operations, reapply the tquery

Description Usage Arguments Value Examples

View source: R/generic_reshape.r

Description

Within a chain of reshape operations, reapply the tquery

Usage

1
reselect_nodes(.tokens)

Arguments

.tokens

A tokenIndex in which nodes are selected with select_nodes.

Value

A tokenIndex with a .nodes attribute

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
tokens = tokens_spacy[tokens_spacy$doc_id == 'text4',]

## use a tquery to label the nodes that you want to manipulate
tq = tquery(relation = "relcl", label = "relative_clause")

## apply query to select nodes
tokens2 = select_nodes(tokens, tq) 

## reuses the tq, that is stored in tokens2
## this makes it easy to make the selection anew after a transformation
tokens2 = reselect_nodes(tokens2)

rsyntax documentation built on June 13, 2021, 9:07 a.m.