View Source Kino.Bumblebee.HighlightedText (KinoBumblebee v0.2.0)

A kino for displaying a text with highlights and labels.

This kino is primarily used to present the result of token classification.

examples

Examples

text = "Rachel Green works at Ralph Lauren in New York City in the sitcom Friends."

highlights = [
  %{label: "PER", phrase: "Rachel Green", start: 0, end: 12},
  %{label: "ORG", phrase: "Ralph Lauren", start: 22, end: 34},
  %{label: "LOC", phrase: "New York City", start: 38, end: 51},
  %{label: "MISC", phrase: "Friends", start: 66, end: 73}
]

Kino.Bumblebee.HighlightedText.new(text, highlights)

Link to this section Summary

Functions

Creates a new kino displaying the given list of items.

Link to this section Types

Link to this section Functions

@spec new(String.t(), [
  %{label: String.t(), start: non_neg_integer(), end: non_neg_integer()}
]) :: t()

Creates a new kino displaying the given list of items.

Expects a list of maps, each element representing a highlight with the some label.

Note that the :start and :end offsets are interpreted as the number of UTF-8 bytes.