Skip to content

Drop ICU: the tokenizers' Unicode comes from jolt's own tables - #7

Merged
yogthos merged 1 commit into
mainfrom
drop-icu
Oct 15, 2026
Merged

yogthos merged 1 commit into
mainfrom
drop-icu

Conversation

@yogthos

@yogthos yogthos commented Oct 15, 2026

Copy link
Copy Markdown
Member

The tokenizers got NFC, NFD, lowercasing, the character categories and White_Space from ICU through FFI. jolt has its own Unicode tables (Character/getType, java.text.Normalizer), so lev.tokenizer now uses those, and the icu native is removed from deps.edn.

This also fixes two portability problems:

  • deficu picked the versioned symbol (u_charType_74) when the macro expanded. A built binary therefore only ran against the ICU major version it was built with.
  • The candidate list skipped ICU 70 (Ubuntu 22.04), so lev refused to start there.

char-type keeps ICU's numbering. The JVM's constants are the same except for a gap at 17, so codes from 18 up shift down by one.

Verification

  • Compared every code point against ICU 70:
    • White_Space and NFC: identical everywhere.
    • Categories: differ on 15,106 code points.
    • NFD: differs on 20; lowercase on 55.
    • Every difference is a code point assigned or recategorized after Unicode 14, which ICU 70 predates (e.g. U+0295 moved from Ll to Lo in Unicode 16).
  • Ran the suite one namespace per process with the english checkpoint and TinyDecide, before and after, with ICU removed from the library path for the after run. Every namespace gives the same result, including tokenizer (83 assertions), lang (225) and tinydecide (211). The only failures, in prepare, router and server, are the same tests before and after; they need the typed-decisions/multilingual checkpoints. tensors and checkpoints weren't run: they don't fit in this machine's 7 GB of RAM.

NFC, NFD, lowercasing, the character categories and White_Space came from
ICU through FFI. jolt carries the Unicode tables itself (Character/getType,
java.text.Normalizer), so lev.tokenizer reads those, and the icu native is
gone from deps.edn.

That also fixes two portability problems. deficu picked the versioned
symbol (u_charType_74) at expansion time, so a built binary ran only
against the ICU major it was built with. And the candidate list missed
ICU 70 (Ubuntu 22.04), where lev refused to start at all.

char-type keeps ICU's numbering: the JVM's constants are the same but for
the gap it leaves at 17. Checked over every code point against ICU 70:
White_Space and NFC agree everywhere; categories, NFD and lowercase differ
only on code points assigned or recategorized after Unicode 14, which
ICU 70 predates. The suite gives the same results as with ICU.
@yogthos
yogthos merged commit 8c74a69 into main Oct 15, 2026
2 checks passed
@yogthos
yogthos deleted the drop-icu branch October 15, 2026 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant