class_docstr: Convert a matrix in scipy.sparse format into a streaming Gensim corpus.
  
  See Also
  --------
  :func:`~gensim.matutils.corpus2csc`
      Convert gensim corpus format to `scipy.sparse.csc` matrix
  :class:`~gensim.matutils.Dense2Corpus`
      Convert dense matrix to gensim corpus.
class_docstr_tok: ["Convert","a","matrix","in","scipy.sparse","format","into","a","streaming","Gensim","corpus",".","See","Also","--","--","--","--",":","func",":","`","~gensim.matutils.corpus2csc","`","Convert","gensim","corpus","format","to","`","scipy.sparse.csc","`","matrix",":","class",":","`","~gensim.matutils.Dense2Corpus","`","Convert","dense","matrix","to","gensim","corpus","."]
docstr: Retrieve a document vector or subset from the corpus by key.
  
  Parameters
  ----------
  key: int, ellipsis, slice, iterable object
      Index of the document retrieve.
      Less commonly, the key can also be a slice, ellipsis, or an iterable
      to retrieve multiple documents.
  
  Returns
  -------
  list of (int, number), Sparse2Corpus
      Document in BoW format when `key` is an integer. Otherwise :class:`~gensim.matutils.Sparse2Corpus`.
docstr_tok: ["Retrieve","a","document","vector","or","subset","from","the","corpus","by","key",".","Parameters","--","--","--","--","--","key",":","int",",","ellipsis",",","slice",",","iterable","object","Index","of","the","document","retrieve",".","Less","commonly",",","the","key","can","also","be","a","slice",",","ellipsis",",","or","an","iterable","to","retrieve","multiple","documents",".","Returns","--","--","--","-","list","of","(","int",",","number",")",",","Sparse2Corpus","Document","in","BoW","format","when","`","key","`","is","an","integer",".","Otherwise",":","class",":","`","~gensim.matutils.Sparse2Corpus","`","."]
code: def __getitem__(self, key):
      """
      Retrieve a document vector or subset from the corpus by key.
  
      Parameters
      ----------
      key: int, ellipsis, slice, iterable object
          Index of the document retrieve.
          Less commonly, the key can also be a slice, ellipsis, or an iterable
          to retrieve multiple documents.
  
      Returns
      -------
      list of (int, number), Sparse2Corpus
          Document in BoW format when `key` is an integer. Otherwise :class:`~gensim.matutils.Sparse2Corpus`.
      """
      sparse = self.sparse
      if isinstance(key, int):
          iprev = self.sparse.indptr[key]
          inow = self.sparse.indptr[key + 1]
          return list(
              zip(sparse.indices[iprev:inow], sparse.data[iprev:inow])
          )
  
      sparse = self.sparse.__getitem__((slice(None, None, None), key))
      return Sparse2Corpus(sparse)
  
imports: from __future__ import with_statement
  import logging
  import math
  from gensim import utils
  import numpy
  import scipy.sparse
  from scipy.stats import entropy
  from scipy.linalg import get_blas_funcs, triu
  from scipy.linalg.lapack import get_lapack_funcs
  from scipy.special import psi
label_desc: Use image node_id 4 for calling the Sparse2Corpus obj's underlying member method code with example usage: obj.__getitem__(key) and returns: Sparse2Corpus, list