python-docs-samples icon indicating copy to clipboard operation
python-docs-samples copied to clipboard

How do I input "Context" hints on the new long_running_recognize function?

Open gerimo opened this issue 9 years ago • 3 comments

In which file did you encounter the issue?

On the previous version I would input a "context" module in "async_recognize()".

Did you change the file? If so, how?

Describe the issue

gerimo avatar Apr 10 '17 18:04 gerimo

@gerimo According to our google-cloud-python client library source code (https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/speech/google/cloud/speech/sample.py#L135), you can pass in a parameter called speech_contexts.

:param speech_contexts: A list of strings (max 50) containing words and phrases "hints" so that the speech recognition is more likely to recognize them. This can be used to improve the accuracy for specific words and phrases. This can also be used to add new words to the vocabulary of the recognizer.

@gguuss Maybe we should update our google-cloud documentation (https://googlecloudplatform.github.io/google-cloud-python/stable/speech-sample.html) with information about long_running_recognize().

ryanmats avatar Apr 10 '17 18:04 ryanmats

@ryanmats Thanks for the heads up, we are working on it!

gguuss avatar Apr 10 '17 20:04 gguuss

In the old API, the parameter for "async_recognize" is called "speech_context". Looks like the new function adds an 's' to call it "speech_contexts". I got it to work that way. API docs are still outdated here.

agsax2020 avatar Jun 19 '17 19:06 agsax2020