Skip to contents

A recognizer function receives one text string and returns a data frame or a list of records with start and end character offsets. Optional fields are confidence, entity_type, and normalised.

Usage

entity_recognizer(
  id,
  recognize,
  entity_type,
  version = "unversioned",
  locales = NULL,
  severity = "high",
  action = "redact",
  show_stats = FALSE
)

Arguments

id

Stable recognizer identifier.

recognize

Function accepting a single text string.

entity_type

Entity label used when a returned record omits one.

version

Recognizer or ruleset version.

locales

Optional locale labels describing evaluated coverage.

severity

Finding severity.

action

Finding action.

show_stats

Show construction time and available usage metrics.

Value

A shieldr_recognizer object for scanner_options().

Examples

recognizer <- entity_recognizer(
  "example/member-id",
  function(text) data.frame(start = 1L, end = 6L),
  entity_type = "MEMBER_ID"
)