agg_label {corpustools}R 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)))

[Package corpustools version 0.4.10 Index]