未验证 提交 185b7e0f 编写于 作者: K kinghuin 提交者: GitHub

modify check_input_data (#837)

上级 cbaf2477
......@@ -185,26 +185,12 @@ class NLPPredictionModule(NLPBaseModule):
input_data = []
if args.input_file:
if not os.path.exists(args.input_file):
print("File %s is not exist." % args.input_file)
raise RuntimeError
raise FileNotFoundError(
"File %s does not exist." % args.input_file)
else:
input_data = txt_parser.parse(args.input_file, use_strip=True)
elif args.input_text:
if args.input_text.strip() != '':
if six.PY2:
input_data = [
args.input_text.decode(
sys_stdin_encoding()).decode("utf8")
]
else:
input_data = [args.input_text]
else:
print(
"ERROR: The input data is inconsistent with expectations.")
if input_data == []:
print("ERROR: The input data is inconsistent with expectations.")
raise DataFormatError
input_data = [args.input_text]
return input_data
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册