Skip to content

Compress ordinals/forms data, drop build-only data retention - #277

Merged
pudo merged 1 commit into
mainfrom
feat/data-embedding
Sep 3, 2026
Merged

Compress ordinals/forms data, drop build-only data retention#277
pudo merged 1 commit into
mainfrom
feat/data-embedding

Conversation

@pudo

@pudo pudo commented Sep 3, 2026

Copy link
Copy Markdown
Member

Two related cleanups to the embedded-data handling in rigour-core:

Compression coverage. data/text/ordinals.json (~82 KiB) and data/addresses/forms.json (~11 KiB) were still embedded as plain include_str! blobs. Both are now entries in the build.rs zstd table and are decoded from OUT_DIR on use, like the other four data files. The committed plain-text sources are unchanged, so the CI make build diff check is unaffected.

Retention of build-only data. The parsed forms of symbols.json (five HashMaps, ~85 KiB source) and org_types.json (Vec<OrgTypeSpec>, ~126 KiB source) lived in LazyLock statics for process life, even though every reader is a tagger/replacer build that is itself cached (TAGGER_CACHE / REPLACER_CACHE). Those statics are now caller-owned decode functions, following the model person_names.rs and territories.rs already use — the data drops as soon as the derived automata exist. Same for the ordinals spec list, whose only runtime consumer (ordinals_dict() → Python) sits behind a Python-side @cache.

Untouched: the stopwords/compare tables (their statics are the runtime structures, and the sources are 1–3 KiB).

Also refreshes the stale zstd comment in rust/Cargo.toml and related doc drift (build.rs header sizes, generate_text.py docstring, CLAUDE.md data-resources section, territories module comment).

Verified: cargo clippy --all-targets -- -D warnings (with and without --features python), cargo test (259 passed), pytest --cov rigour (532 passed), mypy --strict rigour clean.

🤖 Generated with Claude Code

Add ordinals.json and address forms.json to the build.rs zstd table;
replace their include_str! embeddings with OUT_DIR decode-on-use.
Turn the symbols and org-types LazyLock statics into caller-owned
decode functions: every reader is a cached tagger/replacer build, so
the parsed source data now drops once those structures exist instead
of staying resident for process life. Refresh the stale zstd comment
in Cargo.toml and related doc drift.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@pudo
pudo force-pushed the feat/data-embedding branch from aaec2eb to f6c50f1 Compare September 3, 2026 12:48
@pudo
pudo merged commit 2a925af into main Sep 3, 2026
22 checks passed
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