Skip to content

sequence_field

allennlp.data.fields.sequence_field

[SOURCE]


SequenceField#

class SequenceField(Field[DataArray])

A SequenceField represents a sequence of things. This class just adds a method onto Field: sequence_length. It exists so that SequenceLabelField, IndexField and other similar Fields can have a single type to require, with a consistent API, whether they are pointing to words in a TextField, items in a ListField, or something else.

sequence_length#

class SequenceField(Field[DataArray]):
 | ...
 | def sequence_length(self) -> int

How many elements are there in this sequence?

empty_field#

class SequenceField(Field[DataArray]):
 | ...
 | def empty_field(self) -> "SequenceField"