selected_nodes: If select_nodes() is used, the selected nodes can be...

View source: R/generic_reshape.r

selected_nodesR Documentation

If select_nodes() is used, the selected nodes can be extracted with selected_nodes(). This is mainly for internal use, but it can also be usefull for debugging, and to controll loops of reshape operation (e.g. break if no selected nodes left)

Description

If select_nodes() is used, the selected nodes can be extracted with selected_nodes(). This is mainly for internal use, but it can also be usefull for debugging, and to controll loops of reshape operation (e.g. break if no selected nodes left)

Usage

selected_nodes(.tokens)

Arguments

.tokens

A tokenIndex in which nodes are selected with select_nodes.

Value

A tokenIndex with a .nodes attribute

Examples

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) 

## Get selected nodes from tokenindex
selected_nodes(tokens2)

rsyntax documentation built on June 7, 2022, 9:07 a.m.