|
@@ -248,24 +248,24 @@ class XfAsr:
|
|
|
while self.ws.connected:
|
|
|
result = str(self.ws.recv())
|
|
|
if len(result) == 0:
|
|
|
- print("receive result end")
|
|
|
+ self.logger.info("xunfei.Asr.recv: receive result end")
|
|
|
break
|
|
|
result_dict = json.loads(result)
|
|
|
# 解析结果
|
|
|
if result_dict["action"] == "started":
|
|
|
- print("handshake success, result: " + result)
|
|
|
+ self.logger.info("xunfei.Asr.recv: handshake success, result: " + result)
|
|
|
|
|
|
if result_dict["action"] == "result":
|
|
|
result_1 = result_dict
|
|
|
# result_2 = json.loads(result_1["cn"])
|
|
|
# result_3 = json.loads(result_2["st"])
|
|
|
# result_4 = json.loads(result_3["rt"])
|
|
|
- print("rtasr result: " + result_1["data"])
|
|
|
+ self.logger.info("xunfei.Asr.recv: rtasr result: " + result_1["data"])
|
|
|
|
|
|
if result_dict["action"] == "error":
|
|
|
- print("rtasr error: " + result)
|
|
|
+ self.logger.info("xunfei.Asr.recv: rtasr error: " + result)
|
|
|
self.ws.close()
|
|
|
return
|
|
|
except Exception as e:
|
|
|
traceback.print_exc()
|
|
|
- print("receive result end", e)
|
|
|
+ self.logger.error("xunfei.Asr.recv: receive result end", e)
|