Normalising and splitting names
Available in the APIAvailable in the API: POST /v1/normalise cleans, splits and transliterates. Naming the parts (given, father, grandfather, family), detecting titles and the folded matching key are engine work that is not exposed yet: every token has role unknown, parts are null, parts_confidence is low, matching_key is null, and the warning NAME_PARTS_UNAVAILABLE says so on every response.
What it is for
Names arrive with stray spaces, invisible characters, tatweel and Persian letter forms. Normalise returns one clean string and its tokens, so the same name stored twice is stored the same way.
When to use it
- Before you store a name, so lookups and joins compare like with like.
- Before you show a name back to a person, to drop invisible and bidi control characters.
- When you need the name in both scripts for a form or a record: one call, see both scripts.
Request
Clean and split a name
curl https://api.arabinames.assentify.com/v1/normalise \
-H "Authorization: Bearer $ARABINAMES_KEY" \
-H "Content-Type: application/json" \
-d '{"text":" رامي حداد "}'{
"id": "no_example",
"object": "normalisation",
"normalised": "رامي حداد",
"matching_key": null,
"script": "arab",
"tokens": [
{
"text": "رامي",
"role": "unknown",
"kept": true
},
{
"text": "حداد",
"role": "unknown",
"kept": true
}
],
"parts": {
"given": null,
"father": null,
"grandfather": null,
"family": null
},
"parts_confidence": "low",
"transliterated_parts": null,
"warnings": [
"NAME_PARTS_UNAVAILABLE"
],
"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.
| Field | Type | Meaning |
|---|---|---|
| text | string | Required. One full name. See Unicode for the rules. |
| return_arabic_and_latin | boolean | Default false. Adds transliterated_parts: the name in the other script. Bills 2 units. |
| script | string | auto, arab or latn. Accepted; the gateway detects the script of each token itself. |
| keep_titles | boolean | Default false. Accepted; title detection is engine work, so it has no effect today. |
| country_hint | string | Accepted; not used today. |
| name_type | string | person, the only value in v1. |
Response
| Field | Type | Meaning |
|---|---|---|
| id | string | Starts with no_. |
| normalised | string | The cleaned name: whitespace collapsed, invisible characters removed, forms mapped, Unicode NFC. |
| script | string | arab, latn or mixed when tokens differ. |
| tokens[] | array | Each token with text, role (unknown today) and kept (true). |
| parts | object | given, father, grandfather, family; all null today. |
| parts_confidence | string | high, medium or low; low today. |
| matching_key | string or null | null today. |
| transliterated_parts | object or null | With return_arabic_and_latin: script, text (the engine's first spelling), tokens and the same four parts. |
| warnings | string[] | Input warnings such as TATWEEL_REMOVED, and NAME_PARTS_UNAVAILABLE. |
| engine_version, units | string, integer | The engine that answered, and the units billed. |
Both scripts in one call
Both scripts in one call (2 units)
curl https://api.arabinames.assentify.com/v1/normalise \
-H "Authorization: Bearer $ARABINAMES_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Rami Haddad","return_arabic_and_latin":true}'{
"id": "no_example",
"object": "normalisation",
"normalised": "Rami Haddad",
"matching_key": null,
"script": "latn",
"tokens": [
{
"text": "Rami",
"role": "unknown",
"kept": true
},
{
"text": "Haddad",
"role": "unknown",
"kept": true
}
],
"parts": {
"given": null,
"father": null,
"grandfather": null,
"family": null
},
"parts_confidence": "low",
"transliterated_parts": {
"script": "arab",
"text": "رامي حداد",
"tokens": [
"رامي",
"حداد"
],
"given": null,
"father": null,
"grandfather": null,
"family": null
},
"warnings": [
"NAME_PARTS_UNAVAILABLE"
],
"engine_version": "mock-1",
"units": 2
}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.
The other script is the engine's first spelling of the cleaned name, checked as a well-formed name in that script. If there is none, the call fails with 502 engine_output_invalid and bills nothing.
What is not there yet
The contract carries parts, titles and a matching key because the engine will supply them. The gateway does not guess them in the meantime: a rule that splits "given" from "family" by position would be wrong for many names, so the fields stay empty and say so. Code against the fields now and read parts_confidence; when the engine fills them, the same fields carry values.
Edge cases
- A name that mixes scripts across tokens returns
script: "mixed"with the warningMIXED_SCRIPT_INPUT. Withreturn_arabic_and_latinit is not transliterated and bills 1 unit. - Normalise does not fold spelling (alef forms, hamza, ta marbuta) or remove diacritics. Those are matching steps and belong to the engine.
- Normalise does not take
input_format: digits are refused.
Errors
The input errors (invalid_name_characters, empty_after_normalisation, name_too_long, too_many_tokens, mixed_script_token, unsupported_script), unsupported_name_type and, with both scripts, engine_output_invalid.
Limits and units
1 unit per successful call, 2 with return_arabic_and_latin. Errors and test keys bill nothing. Batches run normalise items with the same units.