The running-header normalizer's unit group used the character class
[课章节单元], which matches a single character. A 单元 (unit) token was
split: only 单 was captured and the orphaned 元 leaked into the chapter
name, so 第1单元 导论 normalized to 第1单 元 导论. The malformed title then
failed UNIT_RE_MAP[单元] matching, dropping header-embedded 单元 chapters
during rebuild. The function docstring already promises the canonical
第N单元 章名 shape. Match the two-char token first: 单元|[课章节].
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Some publishers print the chapter name embedded mid-text in the running
header (e.g. "集合第1章", "空间向量与立体几何 第6章"), often without a
leading "第", while the footer only carries the publisher name — a
footer-only pass then finds zero chapters.
page_facts() now reads chapter-shaped furniture from both positions:
footer blocks matching CHAPTER_RE verbatim, and header blocks whose
chapter token sits mid-text, extracted via HEADER_CHAPTER_RE and
normalized to the canonical "第N章 章名" shape by
normalize_header_chapter() (bare token / name-before-token /
name-after-token forms; book titles, token-less headers and long prose
are rejected as boundaries). Both channels share the existing level
filter and seen-dedupe; the printed-page offset check verifies boundary
correctness end to end. Covered by 9 new tests including two-level
running-header unit filtering and offset constancy.
Deterministic, zero-LLM chapter tree extraction from MinerU layout.json:
column blacklist -> chapter regex -> page-top position band -> adjacent
merge, plus a header/footer path that reads the running chapter title and
the printed page number from discarded page furniture. Nothing in this
package imports deeptutor.