Skip to main content

NORM-1 normalization

Version: V2
View Markdown

NORM-1 turns free text into one deterministic spelling so that independent implementations hash the same bytes. It applies to every text value in a gen1 recipe, and to the handle in the weak form of the acct scheme. It is never applied to the values of Class A or Class B schemes, which have their own canonicalization rules. IID spec §4.1

The algorithm​

Apply the five steps in this order. The step order is frozen. A change to any step would ship as a new algorithm, NORM-2, together with a new derivation scheme, gen2. IID spec §4.2

StepOperationDetail
1Unicode NFKCCompatibility composition. Full-width and ligature forms become their ordinary equivalents.
2Punctuation folding‘ ’ ʼ become '. “ ” become ". – — − become -.
3Unicode full case foldingFull folding, not simple lowercasing. ß and ẞ become ss, ς becomes σ, and İ becomes i followed by U+0307.
4TrimRemove leading and trailing whitespace.
5CollapseReplace each run of internal whitespace with one U+0020 space.

A platform that offers only simple lowercasing must add the full-folding special cases from step 3 itself. Otherwise STRAẞE and strasse would hash differently on different platforms. Step 3

Worked examples​

InputNORM-1 output
" Inception "inception
Don’t Stop Me Nowdon't stop me now
STRAẞEstrasse
Sigur Róssigur rós
The + tab + Beatlesthe beatles
Full-width Metameta
Jay–Zjay-z

IID spec §4.3

What NORM-1 deliberately does not do​

NORM-1 removes only differences that never change meaning. Anything that could merge two genuinely different names is left to the equivalence layer, where people can dispute it. IID spec §4.4

  • No diacritic stripping. Björk and Bjork stay different. Deciding that they name the same artist is a merge decision.
  • Nothing language-specific. No & to and, no moving "The" in "Beatles, The", no stemming and no transliteration.
  • Nothing domain-specific. Suffixes such as (feat. …) or (Remastered) stay in place. Removing them is enrichment, before derivation.
  • No truncation. The full normalized value enters the hash.

Non-string values​

Some recipes include dates or numbers. Format them before hashing. IID spec §4.5

ValueFormat
DateYYYY-MM-DD. A recipe may specify the year alone, YYYY.
NumberThe shortest decimal string that round-trips to the same value.
Boolean or arrayNot permitted in a recipe.
Null or absentThe rung does not fire.

Requirements​

An implementation must apply the steps in order, as a pure function with no locale or configuration input. A value that is empty after NORM-1 is treated as absent, so a recipe that requires it does not fire. IID spec §4.6

Applies to V2 · @0xintuition/iid 0.1.1