diff --git a/gensim/models/keyedvectors.py b/gensim/models/keyedvectors.py index 811f7849d0..43f7210792 100644 --- a/gensim/models/keyedvectors.py +++ b/gensim/models/keyedvectors.py @@ -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__) diff --git a/gensim/test/test_data/old_keyedvectors_320.dat b/gensim/test/test_data/old_keyedvectors_320.dat new file mode 100644 index 0000000000..62155b543b Binary files /dev/null and b/gensim/test/test_data/old_keyedvectors_320.dat differ diff --git a/gensim/test/test_keyedvectors.py b/gensim/test/test_keyedvectors.py index 13a5b8c5a9..143ae03bc2 100644 --- a/gensim/test/test_keyedvectors.py +++ b/gensim/test/test_keyedvectors.py @@ -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()