python-docs-samples icon indicating copy to clipboard operation
python-docs-samples copied to clipboard

speech: is_final not returning true for stream in German, French, Spanish, but working for English

Open zinnen opened this issue 2 years ago • 2 comments

In which file did you encounter the issue?

python-docs-samples/speech/microphone/transcribe_streaming_mic.py

Did you change the file? If so, how?

  • add credentials in the beginning

  • change language_code to de-DE or fr-FR

  • line 174 ff (just print the transcript and the is_final state continue afterwards)

transcript = result.alternatives[0].transcript print(transcript, result.is_final) continue

Describe the issue

in English, the is_final state will turn to true (everything works fine), but does not for German, French or Spanish the end of sequence is not detected or returned

Please replace *.json by the real json-file-name githubSpeechToText.txt

image image image

zinnen avatar Sep 10 '23 20:09 zinnen

From the perspective of the sample, there is nothing wrong and if speech is recognised it will be marked as is_final.

I was able to reproduce this and created few sample audio files to play with in different languages (https://github.com/GoogleCloudPlatform/python-docs-samples/pull/11868). As a matter of fact, I was playing those audio files via built-in speaker and most of the samples were recognised to final state (except french in all the cases), when I were in quiet space without any other sounds. If there will be background noises, the words still get transcribed, but the result won't be marked as final.

BigBlackWolf avatar Jun 18 '24 09:06 BigBlackWolf

Reported to the product team as 349812897. Waiting for their response.

m-strzelczyk avatar Jun 27 '24 15:06 m-strzelczyk