-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speech API Operation Class doesn't return full results #444
Comments
Update: After reading more of this, with sufficiently long audio, this will simply return the wrong result. With long audio, there are multiple results, corresponding to sequential segments of audio, this will return all of the alternatives from the first segment, and nothing for subsequent segments. |
Thanks for the report @adziuk, I'll get this fixed today. Do you know under what conditions a response is broken into multiple result sets? I was originally under the impression the multiple result sets were for streaming calls. |
When you set maxAlternatives (from https://cloud.google.com/speech-whitelist/docs/reference/rest/v1/RecognitionConfig) to a value greater than 1 then the API returns more than one alternative, regardless of whether you use recognize or LongRunningRecognize. The confidence scores for the results beyond first one are usually missing. |
Things are generally broken into multiple result sets with longer audio, Audio around 60 seconds long looks like it's generally broken into multiple "results", for example, from the attached file (LINEAR16, sample rate = 44100)
|
In google-cloud-php/src/Speech/Operation.php
This function assumes that the results are fixed to 1 alternative, putting max_alternatives > 1, however, can result in more alternatives being returned. There are other optional settings to the RecognizeRequest that can change the contents of the results to include information other than just the alternatives, so I'm not sure how users are supposed to access that data.
The text was updated successfully, but these errors were encountered: