I receive more than one final transcript of the Speech to text IBM cloud service

I am working with the Speech to text service on a project in Angular, I am converting the voice coming in from the microphone to text and when I receive transcriptions sometimes the service returns more than one final transcription. There is some way to control this, as I need only one final transcript returned.

These are the parameters I send to the service

 accessToken: a.token,
      format: true,
      extractResults: true,
      objectMode: true,
      model: "es-PE_NarrowbandModel"
  var rsOpts = assign(
    {
      contentType: 'audio/l16;rate=16000',
      interimResults: true,
      keywords: ["ok", "okay"],
      keywordsThreshold: 0.5,
      wordConfidence: true,
      backgroundAudioSuppressio: 0.5,
      inactivity_timeout: -1
    },
    options
  );

In the documentation it mentions that interimResults is where the number of transcripts is limited but by putting it in false I don't receive any transcripts

Upvotes: 0

Views: 73

Answers (1)

chughts
chughts

Reputation: 4747

If you don't want interimResults then that should be set to false. That will not give you any results if its not a final. If you want to see only 1 final result then you need to set maxAlternatives to 1.

If you are only getting results when you switch on interimResults then this indicates that you are never getting the final transcription. ie. the audio input is never terminating. What you might need to do is modify inactivityTimeout to a value large enough so that between sentence pauses are ignored, but smaller than the default of 30 seconds, so that the end of a track can be detected.

Upvotes: 0

Related Questions