Predict

Predict the language of a text

Predict the language of a text using a neural model. Use this POST version for long texts, as the GET version has a limit on the length of the text that can be provided in the query string.

POST
/predict/lang
textstring

The text to predict language of

k?integer

The number of predictions to return

Default10
Range1 <= value
threshold?number

The minimum probability for a language to be returned

Default0.01
Range0 <= value <= 1

Response Body

curl -X POST "https://robotoff.openfoodfacts.org/api/v1/predict/lang" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "hello world"
  }'
{
  "predictions": [
    {
      "lang": "en",
      "confidence": 0.9
    }
  ]
}
Empty