Skip to content
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

output text file is blank when decoding file longer than 1 minute and save=True #117

Open
paxtonfitzpatrick opened this issue Feb 25, 2019 · 0 comments
Assignees

Comments

@paxtonfitzpatrick
Copy link
Member

in decode_speech.py, line 242
pd.DataFrame(parsed_results).to_csv(f + '.txt', header=False, index=False)
saves out a blank text file.

The looks like the results from the google cloud speech-to-text are being parsed properly. Lines 154-57

for result in chunk.results:
    alternative = result.alternatives[0]
    print('Transcript: {}'.format(alternative.transcript))
    print('Confidence: {}'.format(alternative.confidence))

print the transcripts and confidences properly and line 239
pickle.dump(results, open(f + ".p", "wb" ) )
saves out the pickled results object.

Could be an issue in pd.DataFrame.to_csv() inferring headers (header=Falsein line 242) or could be a suppressed error in line 229parsed_results = parse_response(results) when enable_word_time_offsets=False.
Will look into this later.

Code:

audiodir = os.path.abspath('../../data/audio/')
keypath = os.path.abspath('../../../google-credentials/cloud-speech-credentials.json')

for sid, data in rand5_turkids.items():
    print(sid + ':')
    for ses, turkid in data.items():
        
        if ses == 'session 1':
            audiofiles = [turkid+'-recall.wav', turkid+'-prediction.wav']
            ep_context = ep1_speech_context
        elif ses == 'session 2':
            audiofiles = [turkid+'-delayed.wav', turkid+'-recall.wav']
            if 'A' in sid:
                ep_context = ep2_speech_context
            elif 'B' in sid:
                ep_context = ep3_speech_context
            else:
                print('bad SID: ' + sid)
                continue
        else:
            print('session ID unrecognized for ' + sid + ', ' + ses)
            continue
        
        for audiofile in audiofiles:

                path = os.path.join(audiodir,'room1',turkid, audiofile)
                if not os.path.isfile(path):
                    path = os.path.join(audiodir,'room2',turkid, audiofile)
                    if not os.path.isfile(path):
                        print('AUDIO FILE NOT FOUND: ' + path)
                        continue

                print('\tdecoding ' + ses + ': ' + audiofile + ' ...')
                quail.decode_speech(path=path, keypath=keypath, save=True, speech_context=ep_context, enable_word_time_offsets=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant