Skip to content

Language identification

POST /v1/language-idPOST /v1/language-id/batchfrom $0.05 / 1,000 requests

Identifies 608 languages and holds up on short, messy user input. Powered by lid-neural-608 and lid-lite-608.

r = call("/v1/language-id", {"text": "Mo fẹ́ lọ sí ọjà"})
print(r["language"], r["confidence"]) # yor 0.97
Field Default Notes
text required Up to 1,000 characters. Each text is one request.
model lid-neural-608 lid-neural-608 is the most accurate; lid-lite-608 (fastText) is the fastest.
mode traffic traffic is for user input, chat and routing: on short text it leans towards the languages people actually use. coverage treats every language equally, for building corpora.
top_k 3 1 to 25 runner-up languages in top.
{
"language": "yor", "script": "Latn", "label": "yor_Latn", "language_name": "Yoruba",
"confidence": 0.97,
"top": [{"label": "yor_Latn", "language": "yor", "language_name": "Yoruba", "score": 0.97},
{"label": "ibo_Latn", "language": "ibo", "language_name": "Igbo", "score": 0.01}],
"warnings": [],
"model": "lid-neural-608", "mode": "traffic", "usage": {"texts": 1}
}
  • language is ISO 639-3, and label adds the script (yor_Latn, srp_Cyrl).
  • zxx_Zxxx means no language was found: the text is code, numbers or symbols. A warning says so.
  • language_name is the language’s English name, on the answer and on every entry in top: the name people use (Luganda, Chichewa), from ISO 639-3. The codes in language and label are always ISO 639-3 and ISO 15924.

POST /v1/language-id/batch with "texts": [...] (up to 256) returns {"results": [...]} in the same order.