early hints fix that was not merged

This commit is contained in:
Dave Horton
2023-02-23 12:54:21 -05:00
parent 3a3544a5e8
commit 8a9a2df128

View File

@@ -532,6 +532,15 @@ class TaskGather extends Task {
evt = this.normalizeTranscription(evt, this.vendor, 1, this.language); 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 */ /* count words for bargein feature */
const words = evt.alternatives[0]?.transcript.split(' ').length; const words = evt.alternatives[0]?.transcript.split(' ').length;
const bufferedWords = this._bufferedTranscripts.reduce((count, e) => { const bufferedWords = this._bufferedTranscripts.reduce((count, e) => {