cognigy: when use azuyre tts, request detailed output format

This commit is contained in:
Dave Horton
2022-01-14 08:48:55 -05:00
parent afb874aabc
commit 752eed428f
2 changed files with 10 additions and 3 deletions

View File

@@ -126,7 +126,8 @@ class Cognigy extends Task {
const opts = { const opts = {
recognizer: this.data.recognizer || { recognizer: this.data.recognizer || {
vendor: 'default', vendor: 'default',
language: 'default' language: 'default',
outputFormat: 'detailed'
} }
}; };
this.logger.debug({opts}, 'constructing a nested transcribe object'); this.logger.debug({opts}, 'constructing a nested transcribe object');

View File

@@ -216,12 +216,18 @@ class TaskTranscribe extends Task {
if ('aws' === this.vendor && Array.isArray(evt) && evt.length > 0) evt = evt[0]; if ('aws' === this.vendor && Array.isArray(evt) && evt.length > 0) evt = evt[0];
if ('microsoft' === this.vendor) { if ('microsoft' === this.vendor) {
const nbest = evt.NBest; const nbest = evt.NBest;
const alternatives = nbest.map((n) => { const alternatives = nbest ? nbest.map((n) => {
return { return {
confidence: n.Confidence, confidence: n.Confidence,
transcript: n.Display transcript: n.Display
}; };
}); }) :
[
{
transcript: evt.DisplayText
}
];
const newEvent = { const newEvent = {
is_final: evt.RecognitionStatus === 'Success', is_final: evt.RecognitionStatus === 'Success',
alternatives alternatives