| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Append 's' to speechContext in order to work with the API. Stracktrace without:
File "/usr/local/lib/python2.7/dist-packages/google/cloud/speech/sample.py", line 300, in recognize
profanity_filter, speech_contexts)
File "/usr/local/lib/python2.7/dist-packages/google/cloud/speech/_http.py", line 165, in recognize
method='POST', path='speech:recognize', data=data)
File "/usr/local/lib/python2.7/dist-packages/google/cloud/_http.py", line 303, in api_request
error_info=method + ' ' + url)
google.cloud.exceptions.BadRequest: 400 Invalid JSON payload received. Unknown name "speech_context" at 'config': Cannot find field. (POST https://speech.googleapis.com/v1/speech:recognize)
Aborted (core dumped)
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.
|
Sorry, something went wrong.
|
I signed it! |
Sorry, something went wrong.
|
CLAs look good, thanks! |
Sorry, something went wrong.
|
@p-siegel Thanks for the patch! We also need to adjust the tests to match (i.e., in tests/unit/test_client.py). |
Sorry, something went wrong.
|
It would be best if we could add / modify a system test which exercises the failing case, too. |
Sorry, something went wrong.
|
@tseaver We could just send commits to this PR to help it along? |
Sorry, something went wrong.
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate. |
Sorry, something went wrong.
|
The speech system tests are failing on master for me at the moment (#3392) so I'm not going to hold this PR up for them (and there are tests which set speech_contexts, anyway). |
Sorry, something went wrong.
|
Hello, I just tried these examples over the weekend here but it seems it works only when I specified one word: So if I add "shwazil" to speech_contexts, that works, but if I add ["shwazil", "hoful"], it just recognizes shwazil but leaves the hoful word untouched and it is not recognized properly. Is this example working for you? Thanks, |
Sorry, something went wrong.
|
Hi, |
Sorry, something went wrong.
|
@zoell, are you running from a Git clone, or from the released version on PyPI. If the latter, this PRs changes have not yet been released. |
Sorry, something went wrong.
|
@p-siegel Can you provide a Python sample of how you pass in the multiple words? I'm assuming something like: sample = client.sample(
encoding=speech.Encoding.FLAC,
sample_rate_hertz=16000,
source_uri='gs://speech-demo/shwazil_hoful.flac',
)
results = sample.recognize(
language_code='en-US',
speech_contexts=['hoful', 'shwazil'],
)or else maybe: sample = client.sample(
encoding=speech.Encoding.FLAC,
sample_rate_hertz=16000,
source_uri='gs://speech-demo/shwazil_hoful.flac',
)
results = sample.recognize(
language_code='en-US',
speech_contexts=['shwazil hoful'],
) |
Sorry, something went wrong.
|
Here is what I get: >>> r1 = sample.recognize(
... language_code='en-US',
... speech_contexts=['hoful', 'shwazil'],
... )
>>> r1[0].alternatives[0].__dict__
{'_confidence': 0.7818678021430969, '_transcript': u"it's a shwazil huffel day"}
>>> r2 = sample.recognize(
... language_code='en-US',
... speech_contexts=['shwazil hoful'],
... )
>>> r2[0].alternatives[0].__dict__
{'_confidence': 0.7818678021430969, '_transcript': u"it's a shwazil huffel day"} |
Sorry, something went wrong.
|
@tseaver Here is what I used: Looks pretty much the same. with open('./shwazil_hoful.flac', 'rb') as speech:
speech_content = speech.read()
sample = client.sample(
speech_content,
source_uri=None,
encoding='FLAC',
sample_rate_hertz=16000
)
response = sample.recognize(
language_code='en-US',
speech_contexts=['shwazil', 'hoful']
)
The response is exactly the same as yours. |
Sorry, something went wrong.
|
I installed the PyPI version but changed _http.py to this one. |
Sorry, something went wrong.
|
This is an issue with the back-end API sample doc. I just tried the same request in the "Try It!" form for the recognize API docs: {
"config": {
"encoding": "FLAC",
"sampleRateHertz": 16000,
"languageCode": "en-US",
"speechContexts": [
{
"phrases": [
"hoful",
"shwazil"
]
}
]
},
"audio": {
"uri": "gs://speech-demo/shwazil_hoful.flac"
}
}with the same result: {
"results": [
{
"alternatives": [
{
"transcript": "it's a shwazil huffel day",
"confidence": 0.7818678
}
]
}
]
} |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Append 's' to speechContext in order to work with the API. Stracktrace without:
File "/usr/local/lib/python2.7/dist-packages/google/cloud/speech/sample.py", line 300, in recognize
profanity_filter, speech_contexts)
File "/usr/local/lib/python2.7/dist-packages/google/cloud/speech/_http.py", line 165, in recognize
method='POST', path='speech:recognize', data=data)
File "/usr/local/lib/python2.7/dist-packages/google/cloud/_http.py", line 303, in api_request
error_info=method + ' ' + url)
google.cloud.exceptions.BadRequest: 400 Invalid JSON payload received. Unknown name "speech_context" at 'config': Cannot find field. (POST https://speech.googleapis.com/v1/speech:recognize)
Aborted (core dumped)