agg_label: Helper function for aggregate_rsyntax

View source: R/rsyntax.r

agg_labelR Documentation

Helper function for aggregate_rsyntax

Description

This function is used within the aggregate_rsyntax function to facilitate aggregating by specific labels.

Usage

agg_label(label, ...)

Arguments

label

The rsyntax label. Needs to be an existing value in the annotation column (as specified when calling aggregate_rsyntax)

...

Specify the new aggregated columns in name-value pairs. The name is the name of the new column, and the value should be a function over a column in $tokens. For example: subject = paste(token, collapse = ' ') would create the column 'subject', of which the values are the concatenated tokens. See examples for more.

Value

Not relevant. Should only be used within aggregate_rsyntax

Examples

tc = tc_sotu_udpipe$copy()
tc$udpipe_clauses()

## count number of tokens in predicate
aggregate_rsyntax(tc, 'clause', txt=FALSE,
                  agg_label('predicate', n = length(token_id)))

corpustools documentation built on May 31, 2023, 8:45 p.m.