Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:handle empty string transcriptions #150

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions ovos_dinkum_listener/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,20 +659,18 @@ def _record_end_signal(self):
)
self.bus.emit(Message("recognizer_loop:record_end"))

def _stt_text(self, transcripts: List[Tuple[str, float]],
stt_context: dict):
# Report utterance to intent service
if transcripts:
utts = [u[0] for u in transcripts] # filter confidence
def _stt_text(self, transcripts: List[Tuple[str, float]], stt_context: dict):
utts = [u[0] for u in transcripts if u[0].strip()]
LOG.debug(f"STT: {utts}")
if utts:
lang = stt_context.get("lang") or Configuration().get("lang", "en-us")
LOG.debug(f"STT: {utts}")
payload = {"utterances": utts,
"lang": lang}
payload = {"utterances": utts, "lang": lang}
self.bus.emit(Message("recognizer_loop:utterance", payload, stt_context))
elif self.voice_loop.listen_mode == ListeningMode.CONTINUOUS:
LOG.debug("ignoring transcription failure")
else:
self.bus.emit(Message("recognizer_loop:speech.recognition.unknown", context=stt_context))
if self.voice_loop.listen_mode != ListeningMode.CONTINUOUS:
self.bus.emit(Message("recognizer_loop:speech.recognition.unknown", context=stt_context))
else:
LOG.debug("Ignoring empty transcription in continuous listening mode")

def _save_stt(self, audio_bytes, stt_meta, save_path=None):
LOG.info("Saving Utterance Recording")
Expand Down
Loading