View source: R/generic_reshape.r
remove_nodes | R Documentation |
Remove nodes
remove_nodes( .tokens, node, rm_subset = NULL, with_fill = TRUE, rm_subset_fill = NULL, keep_shared = FALSE )
.tokens |
A tokenIndex in which nodes are selected with select_nodes. |
node |
The name of the node that is to be mutated |
rm_subset |
A subset expression (that evaluates to a logical vector) to more specifically specify which nodes to remove. The token column for each labeled node in the tquery can be referred to as label$column. |
with_fill |
If TRUE, also remove the fill nodes |
rm_subset_fill |
A subset on the fill nodes. Can only directly use token column. For example, use pos == 'VERB' to remove only verbs |
keep_shared |
If there is another node that has the same fill nodes, should the fill nodes that are shared also be removed? |
A tokenIndex with a .nodes attribute
tokens = tokens_spacy[tokens_spacy$doc_id == 'text1',] ## use a tquery to label the nodes that you want to manipulate tq = tquery(pos = 'VERB', children(label = 'object', relation='dobj')) ## apply query to select nodes tokens2 = select_nodes(tokens, tq) remove_nodes(tokens2, 'object') remove_nodes(tokens2, 'object', with_fill=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.