Skip to content

Commit

Permalink
fix backwards compatibility, fix #2201 (#2457)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenkov authored Apr 28, 2019
1 parent 02c1d0f commit 3ad65bf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gensim/models/keyedvectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@
)
from gensim.similarities.termsim import TermSimilarityIndex, SparseTermSimilarityMatrix

#
# For backwards compatibility, see https://github.com/RaRe-Technologies/gensim/issues/2201
#
from gensim.models.deprecated.keyedvectors import EuclideanKeyedVectors # noqa

logger = logging.getLogger(__name__)


Expand Down
Binary file added gensim/test/test_data/old_keyedvectors_320.dat
Binary file not shown.
7 changes: 7 additions & 0 deletions gensim/test/test_keyedvectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,13 @@ def test_identity(self):
self.assertTrue(np.all(np.array([6, 7, 8]) == n[2]))


class Gensim320Test(unittest.TestCase):
def test(self):
path = datapath('old_keyedvectors_320.dat')
vectors = gensim.models.keyedvectors.KeyedVectors.load(path)
self.assertTrue(vectors.word_vec('computer') is not None)


if __name__ == '__main__':
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.DEBUG)
unittest.main()

0 comments on commit 3ad65bf

Please # to comment.