Skip to content

type_numbered

type_numbered is the default operator. Each detected entity is replaced with a typed, numbered placeholder.

[PERSON_1], [PERSON_2], [EMAIL_ADDRESS_1], [US_SSN_1]

Each entity type gets its own counter. Within a single mask() call, repeated detections of the same value use the same index, including across multiple columns in the array overload.

ParameterTypeDefaultDescription
prefixSTRING""Text prepended to the entity type inside the placeholder. prefix: "X" turns [PERSON_1] into [XPERSON_1] — useful for namespacing placeholders across systems or masking jobs.
SELECT app_public.mask(
'John Smith emailed jane@acme.com from 555-0100. John also called Jane.'
);

Output:

[PERSON_1] emailed [EMAIL_ADDRESS_1] from [PHONE_NUMBER_1]. [PERSON_1] also called [PERSON_2].

In this result, the repeated “John” mention uses [PERSON_1], while “Jane” receives the next person placeholder.

  • Default choice for most text masking workflows.
  • When downstream consumers need to distinguish between multiple entities of the same type.
  • When downstream workflows need readable placeholders and entity evidence from the entity_ledger.

By default, type_numbered reuses placeholders for repeated exact values within the same mask() call. To attempt grouping for similar mentions, such as “Chen”, “Sarah Chen”, and “Dr. Chen”, enable entity_collapse:

OBJECT_CONSTRUCT('entity_collapse', 0.5)

entity_collapse changes placeholder assignment based on the configured threshold. It can help keep related mentions together, but similar references may still receive separate placeholders.

  • entity_type — same type label without the counter.
  • constant — fixed string for every entity.