Skip to content

Commit

Permalink
Fix WmdSimilarity docstring example.
Browse files Browse the repository at this point in the history
  • Loading branch information
jagmoreira committed Oct 7, 2018
1 parent b7179ab commit e775c25
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions gensim/similarities/docsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ def __str__(self):


class WmdSimilarity(interfaces.SimilarityABC):
"""Compute negative WMD similarity against a corpus of documents by storing the index matrix in memory.
"""Compute negative WMD similarity against a corpus of documents.
See :class:`~gensim.models.keyedvectors.WordEmbeddingsKeyedVectors` for more information.
Also, tutorial `notebook
Expand All @@ -999,17 +999,14 @@ class WmdSimilarity(interfaces.SimilarityABC):
.. sourcecode:: pycon
>>> from gensim.test.utils import common_texts
>>> from gensim.corpora import Dictionary
>>> from gensim.models import Word2Vec
>>> from gensim.similarities import WmdSimilarity
>>>
>>> model = Word2Vec(common_texts, size=20, min_count=1) # train word-vectors
>>> dictionary = Dictionary(common_texts)
>>> bow_corpus = [dictionary.doc2bow(document) for document in common_texts]
>>>
>>> index = WmdSimilarity(bow_corpus, model)
>>> index = WmdSimilarity(common_texts, model)
>>> # Make query.
>>> query = 'trees'
>>> query = ['trees']
>>> sims = index[query]
"""
Expand Down

0 comments on commit e775c25

Please sign in to comment.