Skip to main content

Language Detection

Language detection enables us to determine the language in which a given audio is uploaded. It is useful in case an audio whose source language is unknown needs to be transcribed. In such a case, first the language is determined and then results for transcription as well as all the other features are obtained.

File Transcription Job with Language Detection

Copy and paste the below curl request on your terminal to start a transcription using the API. Fill the variables with the appropriate values, as mentioned in the overview.

curl --location 'https://voice.neuralspace.ai/api/v2/jobs' \
--header 'Authorization: {{API_KEY}}' \
--form 'files=@"{{LOCAL_AUDIO_FILE_PATH}}"' \
--form 'config="{\"file_transcription\":{\"mode\":\"{{MODE}}\"}}"'

In the above request, the language_id parameter has not been passed as the language of the audio is not known. It also returns a response similar to the regular file transcription API as seen in overview.

{
"success": true,
"message": "Job created successfully",
"data": {
"jobId": "281f8662-cdc3-4c76-82d0-e7d14af52c46"
}
}

Fetch Transcription and Language Detection Results

When you pass the jobId (received in response to the transcription API) to the API below, it fetches the status and results of the job.

curl --location 'https://voice.neuralspace.ai/api/v2/jobs/{{jobId}}' \
--header 'Authorization: {{API_KEY}}'

The response of the request above appears as follows:

{
...
"data": {
...
"result": {
"language_detection": {
"predicted_language_code": "en",
"confidence": 0.7811065912246704
},
...
}
}
}

In the response, the predicted language code is returned as well as the confidence that the model has for the prediction. The rest of the transcription and features work as expected and provide responses in otherwise the same format.

Troubleshooting and FAQ

Undetected? Check out our FAQ page. If you still need help, feel free to reach out to us directly at support@neuralspace.ai or join our Slack community.