diff --git a/cpqdasr/recognizer/speech_recognizer.py b/cpqdasr/recognizer/speech_recognizer.py index 31c7779..035fb21 100644 --- a/cpqdasr/recognizer/speech_recognizer.py +++ b/cpqdasr/recognizer/speech_recognizer.py @@ -177,7 +177,7 @@ def wait_recognition_result(self): self._cv_wait_recog.wait(self._max_wait_seconds) if self._ws.status == "ABORTED": self._ws.recognition_list = [] - return [] + raise RecognitionException("ABORTED", self._ws._error_msg) elif self._ws.status not in [ "RECOGNIZED", "NO_MATCH", diff --git a/cpqdasr/recognizer_protocol/ws4py_api.py b/cpqdasr/recognizer_protocol/ws4py_api.py index d05759d..0f5f178 100644 --- a/cpqdasr/recognizer_protocol/ws4py_api.py +++ b/cpqdasr/recognizer_protocol/ws4py_api.py @@ -66,6 +66,7 @@ def __init__( self._config = config self._logger = logging.getLogger("cpqdasr") self._status = "DISCONNECTED" + self._error_msg = "" self._cv_define_grammar = cv_define_grammar self._time_define_grammar = 0 self._cv_create_session = cv_create_session @@ -158,9 +159,8 @@ def received_message(self, msg): with self._cv_define_grammar: self._cv_define_grammar.notify_all() else: - self._logger.warning( - "Error on defining grammar: " "{}".format(msg.data) - ) + self._error_msg = "Error on defining grammar: " "{}".format(msg.data) + self._logger.warning(self._error_msg) self._abort() return if h["Method"] == "START_RECOGNITION": @@ -170,9 +170,8 @@ def received_message(self, msg): with self._cv_send_audio: self._cv_send_audio.notify_all() else: - self._logger.warning( - "Error on start recognition: " "{}".format(msg.data) - ) + self._error_msg = "Error on start recognition: " "{}".format(msg.data) + self._logger.warning(self._error_msg) self._abort() return diff --git a/setup.py b/setup.py index 6ad7c35..c2dba9b 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setup( name="cpqdasr", - version="1.0.0", + version="1.2.0", description="CPqD ASR SDK implementation using websockets in Python", long_description=readme, install_requires=install_requires,