Detect Language
detect_languageDetect the language of text.
Supports 176 languages using fastText. Sub-1ms inference latency. Returns ISO 639-1 codes with confidence scores.
Args: text: Text to identify the language of. top_k: Number of top language predictions to return (default: 3).
Returns: dict with keys: - language (str): Top predicted language ISO 639-1 code - confidence (float 0-1): Confidence for top prediction - predictions (list): Top-k predictions, each with: - language (str): ISO 639-1 code - confidence (float 0-1): Prediction confidence
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Text to identify the language of | |
| top_k | No | Number of top language predictions to return |