gcloud ml speech recognize, option for setting phrase/hint boost

Hi,

I am using the the gcloud ml speech recognize command line tool to test speech to text transcriptions. I am looking for a way to set the boost level for phrases/hints that are supplied in the --hints argument - similar to what can be set in RecognitionConfig of the REST API.

https://cloud.google.com/speech-to-text/docs/reference/rest/v1p1beta1/RecognitionConfig#speechcontext

I don’t see anything in the gcloud documentation for this but wondering if there is a way to do it.
https://cloud.google.com/sdk/gcloud/reference/ml/speech/recognize

Thanks,
Eoghan

Hi @eoghanoh ,

Welcome to Google Cloud Community.

The gcloud ml speech recognize command-line tool may not provide an option to set the boost level for hints or phrases. This is because the gcloud ml speech recognize tool uses the older *v1* version of the Speech-to-Text API, which doesn’t support setting boost levels for hints or phrases.

However, you can use the REST API directly to set boost levels for hints and phrases. You can do this by creating a RecognitionConfig JSON object with the appropriate boost levels, and passing it to the Speech-to-Text API via a POST request. You can use a program like *curl* or *httpie* to send a *POST* request to the Speech-to-Text API with this RecognitionConfigJSON object.To use the boost capability, you must activate the Speech-to-Text API’s v1p1beta1 version.

Here are some documentations you may use as a reference:
https://cloud.google.com/speech-to-text/docs/quickstart-client-libraries#before-you-begin
https://cloud.google.com/speech-to-text/docs/adaptation-model?_ga=2.149903862.-1392753435.1676655686
https://cloud.google.com/sdk/gcloud/reference/alpha/ml/speech/recognize?_ga=2.149903862.-1392753435
https://cloud.google.com/speech-to-text/docs/reference/rest/v1p1beta1/projects.locations.phraseSets?..
https://cloud.google.com/speech-to-text/docs/best-practices-provide-speech-data?_ga=2.149903862.-139

1 Like

Thanks for the reply and information. I moved to use the Google speech python library with the v1p1beta1 API and was able to set the boost level.

Thanks again .

Eoghan

1 Like