Skip to content

Commit

Permalink
Corrige retorno em caso de erro em 'wait_recognition_result'
Browse files Browse the repository at this point in the history
  • Loading branch information
Luís Gustavo Deprá Cuozzo committed Jun 27, 2024
1 parent 7ae76f4 commit d57d0c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cpqdasr/recognizer/speech_recognizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 5 additions & 6 deletions cpqdasr/recognizer_protocol/ws4py_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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":
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d57d0c8

Please sign in to comment.