An example from the dictionary
Data Pribadi — Data Pribadi adalah data tentang orang perseorangan yang teridentifikasi atau dapat diidentifikasi secara tersendiri atau dikombinasi dengan informasi lainnya baik secara langsung maupun tidak langsung melalui sistem elektronik atau nonelektronik.
Reviewers can read the definition and open its legal source. This lookup-only entry is excluded from wording suggestions.
The problem
Indonesian legal drafting hinges on exact statutory wording across overlapping regulations. Reviewers want quick terminology checks on confidential drafts without uploading client text to third-party APIs or letting a language model rewrite clauses freely.
Built at Apple Developer Academy in SwiftUI and AppKit, Lawtionary keeps lookup and draft review local on Apple Silicon. I built the statutory data pipeline, hybrid retrieval layer, local MLX inference loop, and validation checks linking text spans back to laws.
Corpus and offline retrieval
I scraped and cleaned Indonesian statutory definitions into a September 2026 runtime corpus holding 2,982 term groups and 2,589 selected concepts, with 1,666 marked actionable for wording review (an earlier unfiltered scrape held 8,272 raw concepts before deduplication).
Dictionary lookup combines BM25 lexical matching with Multilingual-E5 dense vectors via reciprocal-rank fusion. At 2,589 concepts, querying a bundled embedding matrix in memory keeps lookup offline and fast without shipping a separate vector-database daemon.
Guardrails around local Qwen3.5 4B
Dictionary lookup stays isolated from draft review. When reviewing a draft, deterministic rules and hybrid retrieval collect candidate terms first; local Qwen3.5 4B Base running through MLX then assesses only those candidates behind four checks:
- Structured output parsing drops malformed model responses before they hit the UI.
- Protected-text guards prevent edits to dates, identifiers, numbers, and statutory numbers.
- Citation binding attaches the statutory reference to every surfaced candidate.
- Deterministic fallback leaves unsupported phrases untouched so the reviewer reads the raw source directly.
Testing with legal reviewers
I sat through prototype sessions with law students, corporate counsel, and government legal staff. Watching students lean on dictionary search led me to prioritize targeted Dictionary data cleanup within our sprint window.
All counts and the Data Pribadi record above come from commit 94aa7003 (first-use model downloads and external regulation links still need internet access; formal legal accuracy benchmarks and separate adapter experiments sit outside this release snapshot).