Predict

Predict the language of a text

Predict the language of a text using a neural model. A POST version of this endpoint is also available, it accepts a JSON body with exactly the same parameters.

Use the POST version if you want to predict the language of a long text, as the GET version has a limit on the length of the text that can be provided.

GET
/predict/lang

Query Parameters

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 GET "https://robotoff.openfoodfacts.org/api/v1/predict/lang?text=hello+world&k=10&threshold=0.01"
{
  "predictions": [
    {
      "lang": "en",
      "confidence": 0.9
    }
  ]
}
Empty