Skip to content

Capabilities

This content is for v0.3.0. Switch to the latest version for up-to-date documentation.

A capability is one kind of identifier Paxman knows how to canonicalize. Each capability is a self-contained package — its own patterns, its own specifications, its own rendering — that plugs into the shared pipeline.

You pick a capability by picking a contract (see Contracts). The two are paired: Email.create_contract() selects the Email capability, Country.create_contract() selects Country, and so on.


  1. Each capability has a lowercase name (e.g. "email", "country", "url").
  2. Its contract carries that name in capability_name.
  3. paxman.canonicalize(text, contract) looks up the capability by that name in the registry.
  4. Only that capability’s grammars and rules run — others stay unloaded.

This keeps imports cheap: from paxman.capabilities import Email loads only Email, not every capability.


  • Notation — internal shape (not part of the public API).
  • Grammars — recognizers that scan your text and emit span-bearing matches. Pure syntax — no spec judgment.
  • Rules — validators that check each match against an authoritative spec (RFC, ISO standard, etc.) and produce a canonical value plus provenance.
  • Contract — the user-facing configuration (see Contracts).
  • format_value — the sole rendering step, controlled by output_format on the contract.

You never interact with notations, grammars, or rules directly — you configure them through the contract and read their outcome in the result.


The set below reflects the current release and is intentionally not presented as a final count. New capabilities are added in minor releases — always check paxman.capabilities or the release notes for the latest list.

CapabilityWhat it canonicalizesKey formats it recognizesCanonical form you get back
CountryCountry codes and namesalpha-2, alpha-3, numeric, names; optional localized (CLDR) and historical namesalpha-2 code ("US"), or other form via output_format
CurrencyCurrency identifiers (no amounts)ISO 4217 alpha-3 codes, CLDR symbols and display namesuppercase alpha-3 code ("USD")
DateCalendar datesISO 8601, slash-ISO, US, EuropeanISO YYYY-MM-DD by default
EmailEmail addressesstandard, obfuscated (user at domain dot com), localhostlowercased addr-spec
IPIP addressesIPv4, IPv6 (optionally disabled)normalized address (IPv6 per RFC 5952)
ISBNISBN identifiersISBN-13 and ISBN-10 (legacy → ISBN-13)bare 13-digit form or hyphenated
MoneyMoney amounts with currencycodes, symbols, or names adjacent to an amountCODE amount padded to minor units
PhonePhone numbersE.164, tel-URI, 00-prefix international, NANP nationalE.164 (+15551234567) or other via output_format
SI UnitSI unit expressionssymbols, names, product/quotient compoundscanonical symbol form ("kg", "m/s2")
URLAbsolute URIs / IRIsabsolute URIs (WHATWG URL Standard)WHATWG serialization (lowercased host, etc.)

This table is an overview. Each capability’s contract documents its specific flags (e.g. include_localized for Country, default_country for Phone). See Contracts and the README examples for per-capability details; each row is expanded into its own guide under Capabilities.


Before the first canonicalize() call, register:

import paxman
from paxman.capabilities import Email, Country
# Option A — everything shipped in this release
paxman.register_all_shipped()
# Option B — explicit, dependency-clear
paxman.register_capability(Email())
paxman.register_capability(Country())
  • Registration must complete from a single thread before the first call.
  • After the first call the registry freezes — further register_* calls raise CapabilityError. Reads from any thread are then safe.

Think of a capability like a department that handles one kind of paperwork. The Country department knows passports and country codes; the Email department knows addresses. You hand your paper to the right department by handing it a contract stamped with that department’s name. Only that department looks at it. Other departments never see it.

Next: Contracts → — how to configure what the chosen capability does.