218bc5980ee488f5ac2ddfb9d3c67b8ba5b3fd69,speech/cloud-client/transcribe_streaming.py,,transcribe_streaming,#Any#,29
Before Change
speech_client = speech.Client()
with io.open(stream_file, "rb") as audio_file:
audio_sample = speech_client.sample(
stream=audio_file,
encoding=speech.encoding.Encoding.LINEAR16,
sample_rate_hertz=16000)
alternatives = audio_sample.streaming_recognize("en-US")
for alternative in alternatives:
print("Finished: {}".format(alternative.is_final))
print("Stability: {}".format(alternative.stability))
print("Confidence: {}".format(alternative.confidence))
print("Transcript: {}".format(alternative.transcript))
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
After Change
// streaming_recognize returns a generator.
// [START migration_streaming_response]
responses = client.streaming_recognize(streaming_config, requests)
// [END migration_streaming_request]
for response in responses:
for result in response.results:
print("Finished: {}".format(result.is_final))
print("Stability: {}".format(result.stability))
alternatives = result.alternatives
for alternative in alternatives:
print("Confidence: {}".format(alternative.confidence))
print("Transcript: {}".format(alternative.transcript))
// [END migration_streaming_response]
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 218bc5980ee488f5ac2ddfb9d3c67b8ba5b3fd69
Time: 2017-07-14
Author: dizcology@hotmail.com
File Name: speech/cloud-client/transcribe_streaming.py
Class Name:
Method Name: transcribe_streaming
Project Name: uber/pyro
Commit Name: 3040d26d11096c12daf417cd46912bb30f5dafab
Time: 2020-04-21
Author: fehiepsi@gmail.com
File Name: pyro/infer/mcmc/hmc.py
Class Name: HMC
Method Name: _sample_r
Project Name: OpenMined/Grid
Commit Name: d51dd50f93232f5542df1a8ccb2d91cee17c52d8
Time: 2020-07-08
Author: hericles.me@gmail.com
File Name: grid/app/main/sfl/cycles/cycle_manager.py
Class Name: CycleManager
Method Name: _average_plan_diffs