transcribe.py
def on_close(ws):
    """Upon close, print the complete and final transcript."""
    global LAST
    if LAST:
        FINALS.append(LAST)
    transcript = ".\n".join([x['results'][0]['alternatives'][0]['transcript']
                          for x in FINALS])

    print(transcript)
    # transcript = transcript.encode('UTF-8')
    with open('speech_text.txt', 'w') as f:
        f.write(transcript)
    f.close()
Upon close, print the complete and final transcript.
Upon close, print the complete and final transcript.
Upon close print the complete and final transcript .
def on_close(ws):
    global LAST
    if LAST:
        FINALS.append(LAST)
    transcript = ".\n".join([x['results'][0]['alternatives'][0]['transcript']
                          for x in FINALS])
    print(transcript)
    with open('speech_text.txt', 'w') as f:
        f.write(transcript)
    f.close()
def on_close ( ws ) : global LAST if LAST : FINALS . append ( LAST ) transcript = ".\n" . join ( [ x [ 'results' ] [ 0 ] [ 'alternatives' ] [ 0 ] [ 'transcript' ] for x in FINALS ] ) print ( transcript ) with open ( 'speech_text.txt' , 'w' ) as f : f . write ( transcript ) f . close ( )
Upon close, print the complete and final transcript.
Upon close print the complete and final transcript .
"""Upon close, print the complete and final transcript.""" # transcript = transcript.encode('UTF-8')
ws