Glove loader - Code changes and unit tests.

1. Added methods to download, extract and load glove vectors.
2. Added units tests to test the public methods.

Other changes
 1. Made download and extract methods private.
 2. Refactored Word2vec unit tests to exclude private methods.
This commit is contained in:
abeswara 2019-04-30 13:52:37 -04:00 коммит произвёл Casey Hong
Родитель c9006c8b65
Коммит 008bfa2c57
2 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -39,6 +39,7 @@ def test_load_pretrained_vectors_word2vec():
shutil.rmtree(os.path.join(os.getcwd(), dir_path)) shutil.rmtree(os.path.join(os.getcwd(), dir_path))
assert isinstance(load_word2vec(dir_path), Word2VecKeyedVectors)
def test_load_pretrained_vectors_glove(): def test_load_pretrained_vectors_glove():
dir_path = "temp_data/" dir_path = "temp_data/"

Просмотреть файл

@ -87,7 +87,6 @@ def load_pretrained_vectors(dir_path, file_name="glove.840B.300d.txt", limit=Non
Returns: Returns:
gensim.models.keyedvectors.Word2VecKeyedVectors: Loaded word2vectors gensim.models.keyedvectors.Word2VecKeyedVectors: Loaded word2vectors
""" """
file_path = _maybe_download_and_extract(dir_path, file_name) file_path = _maybe_download_and_extract(dir_path, file_name)