cwbtools (version 0.3.3)

conll_get_regions: Extract regions from NER annotations (CoNNL format).

Description

Extract regions from NER annotations (CoNNL format).

Usage

conll_get_regions(x)

Arguments

x

A data.frame, a data.table, or any other object that can be coerced to a data.table. The input table is expected to have the columns "token" and "ner", and "cpos".

Examples

Run this code
# NOT RUN {
x <- data.frame(
  token = c(
    "Die",
    "Bundeskanzlerin",
    "Angela",
    "Merkel",
    "h<U+00E4>lt",
    "im",
    "Bundestag",
    "eine",
    "Rede",
    "."
  ),
  ne = c("O", "O", "B-PERS", "I-PERS", "O", "O", "B-ORG", "O", "O", "O"),
  stringsAsFactors = FALSE
)
x[["cpos"]] <- 100L:(100L + nrow(x) - 1L)
tab <- conll_get_regions(x)
# }

Run the code above in your browser using DataCamp Workspace