Skip to content

fix: preserve pinyin dictionary coverage and audit source syllables - #2

Merged
DeoLeung merged 1 commit into
mainfrom
codex/dictionary-coverage-p0
Oct 13, 2026
Merged

DeoLeung merged 1 commit into
mainfrom
codex/dictionary-coverage-p0

Conversation

@DeoLeung

Copy link
Copy Markdown
Contributor

Summary

  • Repair umlaut normalization and preserve source syllable boundaries without greedily resegmenting joined pinyin.
  • Restore all 64,091 phrases omitted by the initial P0 source replacement. The final dictionary has 196,188 keys: every 157,702 released key plus 38,486 new keys.
  • Import hash-pinned raw CC-CEDICT snapshots with both written forms and explicit syllables. Preserve original licenses, historical-source labels, conflicts, and one line-bound mixed-script compatibility alias.
  • Add a reproducible per-word coverage audit, fail generation on any released-key loss, and independently replay restoration provenance in regression tests.
  • Keep the optional SQL backend and Rust extension separate; make SQL loading transactional and refresh dictionary planner statistics.
  • Add targeted pronunciation and real BM25 regressions, a standalone stratified benchmark, bilingual README results, and the P0/P1/P2 specification.

Coverage and Accuracy

  • Missing released keys: 0; missing initial-P0 keys: 0.
  • Selected restoration sources: current official CC-CEDICT 58,956 keys, historical 2019 3,518, historical 2013 1,617. Historical retention is not independent current pronunciation confirmation.
  • Of the restored words, 61,868 normalized sequences stay unchanged and 2,223 change. Changed readings are reconciliation counts, not a measured linguistic error rate.
  • Exact curated word regressions: 33/55 -> 55/55; curated Rust BM25 Recall@10 / MRR: 0.6000 / 0.4606 -> 1.0000 / 0.8273. These are targeted fixtures, not representative Mandarin accuracy.

Benchmark

PG19 beta4 / pg_search 0.25.1, identical compiled runtime, 20,000 identical phrases across retained/restored/new strata, 2,000 full queries, three rotated-order repeats, fresh per-variant databases/backends.

Metric Released CSVs Corrected CSVs
Rust text romanization, warm median 333.270 ms 292.435 ms (-12.25%)
Rust full-query batch, median 1,841.729 ms 1,867.646 ms (+1.41%)
SQL exact-array romanization, warm median 3,015.929 ms 3,708.735 ms (+22.97%)
BM25 index bytes 3,309,568 3,309,568

Full-query latency is effectively unchanged; no index reduction is established. The large legacy SQL phrase-or-character improvement is consistent with avoiding character fallback on newly covered phrases, not a parser algorithm change. Host swap pressure and large per-run variation limit speedup claims. Dictionary-derived synthetic retrieval labels are reported separately from curated accuracy.

Reports: sql/data/reports/coverage_audit.md and its per-word JSON; benchmarks/p0_dictionary.md and its raw JSON. Sources, outputs, plans, result IDs, and benchmark hashes are retained.

Validation

  • 43 Python tests passed, including generator/audit, provenance replay, benchmark protocol, and SQL-only loader/rollback tests.
  • PG19 beta4 fresh installation and pgTAP: 233 assertions passed, including forced-parallel read-only regressions.
  • cargo fmt --check, Rust library check, and standalone benchmark binary check passed.
  • Two complete imports produced byte-identical dictionaries and reports; manifest and benchmark hashes match.
  • This does not imply local validation of every supported PostgreSQL major or a complete DEB/RPM package build; CI covers PG18 and PG19.

Deployment Notes

No version bump or automatic destructive dictionary migration. Existing installations must explicitly reload/reseed after backing up custom base entries, refresh stored generated values, and rebuild expression indexes. Suffix dictionaries stay independent. Pre-existing doc/ and the unrelated general benchmark text report are excluded.

Restore all legacy phrase keys from pinned syllable-preserving sources, enforce reproducible coverage audits, and add accuracy regressions with stratified benchmark evidence.
@DeoLeung
DeoLeung merged commit f5538b5 into main Oct 13, 2026
8 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