You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Result returned from google.cloud.speech.sample.Sample.streaming_recognize #3166
The streaming_recognize method of Sample computes its output as follows:
for response in responses:
for result in response.results:
if result.is_final or interim_results:
yield StreamingSpeechResult.from_pb(result)
Thus, it returns a generator where results are no longer grouped by response. I feel that this makes it more difficult for the end user to use the results, since results from the same response should be concatenated in order to obtain the complete transcript of the fragment transcribed so far.
@daspecster I am indeed using interim_results=True and want to use live results as they come in. As far as I could figure out from the content of the responses, results from the same response are to be concatenated to get the current transcription of the video, whereas new responses overwrite older ones. Thus, if I don't know when a new response starts (because I only see a flow of results), I don't know when to concatenate and when to overwrite.
The example provided at python-docs-samples/speech/grpc/transcribe_streaming.py uses only the first result in order to show real time transcription results:
result = resp.results[0]
transcript = result.alternatives[0].transcript
Even in that case, one still needs to know which is the first result from each response.
@daspecster Yeah, result_index would be enough for my current project.
It would also be useful if endpointer_type can be exposed somehow: for example it could help identify segments containing speech inside a larger audio file. Assuming of course that the value of endpointer_type is reliable in the current version of the API. I am making the implicit assumption that all values inside a response are reliable enough to be sent over, which is why I was a bit confused that some of them are hidden from the end user.
Since this ticket was filed, we have released a new Speech library which entails effectively a complete rewrite. Since it is very likely to solve this issue, I am closing this. However, please feel free to reopen if my closure is premature.
Note: Make sure you are using google.cloud.speech.SpeechClient, as the old Client still exists as a deprecated artifact for a little longer.
Activity
daspecster commentedon Mar 20, 2017
@cgratie if you set
interin_resultstoTrue, it will pass the live results as they are received.I which case you could concatenate them. Does that answer your question?
cgratie commentedon Mar 20, 2017
@daspecster I am indeed using
interim_results=Trueand want to use live results as they come in. As far as I could figure out from the content of the responses, results from the same response are to be concatenated to get the current transcription of the video, whereas new responses overwrite older ones. Thus, if I don't know when a new response starts (because I only see a flow of results), I don't know when to concatenate and when to overwrite.The example provided at python-docs-samples/speech/grpc/transcribe_streaming.py uses only the first result in order to show real time transcription results:
Even in that case, one still needs to know which is the first result from each response.
daspecster commentedon Mar 21, 2017
@cgratie ok, cool.
I think I'm starting to grasp the issue. I think what you need access to is the
result_index?That way you can update in place the results.
cgratie commentedon Mar 21, 2017
@daspecster Yeah,
result_indexwould be enough for my current project.It would also be useful if
endpointer_typecan be exposed somehow: for example it could help identify segments containing speech inside a larger audio file. Assuming of course that the value ofendpointer_typeis reliable in the current version of the API. I am making the implicit assumption that all values inside a response are reliable enough to be sent over, which is why I was a bit confused that some of them are hidden from the end user.lukesneeringer commentedon Aug 8, 2017
Since this ticket was filed, we have released a new Speech library which entails effectively a complete rewrite. Since it is very likely to solve this issue, I am closing this. However, please feel free to reopen if my closure is premature.
Note: Make sure you are using
google.cloud.speech.SpeechClient, as the oldClientstill exists as a deprecated artifact for a little longer.