提交 d8494f90 编写于 作者: T Tao Luo 提交者: GitHub

Merge pull request #423 from jacquesqiao/fix-word2vec-load

fix word2vec load
...@@ -223,7 +223,7 @@ def load_dict_and_embedding(): ...@@ -223,7 +223,7 @@ def load_dict_and_embedding():
with open("word_dict", "r") as f: with open("word_dict", "r") as f:
for line in f: for line in f:
key, value = line.strip().split(" ") key, value = line.strip().split(" ")
word_dict[key] = value word_dict[key] = int(value)
embeddings = numpy.loadtxt("embedding_table", delimiter=",") embeddings = numpy.loadtxt("embedding_table", delimiter=",")
return word_dict, embeddings return word_dict, embeddings
......
...@@ -241,7 +241,7 @@ def load_dict_and_embedding(): ...@@ -241,7 +241,7 @@ def load_dict_and_embedding():
with open("word_dict", "r") as f: with open("word_dict", "r") as f:
for line in f: for line in f:
key, value = line.strip().split(" ") key, value = line.strip().split(" ")
word_dict[key] = value word_dict[key] = int(value)
embeddings = numpy.loadtxt("embedding_table", delimiter=",") embeddings = numpy.loadtxt("embedding_table", delimiter=",")
return word_dict, embeddings return word_dict, embeddings
......
...@@ -265,7 +265,7 @@ def load_dict_and_embedding(): ...@@ -265,7 +265,7 @@ def load_dict_and_embedding():
with open("word_dict", "r") as f: with open("word_dict", "r") as f:
for line in f: for line in f:
key, value = line.strip().split(" ") key, value = line.strip().split(" ")
word_dict[key] = value word_dict[key] = int(value)
embeddings = numpy.loadtxt("embedding_table", delimiter=",") embeddings = numpy.loadtxt("embedding_table", delimiter=",")
return word_dict, embeddings return word_dict, embeddings
......
...@@ -283,7 +283,7 @@ def load_dict_and_embedding(): ...@@ -283,7 +283,7 @@ def load_dict_and_embedding():
with open("word_dict", "r") as f: with open("word_dict", "r") as f:
for line in f: for line in f:
key, value = line.strip().split(" ") key, value = line.strip().split(" ")
word_dict[key] = value word_dict[key] = int(value)
embeddings = numpy.loadtxt("embedding_table", delimiter=",") embeddings = numpy.loadtxt("embedding_table", delimiter=",")
return word_dict, embeddings return word_dict, embeddings
......
...@@ -34,7 +34,7 @@ def load_dict_and_embedding(): ...@@ -34,7 +34,7 @@ def load_dict_and_embedding():
with open("word_dict", "r") as f: with open("word_dict", "r") as f:
for line in f: for line in f:
key, value = line.strip().split(" ") key, value = line.strip().split(" ")
word_dict[key] = value word_dict[key] = int(value)
embeddings = numpy.loadtxt("embedding_table", delimiter=",") embeddings = numpy.loadtxt("embedding_table", delimiter=",")
return word_dict, embeddings return word_dict, embeddings
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册