Skip to content

Instantly share code, notes, and snippets.

@penut85420
Last active October 11, 2018 09:32
Show Gist options
  • Save penut85420/e919edb4bb844336aeaef68912cc841e to your computer and use it in GitHub Desktop.
Save penut85420/e919edb4bb844336aeaef68912cc841e to your computer and use it in GitHub Desktop.
Loader = importlib.import_module('Loader')
model_path = "w2v\\w2v_word_model.npy"
dict_path = "w2v\\w2v_word_dictionary.pkl"
w2v_model = Loader.Word2VecLoader(model_path, dict_path)
w2v, d = w2v_model.load_w2v()
w2v_list = list()
with open("a.txt", "r", encoding='utf-8') as fin:
for line in fin:
v = []
clist = line.split()
for c in clist:
v.append(w2v[d[c]])
w2v_list.append(v)
print(w2v_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment