Skip to content

Commit

Permalink
Point WordEmbeddingSimilarityIndex documentation to gensim.similarities
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Nov 21, 2020
1 parent eff2faf commit d4aa31c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/notebooks/soft_cosine_benchmark.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"from gensim.similarities import SparseTermSimilarityMatrix\n",
"from gensim.similarities import UniformTermSimilarityIndex\n",
"from gensim.similarities import LevenshteinSimilarityIndex\n",
"from gensim.models import WordEmbeddingSimilarityIndex\n",
"from gensim.similarities import WordEmbeddingSimilarityIndex\n",
"from gensim.utils import simple_preprocess\n",
"\n",
"RANDOM_SEED = 12345\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/notebooks/soft_cosine_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@
"%%time\n",
"import gensim.downloader as api\n",
"\n",
"from gensim.models import WordEmbeddingSimilarityIndex\n",
"from gensim.similarities import SparseTermSimilarityMatrix\n",
"from gensim.similarities import WordEmbeddingSimilarityIndex\n",
"\n",
"w2v_model = api.load(\"glove-wiki-gigaword-50\")\n",
"similarity_index = WordEmbeddingSimilarityIndex(w2v_model)\n",
Expand Down Expand Up @@ -296,7 +296,7 @@
"from gensim.corpora import Dictionary\n",
"from gensim.models import TfidfModel\n",
"from gensim.models import Word2Vec\n",
"from gensim.models import WordEmbeddingSimilarityIndex\n",
"from gensim.similarities import WordEmbeddingSimilarityIndex\n",
"from gensim.similarities import SparseTermSimilarityMatrix\n",
"\n",
"dictionary = Dictionary(corpus)\n",
Expand Down
5 changes: 3 additions & 2 deletions gensim/similarities/docsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,8 +887,9 @@ class SoftCosineSimilarity(interfaces.SimilarityABC):
>>> from gensim.test.utils import common_texts
>>> from gensim.corpora import Dictionary
>>> from gensim.models import Word2Vec, WordEmbeddingSimilarityIndex
>>> from gensim.models import Word2Vec
>>> from gensim.similarities import SoftCosineSimilarity, SparseTermSimilarityMatrix
>>> from gensim.similarities import WordEmbeddingSimilarityIndex
>>>
>>> model = Word2Vec(common_texts, vector_size=20, min_count=1) # train word-vectors
>>> termsim_index = WordEmbeddingSimilarityIndex(model.wv)
Expand Down Expand Up @@ -925,7 +926,7 @@ def __init__(self, corpus, similarity_matrix, num_best=None, chunksize=256):
A sparse term similarity matrix build using a term similarity index.
:class:`gensim.similarities.LevenshteinSimilarityIndex`
A term similarity index that computes Levenshtein similarities between terms.
:class:`gensim.models.WordEmbeddingSimilarityIndex`
:class:`gensim.similarities.WordEmbeddingSimilarityIndex`
A term similarity index that computes cosine similarities between word embeddings.
"""
Expand Down
4 changes: 2 additions & 2 deletions gensim/similarities/termsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ class SparseTermSimilarityMatrix(SaveLoad):
--------
>>> from gensim.test.utils import common_texts
>>> from gensim.corpora import Dictionary
>>> from gensim.models import Word2Vec, WordEmbeddingSimilarityIndex
>>> from gensim.similarities import SoftCosineSimilarity, SparseTermSimilarityMatrix
>>> from gensim.models import Word2Vec
>>> from gensim.similarities import SoftCosineSimilarity, SparseTermSimilarityMatrix, WordEmbeddingSimilarityIndex
>>> from gensim.similarities.index import AnnoyIndexer
>>> from scikits.sparse.cholmod import cholesky
>>>
Expand Down

0 comments on commit d4aa31c

Please sign in to comment.