annotate_nodes: Annotate a tokenlist based on rsyntaxNodes

Description Usage Arguments

View source: R/annotate.r

Description

Use rsyntaxNodes, as created with tquery and apply_queries, to annotate a tokenlist. Two columns will be added. One column contains the ids for each hit. The other column contains the annotations. Only nodes that are given a name in the tquery (using the 'save' parameter) will be added as annotation.

Usage

1
2
annotate_nodes(tokens, nodes, column, unique_fill = F, concat_dup = T,
  show_fill = F)

Arguments

tokens

A tokenIndex data.table, or any data.frame coercible with as_tokenindex.

nodes

A data.table, as created with find_nodes or apply_queries. Can be a list of multiple data.tables.

column

The name of the column in which the annotations are added. The unique ids are added as [column]_id

unique_fill

If TRUE, only the fill value of the closest parent will be used, and nodes that are already directly matched will not be filled.

concat_dup

If TRUE (default), duplicate values will be concatenated. Otherwise, rows will be duplicated.

show_fill

if TRUE, return column with fill level


vanatteveldt/rsyntax documentation built on Oct. 17, 2018, 1:30 a.m.