INNER CODE UNIT · Python
_structural_nonheading
Laurent00TT/PharosRAG · src/chunker/core.py:136
def _structural_nonheading(txt):
"""Text-shape rejects shared by the leveling pass and the reset-aware pre-pass."""
return bool(TOC_RE.search(txt) or TOC_TAIL_RE.match(txt)
or len(txt) > MAX_HEADING_LEN or BULLET_RE.match(txt))
def _leading_number(txt):
"""Parse a leading section/list number -> ('dotted', depth) | ('bare', value) | None.
Year-leading (2026 ...) is treated as not-a-number (review F1/F4)."""
m = NUM_RE.match(txt)
if not m:
return None
tok = m.group(1)
if YEAR_RE.match(tok.split(".")[0]):
return None
if "." in tok:
return ("dotted", tok.count(".") + 1)
if tok.isdigit():