-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Google Cloud Speech : "Invalid JSON payload received. Unknown name "speech_context" at 'config': Cannot find field." #334
Comments
This issue was solved with pull request #304. Seems it is still present when installing via pip rather than from sources |
@dcam0050 I install from sources but still have the issue somehow, I don't see that in the code. The issue not |
I believe the issue is "speechContexts" over "speechContext", please check your pip installed code again. :-) |
This must be updated in pypi as well. When will it be done? |
Thanks, @avinashs24 for asking this! I was having the same trouble but on the suggestion of @lichengunc I changed from "SpeechContext" to "SpeechContexts" in the speech_recognition init file and it works fine. |
same here - changed it locally meanwhile but I'm sure havign this packaged would be nice for a lot of people since you stumble upon this pretty quickly when using google cloud speech |
Bug is still here. Downloaded the latest speech_recognition package (Version 3.8.1) from pip. Had to manually change it from speechContext to SpeechContexts in the speech_recognition init file. |
After the DYI fix on the init file, passphrase doesn't error anymore but I haven't noticed any increase in response time for the short one word commands I'm shouting. shouting doesn't help either Does anyone have any tips for speeding up these one word requests? |
Is it really fixed?
I see that it was merged, but it was sent to PyPi? (or better, will it be sent?) Speech Recognition 3.8.1 (holy shit, last release in 2017 ^ - ^ - it looks that the native client can be a good choice for context fine-tune) This package is just dead! |
@dcam0050 I installed the latest version from source (as suggested above) and ran
Perhaps version incompatibility? |
Was having the same issue. I fixed locally by changing it to |
Steps to reproduce
r.recognize_google_cloud(audio, credentials_json=GOOGLE_CLOUD_SPEECH_CREDENTIALS,preferred_phrases=['hi, hello']))
Expected behaviour
The request should be processed successfully and the audio input from microphone should be recognized as text.
Actual behaviour
Received the following exception,
I looked into the source of the recognize_google_cloud method,
if preferred_phrases is not None: speech_config["speechContext"] = {"phrases": preferred_phrases}
The key where preferred_phrases is included is given as speechContext, but when referred to official google cloud speech docs, its actually speechContexts. Below is the sample request json obtained from docs,
{ "config": { "encoding":"FLAC", "sampleRateHertz": 16000, "languageCode":"en-US", "speechContexts": { "phrases":["hoful","shwazil"] } }, "audio":{ "uri":"gs://speech-demo/shwazil_hoful.flac" } }
System information
My system is Windows 10 x64.
My Python version is 3.6.4.
My Pip version is 9.0.1
My SpeechRecognition library version is 3.8.1
My PyAudio library version is 0.2.11
My microphones are: ['Microsoft Sound Mapper - Input', 'Microphone (Realtek Audio)', 'Microsoft Sound Mapper - Output', 'Speakers / Headphones (Realtek ']
The text was updated successfully, but these errors were encountered: