d0e0042b5bdb9af188f9deb6ded5f56e6ba50fb6,speech/grpc/transcribe_streaming.py,,listen_print_loop,#Any#,166

Before Change



        // Exit recognition if any of the transcribed phrases could be
        // one of our keywords.
        if any(re.search(r"\b(exit|quit)\b", alt.transcript, re.I)
               for result in resp.results
               for alt in result.alternatives):
            print("Exiting..")
            break

After Change


        if resp.error.code != code_pb2.OK:
            raise RuntimeError("Server error: " + resp.error.message)

        if not resp.results:
            continue

        // Display the top transcription
        result = resp.results[0]
        transcript = result.alternatives[0].transcript

        // Display interim results, but with a carriage return at the end of the
        // line, so subsequent lines will overwrite them.
        if not result.is_final:
            // If the previous result was longer than this one, we need to print
            // some extra spaces to overwrite the previous result
            overwrite_chars = " " * max(0, num_chars_printed - len(transcript))

            sys.stdout.write(transcript + overwrite_chars + "\r")
            sys.stdout.flush()

            num_chars_printed = len(transcript)

        else:
            print(transcript)

            // Exit recognition if any of the transcribed phrases could be
            // one of our keywords.
            if re.search(r"\b(exit|quit)\b", transcript, re.I):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: d0e0042b5bdb9af188f9deb6ded5f56e6ba50fb6
Time: 2016-10-21
Author: jerjou@users.noreply.github.com
File Name: speech/grpc/transcribe_streaming.py
Class Name:
Method Name: listen_print_loop


Project Name: idaholab/raven
Commit Name: 8ad7ca870d68695fd47d9962e565a1e0f7f73f8c
Time: 2021-01-25
Author: paul.talbot@inl.gov
File Name: framework/CodeInterfaces/RAVEN/RAVENInterface.py
Class Name: RAVEN
Method Name: checkForOutputFailure


Project Name: AllenCellModeling/pytorch_fnet
Commit Name: 2b4dfea5674a6b6b4d6556d7546a387f41f947fa
Time: 2017-11-10
Author: chek.o@outlook.com
File Name: tools/colorize_tifs.py
Class Name:
Method Name: