GoogleCloudPlatform / python-docs-samples

Code samples used on cloud.google.com
Apache License 2.0
7.45k stars 6.44k forks source link

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

Open zinnen opened 1 year ago

zinnen commented 1 year ago

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?

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
BigBlackWolf commented 4 months ago

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.

m-strzelczyk commented 4 months ago

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