gensim.utils.SlicedCorpus.__init__

SlicedCorpus.__init__(corpus, slice_)[source]

Return a corpus that is the slice of input iterable corpus.

Negative slicing can only be used if the corpus is indexable. Otherwise, the corpus will be iterated over.

Slice can also be a numpy.ndarray to support fancy indexing.

NOTE: calculating the size of a SlicedCorpus is expensive when using a slice as the corpus has to be iterated over once. Using a list or numpy.ndarray does not have this drawback, but consumes more memory.