class_docstr: Interface for similarity search over a corpus.
  
  In all instances, there is a corpus against which we want to perform the similarity search.
  For each similarity search, the input is a document or a corpus, and the output are the similarities
  to individual corpus documents.
  
  Examples
  --------
  .. sourcecode:: pycon
  
      >>> from gensim.similarities import MatrixSimilarity
      >>> from gensim.test.utils import common_corpus
      >>>
      >>> index = MatrixSimilarity(common_corpus)
      >>> similarities = index.get_similarities(common_corpus[1])  # get similarities between query and corpus
  
  Notes
  -----
  There is also a convenience wrapper, where iterating over `self` yields similarities of each document in the corpus
  against the whole corpus (i.e. the query is each corpus document in turn).
  
  See Also
  --------
  :mod:`gensim.similarities`
      Different index implementations of this interface.
class_docstr_tok: ["Interface","for","similarity","search","over","a","corpus",".","In","all","instances",",","there","is","a","corpus","against","which","we","want","to","perform","the","similarity","search",".","For","each","similarity","search",",","the","input","is","a","document","or","a","corpus",",","and","the","output","are","the","similarities","to","individual","corpus","documents",".","Examples","--","--","--","--","..","sourcecode",":",":","pycon",">",">",">","from","gensim.similarities","import","MatrixSimilarity",">",">",">","from","gensim.test.utils","import","common_corpus",">",">",">",">",">",">","index","=","MatrixSimilarity","(","common_corpus",")",">",">",">","similarities","=","index.get_similarities","(","common_corpus","[","1","]",")","#","get","similarities","between","query","and","corpus","Notes","--","--","-","There","is","also","a","convenience","wrapper",",","where","iterating","over","`","self","`","yields","similarities","of","each","document","in","the","corpus","against","the","whole","corpus","(","i.e",".","the","query","is","each","corpus","document","in","turn",")",".","See","Also","--","--","--","--",":","mod",":","`","gensim.similarities","`","Different","index","implementations","of","this","interface","."]
docstr: Get similarities of the given document or corpus against this index.
  
  Uses :meth:`~gensim.interfaces.SimilarityABC.get_similarities` internally.
  
  Notes
  -----
  Passing an entire corpus as `query` can be more efficient than passing its documents one after another,
  because it will issue queries in batches internally.
  
  Parameters
  ----------
  query : {list of (int, number), iterable of list of (int, number)}
      Document in the sparse Gensim bag-of-words format, or a streamed corpus of such documents.
  
  Returns
  -------
  {`scipy.sparse.csr.csr_matrix`, list of (int, float)}
      Similarities given document or corpus and objects corpus, depends on `query`.
docstr_tok: ["Get","similarities","of","the","given","document","or","corpus","against","this","index",".","Uses",":","meth",":","`","~gensim.interfaces.SimilarityABC.get_similarities","`","internally",".","Notes","--","--","-","Passing","an","entire","corpus","as","`","query","`","can","be","more","efficient","than","passing","its","documents","one","after","another",",","because","it","will","issue","queries","in","batches","internally",".","Parameters","--","--","--","--","--","query",":","{","list","of","(","int",",","number",")",",","iterable","of","list","of","(","int",",","number",")","}","Document","in","the","sparse","Gensim","bag-of-words","format",",","or","a","streamed","corpus","of","such","documents",".","Returns","--","--","--","-","{","`","scipy.sparse.csr.csr_matrix","`",",","list","of","(","int",",","float",")","}","Similarities","given","document","or","corpus","and","objects","corpus",",","depends","on","`","query","`","."]
code: def __getitem__(self, query):
      """Get similarities of the given document or corpus against this index.
  
      Uses :meth:`~gensim.interfaces.SimilarityABC.get_similarities` internally.
  
      Notes
      -----
      Passing an entire corpus as `query` can be more efficient than passing its documents one after another,
      because it will issue queries in batches internally.
  
      Parameters
      ----------
      query : {list of (int, number), iterable of list of (int, number)}
          Document in the sparse Gensim bag-of-words format, or a streamed corpus of such documents.
  
      Returns
      -------
      {`scipy.sparse.csr.csr_matrix`, list of (int, float)}
          Similarities given document or corpus and objects corpus, depends on `query`.
  
      """
      is_corpus, query = utils.is_corpus(query)
      if self.normalize:
          # self.normalize only works if the input is a plain gensim vector/corpus (as
          # advertised in the doc). in fact, input can be a numpy or scipy.sparse matrix
          # as well, but in that case assume tricks are happening and don't normalize
          # anything (self.normalize has no effect).
          if not matutils.ismatrix(query):
              if is_corpus:
                  query = [matutils.unitvec(v) for v in query]
              else:
                  query = matutils.unitvec(query)
      result = self.get_similarities(query)
  
      if self.num_best is None:
          return result
  
      # if maintain_sparsity is True, result is scipy sparse. Sort, clip the
      # topn and return as a scipy sparse matrix.
      if getattr(self, "maintain_sparsity", False):
          return matutils.scipy2scipy_clipped(result, self.num_best)
  
      # if the input query was a corpus (=more documents), compute the top-n
      # most similar for each document in turn
      if matutils.ismatrix(result):
          return [
              matutils.full2sparse_clipped(v, self.num_best)
              for v in result
          ]
      else:
          # otherwise, return top-n of the single input document
          return matutils.full2sparse_clipped(result, self.num_best)
  
imports: import logging
  from gensim import utils, matutils
label_desc: Use image node_id 3 for calling the SimilarityABC obj's underlying member method code with example usage: obj.__getitem__(query) and returns: result, matutils, unknown, matutils