diff --git a/docs/conf.py b/docs/conf.py index 9fbde20..d700f8d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -29,7 +29,7 @@ author = 'Dimo Angelov' # The full version, including alpha/beta/rc tags -release = '1.0.18' +release = '1.0.19' # -- General configuration --------------------------------------------------- diff --git a/setup.py b/setup.py index a21f8ce..06f046e 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setuptools.setup( name="top2vec", packages=["top2vec"], - version="1.0.18", + version="1.0.19", author="Dimo Angelov", author_email="dimo.angelov@gmail.com", description="Top2Vec learns jointly embedded topic, document and word vectors.", diff --git a/top2vec/Top2Vec.py b/top2vec/Top2Vec.py index 4c7d187..fcb8ba3 100644 --- a/top2vec/Top2Vec.py +++ b/top2vec/Top2Vec.py @@ -402,7 +402,7 @@ def save(self, file): self.document_index = None # serialize word index so that it can be saved - if self.word_indexed: + if self.words_indexed: temp = tempfile.NamedTemporaryFile(mode='w+b') self.word_index.save_index(temp.name) self.serialized_word_index = temp.read() diff --git a/top2vec/__init__.py b/top2vec/__init__.py index 98911c2..b119265 100644 --- a/top2vec/__init__.py +++ b/top2vec/__init__.py @@ -1,3 +1,3 @@ from top2vec.Top2Vec import Top2Vec -__version__ = '1.0.18' +__version__ = '1.0.19' diff --git a/top2vec/tests/test_top2vec.py b/top2vec/tests/test_top2vec.py index 47d1698..601e1fb 100644 --- a/top2vec/tests/test_top2vec.py +++ b/top2vec/tests/test_top2vec.py @@ -2,6 +2,7 @@ from top2vec import Top2Vec from sklearn.datasets import fetch_20newsgroups import numpy as np +import tempfile # get 20 newsgroups data newsgroups_train = fetch_20newsgroups(subset='all', remove=('headers', 'footers', 'quotes')) @@ -457,3 +458,11 @@ def test_similar_words_index(top2vec_model): # check that words are returned in decreasing order assert all(word_scores[i] >= word_scores[i + 1] for i in range(len(word_scores) - 1)) + + +@pytest.mark.parametrize('top2vec_model', models) +def test_similar_words_index(top2vec_model): + temp = tempfile.NamedTemporaryFile(mode='w+b') + top2vec_model.save(temp.name) + Top2Vec.load(temp.name) + temp.close()