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: Iterate over all documents, compute similarity of each document against all other documents in the index.
  
  Yields
  ------
  {`scipy.sparse.csr.csr_matrix`, list of (int, float)}
      Similarity of the current document and all documents in the corpus.
docstr_tok: ["Iterate","over","all","documents",",","compute","similarity","of","each","document","against","all","other","documents","in","the","index",".","Yields","--","--","--","{","`","scipy.sparse.csr.csr_matrix","`",",","list","of","(","int",",","float",")","}","Similarity","of","the","current","document","and","all","documents","in","the","corpus","."]
code: def __iter__(self):
      """Iterate over all documents, compute similarity of each document against all other documents in the index.
  
      Yields
      ------
      {`scipy.sparse.csr.csr_matrix`, list of (int, float)}
          Similarity of the current document and all documents in the corpus.
  
      """
      # turn off query normalization (vectors in the index are assumed to be already normalized)
      norm = self.normalize
      self.normalize = False
  
      # Try to compute similarities in bigger chunks of documents (not
      # one query = a single document after another). The point is, a
      # bigger query of N documents is faster than N small queries of one
      # document.
      #
      # After computing similarities of the bigger query in `self[chunk]`,
      # yield the resulting similarities one after another, so that it looks
      # exactly the same as if they had been computed with many small queries.
      try:
          chunking = self.chunksize > 1
      except AttributeError:
          # chunking not supported; fall back to the (slower) mode of 1 query=1 document
          chunking = False
      if chunking:
          # assumes `self.corpus` holds the index as a 2-d numpy array.
          # this is true for MatrixSimilarity and SparseMatrixSimilarity, but
          # may not be true for other (future) classes..?
          for chunk_start in range(
              0, self.index.shape[0], self.chunksize
          ):
              # scipy.sparse doesn't allow slicing beyond real size of the matrix
              # (unlike numpy). so, clip the end of the chunk explicitly to make
              # scipy.sparse happy
              chunk_end = min(
                  self.index.shape[0], chunk_start + self.chunksize
              )
              chunk = self.index[chunk_start:chunk_end]
              for sim in self[chunk]:
                  yield sim
      else:
          for doc in self.index:
              yield self[doc]
  
      # restore old normalization value
      self.normalize = norm
  
imports: import logging
  from gensim import utils, matutils
label_desc: Use image node_id 4 for calling the SimilarityABC obj's underlying member method code with example usage: obj.__iter__() without return types