tCorpus-cash-feats_to_columns: Cast the "feats" column in UDpipe tokens to columns

tCorpus$feats_to_columnsR Documentation

Cast the "feats" column in UDpipe tokens to columns

Description

If the UDpipe parser is used in create_tcorpus, the 'feats' column contains strings with features (e.g, Number=Sing|PronType=Dem). To work with these nested features it is more convenient to cast them to columns.

Arguments

keep

Optionally, the names of features to keep

drop

Optionally, the names of features to drop

rm_column

If TRUE (default), remove the original column

Details

Usage:

## R6 method for class tCorpus. Use as tc$method (where tc is a tCorpus object).

feats_to_columns(keep=NULL, drop=NULL, rm_column=TRUE)

Examples

if (interactive()) {
tc = create_tcorpus('This is a test Bobby.', udpipe_model='english-ewt')
tc$feats_to_columns()
tc$tokens

tc = create_tcorpus('This is a test Bobby.', udpipe_model='english-ewt')
tc$feats_to_columns(keep = c('Gender','Tense','Person'))
tc$tokens
}

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