Language Detection
Detect the language of any text and receive the language name, ISO 639-1 code, and a confidence score.
Vue d'ensemble
Cas d'utilisation
- Routing user messages to the correct language support team
- Auto-translating user-generated content
- Filtering content by language in multilingual platforms
- Preprocessing text for NLP pipelines
Fonctionnalités
Supports 75 languages
Returns ISO 639-1 language code
Provides a confidence score between 0.0 and 1.0
Works on short phrases and full sentences
Points de terminaison de l'API
Detect Language
Identifies the language of the provided text and returns the language name, ISO 639-1 code, and confidence score.
POST
https://requiems.xyz/v1/text/detect-language
Paramètres
| Nom | Type | Requis | Description |
|---|---|---|---|
| text | string |
Requis | The text whose language should be detected. |
Essayez-le
Démo en directRequête
The text whose language should be detected.
Sending request...
Champs de réponse
| Champ | Type | Description |
|---|---|---|
| language | string |
Full name of the detected language (e.g. French, English, Spanish) |
| code | string |
ISO 639-1 two-letter language code (e.g. fr, en, es). Empty string when detection is unreliable. |
| confidence | number |
Confidence score between 0.0 and 1.0. 0.0 is returned when the language cannot be reliably detected. |
Exemples de code
curl -X POST https://requiems.xyz/v1/text/detect-language \
-H "requiems-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Bonjour, comment ça va?"}'
import requests
url = "https://requiems.xyz/v1/text/detect-language"
headers = {
"requiems-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {"text": "Bonjour, comment ça va?"}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
const response = await fetch('https://requiems.xyz/v1/text/detect-language', {
method: 'POST',
headers: {
'requiems-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ text: 'Bonjour, comment ça va?' })
});
const data = await response.json();
console.log(data.data.language);
console.log(data.data.code);
console.log(data.data.confidence);
require 'net/http'
require 'json'
uri = URI('https://requiems.xyz/v1/text/detect-language')
request = Net::HTTP::Post.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = { text: 'Bonjour, comment ça va?' }.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
data = JSON.parse(response.body)
puts data['data']['language']
puts data['data']['code']
puts data['data']['confidence']
Réponses d'erreur
validation_failed
The text field is missing or empty.
bad_request
The request body is missing or malformed.
internal_error
Unexpected server error.
Foire aux questions
The endpoint supports 75 languages including English, French, Spanish, German, Italian, Portuguese, Dutch, Russian, Chinese, Japanese, Arabic, and many more.
A confidence of 0.0 means the language could not be reliably detected. This can happen with very short or ambiguous input such as a single common word that exists in multiple languages.
It is a standardised two-letter code identifying a language (e.g. "en" for English, "fr" for French, "es" for Spanish). An empty string is returned when detection is unreliable.