Variants for search and screening
Available in the APIAvailable in the API: POST /v1/variants in standard mode. extended mode is in development and answers 403 plan_feature_unavailable on live keys. Variants are the engine's ranked spellings today, all typed transliteration; phonetic keys and same-script variants are not produced yet, and the response says so in warnings.
What it is for
A list or an index holds a name in whatever spelling someone typed. Searching it for one spelling misses the others. Variants give you the spellings the engine considers plausible renderings of your input, so you can search for all of them.
A variant is a string, not a finding. A hit on a variant tells you two strings agree; whether they refer to the same person is for your process to decide.
When to use it
- Expanding a query before a search over your own records or a list you are licensed to screen against.
- Building a search index keyed on Latin spellings of Arabic names, or the reverse.
- For a single best rendering, call
/v1/transliterateinstead: it returns ranked spellings and the engine's provenance.
Request
Standard variants with per-token lists
curl https://api.arabinames.assentify.com/v1/variants \
-H "Authorization: Bearer $ARABINAMES_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"حسين","target_scripts":["latn","arab"],"max_variants":3,"per_token":true}'{
"id": "va_example",
"object": "variants",
"mode": "standard",
"variants": [
{
"text": "Hussein",
"script": "latn",
"type": "transliteration",
"rank": 1
},
{
"text": "Hussain",
"script": "latn",
"type": "transliteration",
"rank": 2
},
{
"text": "Husayn",
"script": "latn",
"type": "transliteration",
"rank": 3
}
],
"phonetic_keys": null,
"tokens": [
{
"index": 0,
"script": "latn",
"variants": [
"Hussein",
"Hussain",
"Husayn",
"Hocine",
"Husein"
]
}
],
"truncated": true,
"hints": {
"dialect": "auto",
"orthography": "auto",
"source": "default",
"applied": "none"
},
"warnings": [
"SAME_SCRIPT_VARIANTS_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 name, Arabic or Latin. See Unicode for what it may hold. |
| target_scripts | string[] | Default ["latn", "arab"]. At least one. |
| mode | string | standard (default) or extended (in development). |
| max_variants | integer | 1 to 100, default 20. Capped by your plan: 10 on Free, 100 on paid plans. |
| include_types | string[] | Which types to return. Accepted: transliteration, spelling, orthography, article, compound, particle, typo, phonetic_key. Only transliteration is produced today. |
| per_token | boolean | Default false. Adds tokens: the spellings of each token. |
| country_hint, dialect_hint, orthography | string | Accepted and reported in hints; not forwarded to the engine on this endpoint yet. |
| cache | string | default or bypass. |
Response
| Field | Type | Meaning |
|---|---|---|
| id | string | Starts with va_. |
| mode | string | The mode that ran. |
| variants[] | array | text, script, type and rank (1 is the engine's first). Deduplicated across scripts. |
| phonetic_keys | null | Always null until the engine exposes phonetic keys. |
| tokens | array | With per_token: one entry per input token and target script, with index, script and variants. The input token itself is not echoed. |
| truncated | boolean | true when the engine had more spellings than max_variants. |
| hints, warnings | object, string[] | Hints as resolved (applied is none), and warnings. |
| engine_version, units | string, integer | The engine that answered, and the units billed. |
The engine's own output for a two-token name, through the same endpoint:
Variants from the engine
curl https://api.arabinames.assentify.com/v1/variants \
-H "Authorization: Bearer $ARABINAMES_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"جمال قاسم","target_scripts":["latn","arab"],"max_variants":10}'{
"id": "va_example",
"object": "variants",
"mode": "standard",
"variants": [
{
"text": "Jamale Kassem",
"script": "latn",
"type": "transliteration",
"rank": 1
},
{
"text": "Jamal Kassem",
"script": "latn",
"type": "transliteration",
"rank": 2
},
{
"text": "Jamale Qasm",
"script": "latn",
"type": "transliteration",
"rank": 3
},
{
"text": "Jamal Qasm",
"script": "latn",
"type": "transliteration",
"rank": 4
},
{
"text": "Jmal Kassem",
"script": "latn",
"type": "transliteration",
"rank": 5
},
{
"text": "jmāl Kassem",
"script": "latn",
"type": "transliteration",
"rank": 6
},
{
"text": "Jamale qāsm",
"script": "latn",
"type": "transliteration",
"rank": 7
},
{
"text": "ǧmāl Kassem",
"script": "latn",
"type": "transliteration",
"rank": 8
},
{
"text": "Jamal qāsm",
"script": "latn",
"type": "transliteration",
"rank": 9
},
{
"text": "Gamal Kassem",
"script": "latn",
"type": "transliteration",
"rank": 10
}
],
"phonetic_keys": null,
"truncated": false,
"hints": {
"dialect": "auto",
"orthography": "auto",
"source": "default",
"applied": "none"
},
"warnings": [
"SAME_SCRIPT_VARIANTS_UNAVAILABLE"
],
"engine_version": "1.0.0",
"units": 1
}Engine output through /v1, as recorded on the examples page. Per-result provenance and versions are left out here for length.
How variants are built
- The input is cleaned by the input safety rules.
- For each target script that differs from the input's script, the engine returns its ranked full-name spellings.
- Each spelling is checked as a well-formed name in its script; any that is not is dropped.
- The rest are deduplicated and kept in the engine's order, then cut at
max_variants.
A target script equal to the input's script is skipped with the warning SAME_SCRIPT_VARIANTS_UNAVAILABLE: an Arabic name with target_scripts ["latn", "arab"] returns Latin variants only. Asking for phonetic_key adds PHONETIC_KEYS_UNAVAILABLE.
Extended mode
Extended mode on a live key
curl https://api.arabinames.assentify.com/v1/variants \
-H "Authorization: Bearer $ARABINAMES_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"حسين","mode":"extended"}'{
"type": "https://arabinames.assentify.com/docs/errors#plan_feature_unavailable",
"title": "Feature not on this plan",
"status": 403,
"code": "plan_feature_unavailable",
"detail": "Extended variants are in development and are not available yet. Use mode standard.",
"param": "mode",
"request_id": "req_example",
"doc_url": "https://arabinames.assentify.com/docs/errors#plan_feature_unavailable"
}The gateway's answer, with its request id replaced. Errors bill zero units.
Extended variants are in development. On a live key, mode: "extended" answers 403 plan_feature_unavailable with param: "mode"; on the Free plan the same code says the mode is not on the plan. When it opens, an extended call bills 5 units.
Edge cases
- Leaving
transliterationout ofinclude_typesreturns an emptyvariantslist today, and still bills the call. - If no target script yields a single well-formed spelling, the call fails with
502 engine_output_invalidand bills nothing. - Batches run variants in standard mode. An item with
mode: "extended"fails withplan_feature_unavailableand is not billed. - Variants do not take
input_format: digits in a name are refused here. Arabizi input goes through/v1/transliterate.
Errors
plan_feature_unavailable for extended mode, engine_output_invalid, validation_error and the input errors. All are in the errors guide.
Limits and units
Standard mode bills 1 unit per successful call, however many scripts and variants it returns. Errors bill nothing; test keys bill nothing. max_variants above your plan's cap is lowered to the cap, not refused. See rate limits and quotas.