The MessageBird Language Detection API detects the language of a given phrase. It assumes the given phrase is written in a single language, and might yield unexpected behavior if this assumption does not hold.
Language detection works particularly well for longer texts. With shorter texts, it is often difficult to reliably decide on the language. For example, in both German and Dutch, "hallo" means "hi" and so at the beginning of a conversation in Dutch or German the language might not always be clear. However, by using phrases that might occur later in the same conversation, it might be possible to robustly decide which language the person on the other is using.
This API uses the ISO-639-3 language code standard. There are over 180 languages supported (see Language).
API access to AI services is currently available in Customer Preview with limited access. Please contact your account manager to request access. If you have any questions about how to use the API and get more guidance on your implementation, send an email to our AI team.
All paths referenced in this page uses the following base URL:
language-detection.messagebird.com
You need to set an access key to authenticate your HTTP requests. You can create, manage, and retrieve your access keys using the MessageBird Dashboard.
To provide the access key, set the Authorization HTTP header in the form of AccessKey {accessKey}.
Predicts the language for a given phrase. The process of predicting the language from a phrase is also known as language detection. If the language could not be determined, it will return LANGUAGE_UNDETERMINED. Uses the ISO-639-3 standard otherwise.
POST /api/v1/predict-language
A request for predicting the language from a phrase.
Parameter | Type | Description |
---|---|---|
phrase | string | The phrase for which to predict the language. |
curl -X POST "https://language-detection.messagebird.com/api/v1/predict-language" \-H "Authorization: AccessKey your_access_key" \-H "Content-Type: application/json" \-d '{"phrase": "Dit is iets in het Nederlands"}'
A response that contains the predicted language. If the service could not determine any language, the language field will not be populated.
Parameter | Type | Description |
---|---|---|
language | Language | Language that was detected from the given phrase. |
{"language": {"iso6393Code": "nld","languageCode": "NLD","name": "Dutch"}}
Code | Description |
---|---|
200 | A successful response. |
401 | Returned when the user is not authorized. |
404 | Returned when the resource does not exist. |
Lists the languages supported by the Language Detection API.
GET /api/v1/supported-languages
curl -X GET "https://language-detection.messagebird.com/api/v1/supported-languages" \-H "Authorization: AccessKey your_access_key"
List of recognized languages.
Parameter | Type | Description |
---|---|---|
languages | array of Language | The collection of languages. |
{"languages": [{"iso_639_3_code": "nld","language_code": "NLD","name": "Dutch"},{"iso_639_3_code": "eng","language_code": "ENG","name": "English"},{"iso_639_3_code": "spa","language_code": "SPA","name": "Spanish"},{"iso_639_3_code": "zho","language_code": "ZHO","name": "Chinese"}]}
Code | Description |
---|---|
200 | A successful response. |
401 | Returned when the user is not authorized. |
404 | Returned when the resource does not exist. |
Language that was detected from the given phrase.
Parameter | Type | Description |
---|---|---|
iso6393Code | string | The ISO-639-3 code of the language. |
name | string | The English name of the language. |
languageCode | string from LanguageCode | The enum value of the ISO639-3 language code. |
Language code in ISO639-3 format. More info can be found here: https://iso639-3.sil.org/code_tables/639/data.
Value | Description |
---|---|
LANGUAGE_INVALID | Language code is invalid. |
LANGUAGE_UNDETERMINED | Language could not be determined. |
ENG | English. |
RUS | Russian. |
DEU | German. |
FRA | French. |
ITA | Italian. |
JPN | Japanese. |
SPA | Spanish. |
CEB | Cebuano. |
TUR | Turkish. |
POR | Portuguese. |
UKR | Ukrainian. |
EPO | Esperanto. |
POL | Polish. |
SWE | Swedish. |
NLD | Dutch. |
HEB | Hebrew. |
ZHO | Chinese. |
HUN | Hungarian. |
ARA | Arabic. |
CAT | Catalan. |
FIN | Finnish. |
CES | Czech. |
FAS | Persian. |
SRP | Serbian. |
ELL | Greek. |
VIE | Vietnamese. |
BUL | Bulgarian. |
KOR | Korean. |
NOR | Norwegian. |
MKD | Macedonian. |
RON | Romanian. |
IND | Indonesian. |
THA | Thai. |
HYE | Armenian. |
DAN | Danish. |
TAM | Tamil. |
HIN | Hindi. |
HRV | Croatian. |
HBS | Serbo-Croatian. |
BEL | Belarusian. |
KAT | Georgian. |
TEL | Telugu. |
KAZ | Kazakh. |
WAR | Waray. |
LIT | Lithuanian. |
GLG | Galician. |
SLK | Slovak. |
BEN | Bengali. |
EUS | Basque. |
SLV | Slovenian. |
KAN | Kannada. |
MAL | Malayalam. |
MAR | Marathi. |
EST | Estonian. |
AZE | Azerbaijani. |
MSA | Malay. |
SQI | Albanian. |
LAT | Latin. |
BOS | Bosnian. |
NNO | Norwegian Nynorsk. |
URD | Urdu. |
LAV | Latvian. |
MYA | Burmese. |
TAT | Tatar. |
AFR | Afrikaans. |
OCI | Occitan. |
NDS | Low German. |
KIR | Kirghiz. |
AST | Asturian. |
TGL | Tagalog. |
ISL | Icelandic. |
INA | Interlingua. |
SIN | Sinhala. |
GUJ | Gujarati. |
KHM | Central Khmer. |
BRE | Breton. |
BAK | Bashkir. |
UZB | Uzbek. |
BOD | Tibetan. |
PAN | Panjabi. |
VOL | Volapük. |
ALS | Tosk Albanian. |
NEP | Nepali. |
CYM | Welsh. |
JBO | Lojban. |
FRY | Western Frisian. |
MON | Mongolian. |
LTZ | Luxembourgish. |
CHE | Chechen. |
UIG | Uighur. |
TGK | Tajik. |
SCO | Scots. |
SAN | Sanskrit. |
CHV | Chuvash. |
JAV | Javanese. |
MIN | Minangkabau. |
IDO | Ido. |
ORI | Oriya. |
ASM | Assamese. |
NEW | Newari. |
GLE | Irish. |
MLG | Malagasy. |
ARG | Aragonese. |
CKB | Central Kurdish. |
SWA | Swahili. |
BAR | Bavarian. |
LMO | Lombard. |
YID | Yiddish. |
ARZ | Egyptian Arabic. |
MHR | Eastern Mari. |
AZB | South Azerbaijani. |
SAH | Yakut. |
PNB | Western Panjabi. |
SUN | Sundanese. |
BPY | Bishnupriya. |
PMS | Piemontese. |
ILO | Iloko. |
WUU | Wu Chinese. |
KUR | Kurdish. |
PUS | Pushto. |
ILE | Interlingue. |
XMF | Mingrelian. |
YUE | Yue Chinese. |
GOM | Goan Konkani. |
LIM | Limburgan. |
MWL | Mirandese. |
COR | Cornish. |
SND | Sindhi. |
HSB | Upper Sorbian. |
SCN | Sicilian. |
GLA | Scottish Gaelic. |
PAM | Pampanga. |
BHO | Bhojpuri. |
MAI | Maithili. |
VEC | Venetian. |
MLT | Maltese. |
DIV | Dhivehi. |
WLN | Walloon. |
MZN | Mazanderani. |
AMH | Amharic. |
QUE | Quechua. |
CBK | Chavacano. |
TUK | Turkmen. |
ROH | Romansh. |
OSS | Ossetian. |
VLS | Vlaams. |
YOR | Yoruba. |
LAO | Lao. |
LEZ | Lezghian. |
SOM | Somali. |
MYV | Erzya. |
DIQ | Dimli. |
MRJ | Western Mari. |
DSB | Lower Sorbian. |
FRR | Northern Frisian. |
HAT | Haitian. |
GRN | Guarani. |
BXR | Russia Buriat. |
KOM | Komi. |
SRD | Sardinian. |
KRC | Karachay-Balkar. |
BCL | Central Bikol. |
NAP | Neapolitan. |
GLV | Manx. |
AVA | Avaric. |
RUE | Rusyn. |
XAL | Kalmyk. |
PFL | Pfaelzisch. |
DTY | Dotyali. |
HIF | Fiji Hindi. |
COS | Corsican. |
LRC | Northern Luri. |
VEP | Veps. |
TYV | Tuvinian. |
NOB | Norwegian Bokmål. |
SNA | Shona. |
KIN | Kinyarwanda. |
IBO | Igbo. |
SMO | Samoan. |
SOT | Southern Sotho. |
MRI | Maori. |
WOL | Wolof. |
XHO | Xhosa. |
HAU | Hausa. |
HAW | Hawaiian. |
NYA | Nyanja. |
ZUL | Zulu. |
HMN | Hmong. |
List of recognized languages.
Parameter | Type | Description |
---|---|---|
languages | array of Language | The collection of languages. |
A request for predicting the language from a phrase.
Parameter | Type | Description |
---|---|---|
phrase | string | The phrase for which to predict the language. |
A response that contains the predicted language. If the service could not determine any language, the language field will not be populated.
Parameter | Type | Description |
---|---|---|
language | Language | The predicted language for the given phrase. If no known language could be determined this will be LANGUAGE_UNDETERMINED. |