[ allennlp.data.fields.span_field ]
class SpanField(Field[torch.Tensor]): | def __init__( | self, | span_start: int, | span_end: int, | sequence_field: SequenceField | ) -> None
SpanField is a pair of inclusive, zero-indexed (start, end) indices into a
SequenceField, used to represent a span of text.
Because it's a pair of indices into a
SequenceField, we take one of those as input
to make the span's dependence explicit and to validate that the span is well defined.
- span_start :
The index of the start of the span in the
- span_end :
The inclusive index of the end of the span in the
- sequence_field :
A field containing the sequence that this
SpanFieldis a span inside.
| @overrides | def get_padding_lengths(self) -> Dict[str, int]
| @overrides | def as_tensor(self, padding_lengths: Dict[str, int]) -> torch.Tensor
| @overrides | def empty_field(self)