Variants for search and screening

Available in the API
Turn one name into the list of spellings to search for, in Latin script, Arabic script or both. Each variant comes with its script, a type and a rank.

Available 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/transliterate instead: 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}'
Response 200
{
  "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.

FieldTypeMeaning
textstringRequired. One name, Arabic or Latin. See Unicode for what it may hold.
target_scriptsstring[]Default ["latn", "arab"]. At least one.
modestringstandard (default) or extended (in development).
max_variantsinteger1 to 100, default 20. Capped by your plan: 10 on Free, 100 on paid plans.
include_typesstring[]Which types to return. Accepted: transliteration, spelling, orthography, article, compound, particle, typo, phonetic_key. Only transliteration is produced today.
per_tokenbooleanDefault false. Adds tokens: the spellings of each token.
country_hint, dialect_hint, orthographystringAccepted and reported in hints; not forwarded to the engine on this endpoint yet.
cachestringdefault or bypass.

Response

FieldTypeMeaning
idstringStarts with va_.
modestringThe mode that ran.
variants[]arraytext, script, type and rank (1 is the engine's first). Deduplicated across scripts.
phonetic_keysnullAlways null until the engine exposes phonetic keys.
tokensarrayWith per_token: one entry per input token and target script, with index, script and variants. The input token itself is not echoed.
truncatedbooleantrue when the engine had more spellings than max_variants.
hints, warningsobject, string[]Hints as resolved (applied is none), and warnings.
engine_version, unitsstring, integerThe 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}'
Response 200
{
  "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

  1. The input is cleaned by the input safety rules.
  2. For each target script that differs from the input's script, the engine returns its ranked full-name spellings.
  3. Each spelling is checked as a well-formed name in its script; any that is not is dropped.
  4. 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"}'
Response 403
{
  "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 transliteration out of include_types returns an empty variants list today, and still bills the call.
  • If no target script yields a single well-formed spelling, the call fails with 502 engine_output_invalid and bills nothing.
  • Batches run variants in standard mode. An item with mode: "extended" fails with plan_feature_unavailable and is not billed.
  • Variants do not take input_format: digits in a name are refused here. Arabizi input goes through /v1/transliterate.

Errors

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.