This page describes how to request an enhanced speech recognition model when you send a transcription request to Speech-to-Text.
There are currently two enhanced models: phone call and video. These models have been optimized to more accurately transcribe audio data from these specific sources. See the supported languages page to see if the enhanced models are available for your language.
Google creates and improves enhanced models based on data collected through data logging. While opting in to data logging is not required in order to use enhanced models, if you do opt in you can help Google improve these models and also enjoy a discount on your usage.
To use the enhanced recognition models set the following fields in RecognitionConfig:
- Set
useEnhanced
totrue
. - Pass either the
phone_call
orvideo
string in themodel
field.
Speech-to-Text supports enhanced models for
all speech recognition methods:
speech:recognize
speech:longrunningrecognize
,
and Streaming.
The following code samples demonstrate how to request to use an enhanced model for a transcription request.
Protocol
Refer to the speech:recognize
API endpoint for
complete details.
To perform synchronous speech recognition, make a POST
request and provide the
appropriate request body. The following shows an example of a POST
request using
curl
. The example uses the access token for a service account set up for the
project using the Google Cloud
Cloud SDK. For instructions on installing the Cloud SDK,
setting up a project with a service account, and obtaining an access token,
see the quickstart.
curl -s -H "Content-Type: application/json" \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ https://speech.googleapis.com/v1/speech:recognize \ --data '{ "config": { "encoding": "LINEAR16", "languageCode": "en-US", "enableWordTimeOffsets": false, "enableAutomaticPunctuation": true, "model": "phone_call", "useEnhanced": true }, "audio": { "uri": "gs://cloud-samples-tests/speech/commercial_mono.wav" } }'
See the RecognitionConfig
reference
documentation for more information on configuring the request body.
If the request is successful, the server returns a 200 OK
HTTP
status code and the response in JSON format:
{ "results": [ { "alternatives": [ { "transcript": "Hi, I'd like to buy a Chromecast. I was wondering whether you could help me with that.", "confidence": 0.8930228 } ], "resultEndTime": "5.640s" }, { "alternatives": [ { "transcript": " Certainly, which color would you like? We are blue black and red.", "confidence": 0.9101991 } ], "resultEndTime": "10.220s" }, { "alternatives": [ { "transcript": " Let's go with the black one.", "confidence": 0.8818244 } ], "resultEndTime": "13.870s" }, { "alternatives": [ { "transcript": " Would you like the new Chromecast Ultra model or the regular Chromecast?", "confidence": 0.94733626 } ], "resultEndTime": "18.460s" }, { "alternatives": [ { "transcript": " Regular Chromecast is fine. Thank you. Okay. Sure. Would you like to ship it regular or Express?", "confidence": 0.9519095 } ], "resultEndTime": "25.930s" }, { "alternatives": [ { "transcript": " Express, please.", "confidence": 0.9101229 } ], "resultEndTime": "28.260s" }, { "alternatives": [ { "transcript": " Terrific. It's on the way. Thank you. Thank you very much. Bye.", "confidence": 0.9321616 } ], "resultEndTime": "34.150s" } ] }
C#
Go
Python
Java
Node.js
PHP
Ruby
What's next
Review how to make synchronous transcription requests.