From 8a9a2df128bd49d73f4f9565886869afa07dc299 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Thu, 23 Feb 2023 12:54:21 -0500 Subject: [PATCH] early hints fix that was not merged --- lib/tasks/gather.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index 1b0c7547..9c948442 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -532,6 +532,15 @@ class TaskGather extends Task { evt = this.normalizeTranscription(evt, this.vendor, 1, this.language); + if (this.earlyHintsMatch && evt.is_final === false) { + const transcript = evt.alternatives[0].transcript?.toLowerCase(); + if (this.hints.find((h) => h.toLowerCase() === transcript)) { + this.logger.debug({evt}, 'Gather:_onTranscription: early hint match'); + this._resolve('speech', evt); + return; + } + } + /* count words for bargein feature */ const words = evt.alternatives[0]?.transcript.split(' ').length; const bufferedWords = this._bufferedTranscripts.reduce((count, e) => {