Commit 45f0e232 authored by 赵威's avatar 赵威

ignore open error

parent 44607bc6
......@@ -14,7 +14,7 @@ class W2vSentences:
self.f_name = f_name
def __iter__(self):
for line in open(self.f_name, "r"):
for line in open(self.f_name, mode="r", encoding="utf-8", errors="ignore"):
yield line.split()
......@@ -33,4 +33,8 @@ if __name__ == "__main__":
w2v_train("dispose_problem.txt", "w2v_model")
# input_file = os.path.join(data_dir, "dispose_problem.txt")
# for line in open(input_file, "r"):
# print(line)
print("total cost: {:.2f}mins".format((time.time() - begin_time) / 60))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment