Skip to content

sequences

allennlp.common.sequences

[SOURCE]


ShuffledSequence

class ShuffledSequence(abc.Sequence):
 | def __init__(
 |     self,
 |     inner_sequence: Sequence,
 |     indices: Optional[Sequence[int]] = None
 | )

Produces a shuffled view of a sequence, such as a list.

This assumes that the inner sequence never changes. If it does, the results are undefined.

SlicedSequence

class SlicedSequence(ShuffledSequence):
 | def __init__(self, inner_sequence: Sequence, s: slice)

Produces a sequence that's a slice into another sequence, without copying the elements.

This assumes that the inner sequence never changes. If it does, the results are undefined.

ConcatenatedSequence

class ConcatenatedSequence(abc.Sequence):
 | def __init__(self, *sequences: Sequence)

Produces a sequence that's the concatenation of multiple other sequences, without copying the elements.

This assumes that the inner sequence never changes. If it does, the results are undefined.