Skip to main content
Sunbird AI provides tools to automatically detect the language of a given text or audio file. This is useful for routing content to the correct translation or transcription model.

Text Language Identification

Use the /tasks/language_id endpoint to identify the language of a text string.

Supported Languages (Text)

  • Acholi (ach)
  • Ateso (teo)
  • English (eng)
  • Luganda (lug)
  • Lugbara (lgg)
  • Runyankole (nyn)

Example Request

import requests

url = "https://api.sunbird.ai/tasks/language_id"
payload = {
    "text": "Oli otya?"
}
headers = {
    "Authorization": "Bearer <YOUR_TOKEN>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

Response

{
  "output": {
    "language": "lug",
    "confidence": 0.98
  }
}

Audio Language Detection

Use the /tasks/auto_detect_audio_language endpoint to identify the language spoken in an audio file.

Example Request

import requests

url = "https://api.sunbird.ai/tasks/auto_detect_audio_language"
files = {
    'audio': open('recording.mp3', 'rb')
}
headers = {
    "Authorization": "Bearer <YOUR_TOKEN>"
}

response = requests.post(url, files=files, headers=headers)
print(response.json())

Response

{
  "output": {
    "language": "ach",
    "confidence": 0.85
  }
}