INNER CODE UNIT · Python

banners

Laurent00TT/PharosRAG · src/chunker/core.py:259

        banners = _banner_texts(elements)          # round-2: drop per-page running banners
        kept = [e for e in elements
                if e.kind not in NOISE_KINDS and _norm(e.text) not in banners]

        # reset-aware switch (review F1): bare-integer numbering only promotes to L1 when
        # the doc's bare numbers form a monotonic outline. A restart (1..9,1.. = list usage)
        # means the numbers are list ordinals, not chapters -> defer to text_level.
        bare_seq = []
        for el in kept:
            txt = (el.text or "").strip()
            if not el.text_level or _structural_nonheading(txt):
                continue
            num = _leading_number(txt)
            if num and num[0] == "bare":
                bare_seq.append(num[1])
        promote_bare = all(bare_seq[i] > bare_seq[i - 1] for i in range(1, len(bare_seq)))

        # heading stack -> breadcrumb + deepest-section per element; collect headings

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…