diff --git a/04.word2vec/README.cn.md b/04.word2vec/README.cn.md index f9aac91005f69f63dbe392b8c219f2a93a1c77df..bee25b65923535005bce68ec37338a3ffbe4cdd4 100644 --- a/04.word2vec/README.cn.md +++ b/04.word2vec/README.cn.md @@ -223,7 +223,7 @@ def load_dict_and_embedding(): with open("word_dict", "r") as f: for line in f: key, value = line.strip().split(" ") - word_dict[key] = value + word_dict[key] = int(value) embeddings = numpy.loadtxt("embedding_table", delimiter=",") return word_dict, embeddings diff --git a/04.word2vec/README.md b/04.word2vec/README.md index 71444ef4a97b6b13dfc311da9c925d3230923560..39b93063fb6dc4c811136a949c0c967488dde9d1 100644 --- a/04.word2vec/README.md +++ b/04.word2vec/README.md @@ -241,7 +241,7 @@ def load_dict_and_embedding(): with open("word_dict", "r") as f: for line in f: key, value = line.strip().split(" ") - word_dict[key] = value + word_dict[key] = int(value) embeddings = numpy.loadtxt("embedding_table", delimiter=",") return word_dict, embeddings diff --git a/04.word2vec/index.cn.html b/04.word2vec/index.cn.html index f8a4a0bfd9450f2007848db5c1faa6486b152497..23729bf387e9eea06970aee13b29c846e680f4fb 100644 --- a/04.word2vec/index.cn.html +++ b/04.word2vec/index.cn.html @@ -265,7 +265,7 @@ def load_dict_and_embedding(): with open("word_dict", "r") as f: for line in f: key, value = line.strip().split(" ") - word_dict[key] = value + word_dict[key] = int(value) embeddings = numpy.loadtxt("embedding_table", delimiter=",") return word_dict, embeddings diff --git a/04.word2vec/index.html b/04.word2vec/index.html index 8dce7e228382c076a9ea98c118888dea059117a7..3a17a95541a9672ff3740da256086a6d8f936eed 100644 --- a/04.word2vec/index.html +++ b/04.word2vec/index.html @@ -283,7 +283,7 @@ def load_dict_and_embedding(): with open("word_dict", "r") as f: for line in f: key, value = line.strip().split(" ") - word_dict[key] = value + word_dict[key] = int(value) embeddings = numpy.loadtxt("embedding_table", delimiter=",") return word_dict, embeddings diff --git a/04.word2vec/train.py b/04.word2vec/train.py index 435af6a602c00aaf9cc2ac6c4a8084e265f1f2d2..6940c6eebfc9a5dca1af9deef9f8f93ac90f1635 100644 --- a/04.word2vec/train.py +++ b/04.word2vec/train.py @@ -34,7 +34,7 @@ def load_dict_and_embedding(): with open("word_dict", "r") as f: for line in f: key, value = line.strip().split(" ") - word_dict[key] = value + word_dict[key] = int(value) embeddings = numpy.loadtxt("embedding_table", delimiter=",") return word_dict, embeddings