Unicode
Available in the APIAvailable in the API on /v1/transliterate, /v1/variants, /v1/normalise and batches. Arabizi input is accepted on transliterate only.
What a name may hold
- Arabic letters and marks, and Latin letters with their accents.
- Spaces between tokens, and inside a token the apostrophes
'’‘ʿʾ`, the full stop, the comma and the hyphen. - No digits, unless you opt in to Arabizi. No symbols or emoji.
- Letters of any other script are refused with
unsupported_script. - The body itself must be UTF-8 JSON sent as
application/json.
What the gateway cleans
In this order:
- Tabs and line breaks become spaces.
- Control characters, lone surrogates, private use and unassigned code points are refused, with their code point positions.
- Bidirectional controls, zero-width characters and tatweel (ـ) are removed.
- Arabic presentation forms and fullwidth Latin letters become their base letters.
- The Persian letters ی ک ۀ ے become the Arabic ي ك ة ي.
- Runs of spaces, including no-break spaces, collapse to one; the ends are trimmed; the result is put in Unicode NFC.
- In a token that is mostly Latin, Cyrillic and Greek look-alikes (for example Cyrillic
а,о,р) become the Latin letters they imitate.
A cleaned input carries a warning
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}'{
"id": "tr_example",
"object": "transliteration",
"source_script": "arab",
"target_script": "latn",
"results": [
{
"text": "Mohamad",
"rank": 1
},
{
"text": "Mohammed",
"rank": 2
}
],
"tokens": null,
"hints": {
"dialect": "auto",
"orthography": "auto",
"source": "default",
"applied": "none"
},
"warnings": [
"TATWEEL_REMOVED"
],
"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.
Warnings
Cleaning never fails silently. Each change adds a code to warnings in the response:
| Warning | Meaning |
|---|---|
BIDI_CONTROL_REMOVED | Bidirectional control characters were removed. |
ZERO_WIDTH_REMOVED | Zero-width spaces, joiners or the byte order mark were removed. |
TATWEEL_REMOVED | Tatweel was removed. |
PERSIAN_LETTER_MAPPED | A Persian letter form was mapped to its Arabic letter. |
CONFUSABLE_MAPPED | A Cyrillic or Greek look-alike was mapped to Latin. |
MIXED_SCRIPT_INPUT | Some tokens are Arabic and some Latin. |
Endpoints add their own warnings, such as SAME_SCRIPT_VARIANTS_UNAVAILABLE on variants or NAME_PARTS_UNAVAILABLE on normalise. New warning codes may appear within v1; log them rather than fail on them.
Tokens and scripts
- Tokens are split on spaces. Each token's script is the one that holds at least 60% of its letters.
- A token that mixes both scripts is split once where one script ends and the other begins, if both halves are clean. Otherwise it is refused with
mixed_script_token. - A name whose tokens are in different scripts is accepted, with
MIXED_SCRIPT_INPUT.
Arabizi input
Arabizi is Arabic typed in Latin letters and digits, such as 7asan. On /v1/transliterate, send input_format: "arabizi" and the digits 2, 3, 5, 6, 7, 8 and 9 are accepted inside a token that has a Latin letter and no Arabic letter. 0, 1 and 4, digit-only tokens and digits in Arabic tokens stay refused. Arabizi converts to Arabic: leave target_script out or set it to arab; latn is a validation_error.
Arabizi input, opted in
curl https://api.arabinames.assentify.com/v1/transliterate \
-H "Authorization: Bearer $ARABINAMES_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"7asan 3abdallah","input_format":"arabizi","max_results":5}'{
"id": "tr_example",
"object": "transliteration",
"source_script": "latn",
"target_script": "arab",
"results": [
{
"text": "حسن عبدالله",
"rank": 1
},
{
"text": "حصن عبدالله",
"rank": 2
},
{
"text": "حسان عبدالله",
"rank": 3
},
{
"text": "حاسن عبدالله",
"rank": 4
},
{
"text": "حصان عبدالله",
"rank": 5
}
],
"tokens": null,
"hints": {
"dialect": "auto",
"orthography": "auto",
"source": "default",
"applied": "none"
},
"warnings": [],
"engine_version": "1.0.0",
"band": "low",
"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.
Without the opt-in, a digit is refused:
A digit in a plain name
curl https://api.arabinames.assentify.com/v1/transliterate \
-H "Authorization: Bearer $ARABINAMES_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Rami 2","target_script":"arab"}'{
"type": "https://arabinames.assentify.com/docs/errors#invalid_name_characters",
"title": "Invalid name characters",
"status": 422,
"code": "invalid_name_characters",
"detail": "Disallowed characters at positions 0 of a token.",
"param": "text",
"request_id": "req_example",
"doc_url": "https://arabinames.assentify.com/docs/errors#invalid_name_characters",
"positions": [
0
]
}The gateway's answer, with its request id replaced. Errors bill zero units.
For a digit or symbol, positions counts from the start of the token that holds it; for a control character, from the start of the input.
Output checks
The rules run the other way too. Every spelling the engine returns is checked as a well-formed name in the target script (letters of that script, marks, spaces, hyphens, apostrophes and, in Latin, full stops; at most 200 characters, no doubled or edge spaces). A spelling that fails is dropped from the response. If none is left, the call fails with 502 engine_output_invalid and bills nothing.
What is left to the engine
The gateway only makes input safe and consistent. Folding spellings for comparison (alef forms, hamza, ta marbuta, diacritics) and recognising titles are the engine's work, so normalise returns محمد and مُحَمَّد as typed, each cleaned.
Errors
| Code | When |
|---|---|
| invalid_name_characters | A control character, a digit, a symbol or another refused character. positions says where. |
| unsupported_script | Letters outside Arabic and Latin script. |
| mixed_script_token | A token mixes scripts and cannot be split cleanly. |
| empty_after_normalisation | Nothing left after cleaning. |
| name_too_long | Over 200 characters after cleaning. |
| too_many_tokens | Over 12 tokens after cleaning. |
| invalid_encoding | The body is not UTF-8. |
All are 422 except invalid_encoding (400), all carry param: "text" where a name is at fault, and none is billed.
Limits
- 200 characters (Unicode code points) per name, counted after cleaning.
- 12 tokens per name.
- 64 KB per request body, 2 MB for a batch.