isolate_branch: Isolate a branch in a dependency tree

View source: R/isolate_branches.r

isolate_branchR Documentation

Isolate a branch in a dependency tree

Description

cuts of a branch at the nodes that match the lookup arguents (...). A "tree_parent" column is added to the tokenindex, that indicates for the new roots which node the parent was.

Usage

isolate_branch(tokens, ..., copy_parent = TRUE, copy_parent_fill = TRUE)

Arguments

tokens

A tokenindex

...

lookup arguments to find the node to split. For example, isolate_branch(tokens, relation='relcl') isolates branches of which the top node (the new root) has the relation "relcl".

copy_parent

If TRUE (default) copy the parent of the branch and include it in the isolated branch

copy_parent_fill

If TRUE, also copy the parents fill nodes

Value

the tokenindex

Examples

tokens = tokens_spacy[tokens_spacy$doc_id == 'text4',]
tokens = as_tokenindex(tokens)

tokens2 = isolate_branch(tokens, relation = 'relcl', copy_parent = TRUE)
tokens2

if (interactive()) plot_tree(tokens2)


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