per recommendation from microsoft, do NOT sort transcripts by confidence: first transcript in the returned list is 'best'

This commit is contained in:
Dave Horton
2022-04-17 17:53:16 -04:00
parent 29dec24095
commit 359cb82d80
2 changed files with 8 additions and 1 deletions

View File

@@ -362,7 +362,9 @@ class TaskGather extends Task {
if ('microsoft' === this.vendor) {
const final = evt.RecognitionStatus === 'Success';
if (final) {
const nbest = evt.NBest.sort((a, b) => b.Confidence - a.Confidence);
// don't sort based on confidence: https://github.com/Azure-Samples/cognitive-services-speech-sdk/issues/1463
//const nbest = evt.NBest.sort((a, b) => b.Confidence - a.Confidence);
const nbest = evt.NBest;
evt = {
is_final: true,
alternatives: [

View File

@@ -253,6 +253,11 @@ class TaskTranscribe extends Task {
evt = newEvent;
}
if (evt.alternatives[0].transcript === '' && !cs.callGone && !this.killed) {
this.logger.info({evt}, 'TaskGather:_onTranscription - got empty transcript, listen again');
return this._transcribe(ep);
}
if (this.transcriptionHook) {
const b3 = this.getTracingPropagation();
const httpHeaders = b3 && {b3};