labels: Labels for model training

View source: R/02_labels.R

labelsR Documentation

Labels for model training

Description

Extract the labels and relations in a webanno file to an easy, machine readable format ready for machine learning projects.

Usage

labels(
  data,
  label,
  relations = NULL,
  show_type = FALSE,
  show_tag = FALSE,
  show_ID = FALSE,
  handle_multiple = "duplicate"
)

Arguments

data

character or WebAnnoTSV. The contents of a WebAnno TSV v3.3 file as created by webanno_open or a path leading to it.

label

character. The main label. The relations must go FROM this term.

relations

character. The set of relations you'd like to extract.

show_type

logical. Add a column with the type of relation of the related terms.

show_tag

logical. Add a column with the tags of the related terms.

show_ID

logical. Add a column with the positional ID of the related terms.

handle_multiple

character. If there are multiple relations connecting to the same label, i.e. multiples locations, show should it be handled? Should duplicate rows be created or the content be merge'd?

Value

A list of dataframes, organized with columns for the corresponding line in the text, label and relations (if relations != NULL)

Examples

example = arete_data("annotations")[[1]]
labels(data = example, label = "Species", relations = "OCCURS")

labels(data = example,
label = c("TraitVal"), relations = c("meas_Sex")) 

labels(data = example,
label = c("TraitVal"), relations = c("meas_trait", "meas_Sex", "meas_Unit"))

labels(data = example,
label = c("TraitVal"), relations = c("meas_trait", "meas_Sex", "meas_Unit"),
 handle_multiple = "merge")  

arete documentation built on Nov. 5, 2025, 6:31 p.m.