Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
path = Path(path)
filename = "word2vec.gensim.model"
print("Loading model...")
if lang == "ja":
dirpath = Path(download.get_cache_directory(str(Path("word2vec"))))
download.cached_unzip(path, dirpath / lang)
model_path = dirpath / lang / filename
model = gensim.models.Word2Vec.load(str(model_path))
if lang == "en":
dirpath = Path(download.get_cache_directory(str(Path("word2vec") / "en")))
model_path = dirpath / filename
download.cached_decompress_gzip(path, model_path)
model = gensim.models.KeyedVectors.load_word2vec_format(str(model_path), binary=True)
return model