未验证 提交 8539b677 编写于 作者: G Guo Sheng 提交者: GitHub

To avoid the data decode error in python3. (#2522)

上级 836f4378
......@@ -278,7 +278,7 @@ class DataReader(object):
with open(dict_path, "rb") as fdict:
for idx, line in enumerate(fdict):
if six.PY3:
line = line.decode()
line = line.decode("utf8", errors="ignore")
if reverse:
word_dict[idx] = line.strip("\n")
else:
......
......@@ -278,7 +278,7 @@ class DataReader(object):
with open(dict_path, "rb") as fdict:
for idx, line in enumerate(fdict):
if six.PY3:
line = line.decode()
line = line.decode("utf8", errors="ignore")
if reverse:
word_dict[idx] = line.strip("\n")
else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册