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

modify check_input_data (#837)

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