class_docstr: Compute negative WMD similarity against a corpus of documents.
  
  Check out `the Gallery <https://radimrehurek.com/gensim/auto_examples/tutorials/run_wmd.html>`__
  for more examples.
  
  When using this code, please consider citing the following papers:
  
  * `Rémi Flamary et al. "POT: Python Optimal Transport"
    <https://jmlr.org/papers/v22/20-451.html>`_
  * `Matt Kusner et al. "From Word Embeddings To Document Distances"
    <http://proceedings.mlr.press/v37/kusnerb15.pdf>`_
  
  Example
  -------
  .. sourcecode:: pycon
  
      >>> from gensim.test.utils import common_texts
      >>> from gensim.models import Word2Vec
      >>> from gensim.similarities import WmdSimilarity
      >>>
      >>> model = Word2Vec(common_texts, vector_size=20, min_count=1)  # train word-vectors
      >>>
      >>> index = WmdSimilarity(common_texts, model.wv)
      >>> # Make query.
      >>> query = ['trees']
      >>> sims = index[query]
class_docstr_tok: ["Compute","negative","WMD","similarity","against","a","corpus","of","documents",".","Check","out","`","the","Gallery","<","https",":","\/\/radimrehurek.com\/gensim\/auto_examples\/tutorials\/run_wmd.html",">","`","__","for","more","examples",".","When","using","this","code",",","please","consider","citing","the","following","papers",":","*","`","R\u00e9mi","Flamary","et","al",".","``","POT",":","Python","Optimal","Transport","''","<","https",":","\/\/jmlr.org\/papers\/v22\/20-451.html",">","`","_","*","`","Matt","Kusner","et","al",".","``","From","Word","Embeddings","To","Document","Distances","''","<","http",":","\/\/proceedings.mlr.press\/v37\/kusnerb15.pdf",">","`","_","Example","--","--","--","-","..","sourcecode",":",":","pycon",">",">",">","from","gensim.test.utils","import","common_texts",">",">",">","from","gensim.models","import","Word2Vec",">",">",">","from","gensim.similarities","import","WmdSimilarity",">",">",">",">",">",">","model","=","Word2Vec","(","common_texts",",","vector_size=20",",","min_count=1",")","#","train","word-vectors",">",">",">",">",">",">","index","=","WmdSimilarity","(","common_texts",",","model.wv",")",">",">",">","#","Make","query",".",">",">",">","query","=","[","'trees","'","]",">",">",">","sims","=","index","[","query","]"]
docstr: Parameters
  ----------
  corpus: iterable of list of str
      A list of documents, each of which is a list of tokens.
  kv_model: :class:`~gensim.models.keyedvectors.KeyedVectors`
      A set of KeyedVectors
  num_best: int, optional
      Number of results to retrieve.
  chunksize : int, optional
      Size of chunk.
code: def __init__(self, corpus, kv_model, num_best=None, chunksize=256):
      """
  
      Parameters
      ----------
      corpus: iterable of list of str
          A list of documents, each of which is a list of tokens.
      kv_model: :class:`~gensim.models.keyedvectors.KeyedVectors`
          A set of KeyedVectors
      num_best: int, optional
          Number of results to retrieve.
      chunksize : int, optional
          Size of chunk.
  
      """
      self.corpus = corpus
      self.wv = kv_model
      self.num_best = num_best
      self.chunksize = chunksize
  
      # Normalization of features is not possible, as corpus is a list (of lists) of strings.
      self.normalize = False
  
      # index is simply an array from 0 to size of corpus.
      self.index = numpy.arange(len(corpus))
  
imports: import logging
  import itertools
  import os
  import heapq
  import warnings
  import numpy
  import scipy.sparse
  from gensim import interfaces, utils, matutils
label_desc: Use image node_id 1 to create a new WmdSimilarity object from inherited base classes: interfaces with example: obj = WmdSimilarity(corpus, kv_model, num_best, chunksize)