flair.data.Span#

class flair.data.Span(tokens)View on GitHub#

Bases: _PartOfSentence

This class represents one textual span consisting of Tokens.

__init__(tokens)View on GitHub#

Methods

__init__(tokens)

add_label(typename, value[, score])

Adds a label to the DataPoint by internally creating a Label object.

add_metadata(key, value)

clear_embeddings([embedding_names])

get_each_embedding([embedding_names])

get_embedding([names])

get_label([label_type, zero_tag_value])

get_labels([typename])

Returns all labels of this datapoint belonging to a specific annotation layer.

get_metadata(key)

has_label(type)

has_metadata(key)

remove_labels(typename)

set_embedding(name, vector)

set_label(typename, value[, score])

to(device[, pin_memory])

to_dict([tag_type])

Attributes

embedding

end_position

labels

score

start_position

tag

text

unlabeled_identifier

property start_position: int#
property end_position: int#
property text: str#
property unlabeled_identifier: str#
property embedding#
to_dict(tag_type=None)View on GitHub#