Dialect and orthography hints
Available in the APIAvailable in the API on POST /v1/transliterate and in transliterate batches. /v1/variants accepts and reports the same hints but does not pass them to the engine yet, so they do not change its ranking.
What it is for
One Arabic name has several correct Latin spellings. Kassem reads naturally in Beirut, Qasim in the Gulf, and an Egyptian reader expects Gamal where a Levantine one writes Jamal. If you know where your clients are, say so, and spellings in their convention move up the list.
Hints rank Arabic to Latin output. They do nothing for Latin to Arabic, where the gateway sends no hint at all.
Request fields
| Field | Type | Meaning |
|---|---|---|
| country_hint | string | ISO 3166-1 alpha-2 in upper case, for example LB. Sets the dialect and orthography defaults for that country. |
| dialect_hint | string | auto, levantine, gulf, egyptian, maghrebi, msa. Default auto. |
| orthography | string | auto, english, french. Default auto. Whether Latin spellings follow English or French habits (Shehadeh or Chehade). |
| hints.sex | string | male, female. Transliterate only. Optional; see the sex hint. |
Examples
The same name with a country hint and with a dialect hint. The third spelling changes from Jamale Kasem to Gamal Kassem; the set of spellings the engine can produce stays the same.
A country hint: Lebanon
curl https://api.arabinames.assentify.com/v1/transliterate \
-H "Authorization: Bearer $ARABINAMES_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"جمال قاسم","target_script":"latn","max_results":5,"country_hint":"LB"}'{
"id": "tr_example",
"object": "transliteration",
"source_script": "arab",
"target_script": "latn",
"results": [
{
"text": "Jamale Kassem",
"rank": 1
},
{
"text": "Jamal Kassem",
"rank": 2
},
{
"text": "Jamale Kasem",
"rank": 3
},
{
"text": "Jamal Kasem",
"rank": 4
},
{
"text": "Jmal Kassem",
"rank": 5
}
],
"tokens": null,
"hints": {
"dialect": "levantine",
"orthography": "french",
"source": "country",
"applied": "engine",
"convention": "lb-fr"
},
"warnings": [],
"engine_version": "1.0.0",
"band": "medium",
"abstained": false,
"abstain_reasons": [],
"units": 1
}Engine output through /v1, as recorded on the examples page. Per-result provenance and versions are left out here for length.
A dialect hint: Egyptian
curl https://api.arabinames.assentify.com/v1/transliterate \
-H "Authorization: Bearer $ARABINAMES_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"جمال قاسم","target_script":"latn","max_results":5,"dialect_hint":"egyptian"}'{
"id": "tr_example",
"object": "transliteration",
"source_script": "arab",
"target_script": "latn",
"results": [
{
"text": "Jamale Kassem",
"rank": 1
},
{
"text": "Jamal Kassem",
"rank": 2
},
{
"text": "Gamal Kassem",
"rank": 3
},
{
"text": "Jamale Kasem",
"rank": 4
},
{
"text": "Gmal Kassem",
"rank": 5
}
],
"tokens": null,
"hints": {
"dialect": "egyptian",
"orthography": "auto",
"source": "request",
"applied": "engine",
"convention": "eg-en"
},
"warnings": [],
"engine_version": "1.0.0",
"band": "medium",
"abstained": false,
"abstain_reasons": [],
"units": 1
}Engine output through /v1, as recorded on the examples page. Per-result provenance and versions are left out here for length.
Reading hints in a response
Every transliterate and variants response has a hints object: what the gateway resolved, and whether the engine used it.
| Field | Type | Meaning |
|---|---|---|
| dialect, orthography | string | The values in effect after defaults. From the request when you set either, else from the country, else auto. |
| source | string | request, country or default: where those values came from. |
| applied | string | engine when the engine says it ranked with a convention resolved from your hint or country; none otherwise. rerank is reserved and never returned. |
| convention | string | Present only when applied is engine: the engine's convention code, for example lb-fr. |
| sex | string | Present only when you sent hints.sex: your value, echoed. |
Read applied, not source, to know whether a hint changed anything. applied: none means the ranking is the one you get with no hint.
How hints reach the engine
The gateway sends the engine at most one thing: a country, or one convention code.
- Latin to Arabic (
target_script: "arab", Latin input with no target, or Arabizi input): nothing is sent.appliedisnone. - Dialect and orthography both
auto: the country hint alone is sent, and the engine maps it (Lebanon tolb-fr, thenlb-en). msa: nothing is sent. Modern Standard Arabic has no convention code.- A country whose default dialect is the one you asked for (or you left the dialect on
auto): that country's code with your orthography, or its own orthography when yours isauto.levantinewithLBgiveslb-fr;englishwithLBgiveslb-en. - Otherwise the dialect's own code, from the table below.
- A pair with no code sends nothing, not even the country:
gulforegyptianwithfrench,maghrebiwithenglish, or an orthography alone without a country that has it.
| Dialect | English | French |
|---|---|---|
levantine | levant-en | lb-fr |
gulf | gulf-en | none |
egyptian | eg-en | none |
maghrebi | none | ma-fr |
msa | none | none |
Countries and conventions
Countries with defaults. A country_hint outside this table resolves to msa and english with source: country; the engine has no convention for it, so applied stays none.
| Country | Code | Default dialect | Default orthography | Engine conventions |
|---|---|---|---|---|
| Lebanon | LB | levantine | french | lb-fr, then lb-en |
| Syria | SY | levantine | english | levant-en |
| Jordan | JO | levantine | english | levant-en |
| Palestinian Territories | PS | levantine | english | levant-en |
| Saudi Arabia | SA | gulf | english | gulf-en |
| United Arab Emirates | AE | gulf | english | gulf-en |
| Kuwait | KW | gulf | english | gulf-en |
| Qatar | QA | gulf | english | gulf-en |
| Bahrain | BH | gulf | english | gulf-en |
| Oman | OM | gulf | english | gulf-en |
| Yemen | YE | gulf | english | ye-en |
| Iraq | IQ | gulf | english | iq-en |
| Egypt | EG | egyptian | english | eg-en |
| Sudan | SD | egyptian | english | sd-en |
| Morocco | MA | maghrebi | french | ma-fr |
| Algeria | DZ | maghrebi | french | dz-fr, then ma-fr |
| Tunisia | TN | maghrebi | french | tn-fr, then ma-fr |
| Libya | LY | maghrebi | english | ly-en |
| Mauritania | MR | maghrebi | french | mr-fr, then ma-fr |
The sex hint
Some given names are spelled differently for men and women in Latin script. If your record already holds the person's sex, pass it and the engine can prefer the matching dictionary entry for an ambiguous given name, Arabic to Latin.
- Client-supplied only. The API never infers, stores or returns a sex of its own. Leave the field out when you do not know.
- It ranks spellings; it is not a statement about anyone, and the response only echoes your value in
hints.sex. - Any value other than
maleorfemale, or another key insidehints, is avalidation_error.
A sex hint the client already holds
curl https://api.arabinames.assentify.com/v1/transliterate \
-H "Authorization: Bearer $ARABINAMES_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"حسين","target_script":"latn","max_results":2,"hints":{"sex":"male"}}'{
"id": "tr_example",
"object": "transliteration",
"source_script": "arab",
"target_script": "latn",
"results": [
{
"text": "Hussein",
"rank": 1
},
{
"text": "Hussain",
"rank": 2
}
],
"tokens": null,
"hints": {
"dialect": "auto",
"orthography": "auto",
"source": "default",
"applied": "none",
"sex": "male"
},
"warnings": [],
"engine_version": "mock-1",
"units": 1
}Fixture spellings (engine_version mock-1), which is what a test key returns. A live key returns the engine's spellings in the same fields and bills the units shown; a test key bills 0.
Edge cases
- Hints in a batch work per item, or once for all items in
defaults. - Variants report
hintswithapplied: none: the hints are not forwarded to the engine on that endpoint yet. Normalise acceptscountry_hintand does not use it today. - A hint never adds or removes a spelling, so a spelling you need can still appear lower in the list. Ask for more results with
max_resultsrather than relying on rank 1. GET /v1/metalists the accepted dialect, orthography and sex values.
Errors
An unknown dialect or orthography, a lower-case or three-letter country code, or an unknown hints key is 422 validation_error with param naming the field. See the errors guide for the rest.
Limits and units
Hints are free: a call costs the same units with or without them (one per transliteration).