Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Speech-to-Text API word confidence score missing

Why are confidence scores missing for some words? We want to display the transcription on our website and highlight the unconfident word determined by the confidence score, so an admin can easily fix the false transcription. However, we found out that some words returned by API don't include a confidence score. Here is our API request body.

POST https://speech.googleapis.com/v2/projects/<project-id>/locations/global/recognizers/_:batchRecognize
{
  "config": {
    "model": "long",
    "languageCodes": ["th-TH"],
    "features": {
      "enableWordTimeOffsets": true,
      "enableWordConfidence": true
    },
    "autoDecodingConfig": {}
  },
  "files": [
    {
      "uri": "gs://xxxxxx.mp3"
    }
  ],
  "recognitionOutputConfig": {
    "gcsOutputConfig": {
      "uri": "gs://output/xxxxxx"
    }
  }
}

Screenshot from 2024-02-27 17-22-21 (1).png

0 2 599
2 REPLIES 2

There could be several reasons why confidence scores are missing for some words:

  1. Model limitations: The confidence scores provided by the Speech-to-Text API are estimates based on various factors such as audio quality, speech clarity, language complexity, and context. Sometimes, due to limitations in the model or complexity of the speech, confidence scores may not be reliably estimated for certain words.

  2. Audio quality: Confidence scores heavily depend on the quality of the audio input. If the audio is of poor quality, contains background noise, or has overlapping speech, the API may struggle to provide accurate confidence scores for individual words.

  3. Speech characteristics: Certain speech patterns or accents may pose challenges for the API in accurately estimating confidence scores. If the speech contains unusual vocabulary, slang, or specialized terminology, the API may have difficulty assigning confidence scores to those words.

  4. Language support: While Google's Speech-to-Text API supports a wide range of languages and dialects, the quality of confidence scores may vary depending on the language. It's possible that for some languages or language variants, confidence score estimation is less reliable.

  5. API configuration: Review your API request configuration to ensure that you've enabled word-level confidence scores (enableWordConfidence set to true). Additionally, check if any optional parameters or settings could affect the generation of confidence scores.

  6. Service updates: Google frequently updates its Speech-to-Text API to improve performance and accuracy. It's possible that missing confidence scores for certain words could be addressed in future updates.

To mitigate this issue, you could consider the following approaches:

  • Manual review: Even without confidence scores for every word, you can still highlight potentially inaccurate transcriptions for manual review by administrators. You might prioritize words with lower confidence scores or those flagged by users as potentially incorrect.

  • Alternative APIs: Explore alternative speech recognition APIs or services that offer different approaches to confidence score estimation. It's possible that a different API may provide more reliable confidence scores for your use case.

  • Feedback loop: Establish a feedback mechanism where administrators can provide corrections or feedback on transcriptions. This can help improve the accuracy of future transcriptions and refine the speech recognition model over time.

By understanding the potential reasons for missing confidence scores and adopting appropriate strategies, you can improve the accuracy and reliability of your transcription process.

Thanks for the suggestion. However, as you can see in the post, I included the API request, which already includes `enableWordConfidence`. Is there a parameter I need to add in order to ensure the confidence score?