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

Fixing enable_word_time_offsets #679

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nahakiole
Copy link

I got the following error when trying to use show_all with google cloud speech:

Traceback (most recent call last):
  File "main.py", line 47, in <module>
    sentence = r.recognize_google_cloud(audio, credentials_json=GOOGLE_CLOUD_SPEECH_CREDENTIALS,  language="de-DE", show_all=True)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../.../lib/python3.11/site-packages/speech_recognition/__init__.py", line 798, in recognize_google_cloud
    config = speech.RecognitionConfig(**config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../.../lib/python3.11/site-packages/proto/message.py", line 565, in __init__
    raise ValueError(
ValueError: Unknown field for RecognitionConfig: enableWordTimeOffset

Changing the field to "enable_word_time_offsets" fixes the error and provides the word time offset for each word.

Fixes ValueError: Unknown field for RecognitionConfig: enableWordTimeOffset.
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

Successfully merging this pull request may close these issues.

1 participant