Skip to content

Latest commit

 

History

History
85 lines (75 loc) · 2.05 KB

Recognize.md

File metadata and controls

85 lines (75 loc) · 2.05 KB

Recognize

Performs a synchronous speech recognition i.e receive results after all audio has been sent and processed.

Note: Audios more than 60 seconds do not work with sync Recognize. Use LongRunningRecognize for long audios.

Request Method

POST https://asr.vernacular.ai/v2/speech:recognize

Request Headers

X-ACCESS-TOKEN: some-access-token
content-type: application/json

Request Body

The request body contains data with the following structure:

{
  "config": {
    object (RecognitionConfig)
  },
  "audio": {
    object (RecognitionAudio)
  }
}
Fields
config object (RecognitionConfig)
Required. Provides information to the recognizer that specifies how to process the request.
audio object (RecognitionAudio)
Required. The audio data to be recognized.

Response Body

If successful, the response body contains data with the following structure:

The only message returned to the client by the recognize method. It contains the result as zero or more sequential SpeechRecognitionResult messages.

{
  "results": [
    {
      object (SpeechRecognitionResult)
    }
  ]
}

Sample Request and Response

Request:

curl -X POST 'https://asr.vernacular.ai/v2/speech:recognize' \
--header 'X-ACCESS-TOKEN: {{access-token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "config": {
      "encoding": "LINEAR16",
      "sampleRateHertz": 8000,
      "languageCode": "en-IN",
      "maxAlternatives": 2
    },
    "audio": {
      "uri": "https://audio-url.wav"
    }
}'

Response:

{
    "results": [
        {
            "alternatives": [
                {
                    "transcript": "i want to know my balance",
                    "confidence": 0.95417684
                },
                {
                    "transcript": "i want know balance",
                    "confidence": 0.95404005
                }
            ]
        }
    ]
}