Text language detection

Detect the ISO language code and script of raw text strings to automate language routing, content moderation, and translation pipelines.

What it does

  • Multi-script Identification: Resolves language from Unicode scripts across all 22 official Indic writing systems and Latin.
  • Intra-script Disambiguation: Differentiates languages sharing identical scripts (e.g., distinguishing Marathi from Hindi in Devanagari, or Assamese from Bengali).
  • Code-mixing Tolerance: Accurately identifies the matrix language in sentences mixing English and regional vocabulary.

1-Minute Quick Call

Identify the language of a raw text string immediately:

curl --location 'https://dhruva-api.bhashini.gov.in/services/inference/pipeline' \
  --header 'Accept: */*' \
  --header 'Authorization: <YOUR_INFERENCE_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
    "pipelineTasks": [
      {
        "taskType": "txt-lang-detection",
        "config": {
          "serviceId": "bhashini/indic-lang-detection-all"
        }
      }
    ],
    "inputData": {
      "input": [
        { "source": "നമസ്കാരം, സുഖമാണോ?" }
      ]
    }
  }'

Shared Script Nuances

Script FamilyShared LanguagesDisambiguation Method
DevanagariHindi, Marathi, Sanskrit, Nepali, Konkani, Bodo, Maithili, DogriVocabulary frequency and morphological suffixes (e.g. Marathi ळ, Sanskrit visarga)
Bengali-AssameseBengali, AssameseDistinct characters (e.g. Assamese ৰ, ৱ)
Perso-ArabicUrdu, Kashmiri, SindhiSpecialized diacritics and nastaliq ligatures
Latin (Romanized)Hinglish, Tanglish, Romanized IndicPhonetic transliteration heuristics

Try it out
Text Language Detection
Request
Add an inference API key to run.
curl
curl --location 'https://dhruva-api.bhashini.gov.in/services/inference/pipeline' \
--header 'Accept: */*' \
--header 'Authorization: YOUR_INFERENCE_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"pipelineTasks": [
{
"taskType": "txt-lang-detection",
"config": {
"serviceId": "bhashini/indic-lang-detection-all"
}
}
],
"inputData": {
"input": [
{
"source": "<text>"
}
]
}
}'
Response
Send a request to see the live response here.

Common Use Cases

  • Multilingual Helpdesk Routing: Direct incoming citizen grievances or chat queries to the appropriate regional language queue.
  • E-Commerce Search Normalization: Detect user search language to trigger the matching regional catalog index.
  • Pre-Translation Auto-Detection: Pass unstructured text directly to an automated pipeline without requiring the user to specify source language.

Developer Guides & References