Skip to content

denisecase/zig-bill-utils

Repository files navigation

zig-bill-utils

Built with Zig

Toolkit for analyzing U.S. legislative bills.

Tested with H.Con.Res.14: Establishing the congressional budget for the United States Government for fiscal year 2025 and setting forth the appropriate budgetary levels for fiscal years 2026 through 2034.

  • 119th Congress (2025-2026)

Built with a recent version of Zig

Use high-performance Zig to enhance Python projects, e.g., py-bill-utils.

CLI Tools

Each tool is available in two versions:

  • _file/: Reads from file using std.fs.File.
  • _stream/: Reads from stdin using std.io streams.

All tools are implemented using Zig's standard library. This project provides CLI tools in zig-out os-specific folders.

Tool Description
clean_bill Cleans bill text (removes line numbers, whitespace)
extract_amendments Extracts amendments
extract_headings Extracts section headers (TITLE, SEC.)
extract_money Extracts funding amounts (e.g., $5,000,000)
filter_keywords Filters lines by keyword (listed in keywords.txt)
split_sections Splits full bill into files by section

Features

  • Fast & lightweight: Built with Zig for speed and clarity
  • No runtime dependencies: Fully static executables
  • Self-documenting: Every tool has --help

Quick Start

Run pipeline on each data/billname folder:

./zig-bill-utils-run.ps1

Development

Choose commands to build for each target as needed (Zig 0.15+ required) or run them all with PowerShell Core.

zig build install -Dtarget=aarch64-macos -Doptimize=ReleaseSafe
zig build install -Dtarget=x86_64-linux -Doptimize=ReleaseSafe
zig build install -Dtarget=x86_64-macos -Doptimize=ReleaseSafe
zig build install -Dtarget=x86_64-windows -Doptimize=ReleaseSafe 


./build_all.ps1

Binaries are written to zig-out/ in operating-system specific folders.

Project Organization

  • data/billname/
    • bill.txt
    • amendments.csv
    • keywords.txt
  • src/ — Zig files for the CLI tools and shared utils and logger
  • output/billname/
    • amendments/
    • sections/
    • clean.txt
    • headings.txt
    • keyword_hits_amendments.txt
    • keyword_hits.txt
    • money_lines.csv

Reference

License

MIT License © 2025 Denise Case