From 752eed428f8607f9dcdb183473a9d594c7c04946 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 14 Jan 2022 08:48:55 -0500 Subject: [PATCH] cognigy: when use azuyre tts, request detailed output format --- lib/tasks/cognigy.js | 3 ++- lib/tasks/transcribe.js | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/tasks/cognigy.js b/lib/tasks/cognigy.js index 13fa5765..06b42edc 100644 --- a/lib/tasks/cognigy.js +++ b/lib/tasks/cognigy.js @@ -126,7 +126,8 @@ class Cognigy extends Task { const opts = { recognizer: this.data.recognizer || { vendor: 'default', - language: 'default' + language: 'default', + outputFormat: 'detailed' } }; this.logger.debug({opts}, 'constructing a nested transcribe object'); diff --git a/lib/tasks/transcribe.js b/lib/tasks/transcribe.js index f56f4bc0..0f768097 100644 --- a/lib/tasks/transcribe.js +++ b/lib/tasks/transcribe.js @@ -216,12 +216,18 @@ class TaskTranscribe extends Task { if ('aws' === this.vendor && Array.isArray(evt) && evt.length > 0) evt = evt[0]; if ('microsoft' === this.vendor) { const nbest = evt.NBest; - const alternatives = nbest.map((n) => { + const alternatives = nbest ? nbest.map((n) => { return { confidence: n.Confidence, transcript: n.Display }; - }); + }) : + [ + { + transcript: evt.DisplayText + } + ]; + const newEvent = { is_final: evt.RecognitionStatus === 'Success', alternatives