Skip to content

fix(documents): split no-TABLE and <PAGE> plain-text filings, print a table caption once (llmp.12.1) - #1534

Merged
dgunning merged 1 commit into
mainfrom
fix/llmp12-1-heldout-findings
Oct 13, 2026
Merged

dgunning merged 1 commit into
mainfrom
fix/llmp12-1-heldout-findings

Conversation

@dgunning

Copy link
Copy Markdown
Owner

Follow-ups to #1531 under edgartools-llmp.12.1, plus edgartools-2f4l0.

Changes

  • Plain-text filings with no <TABLE>. The wrapper <div> holds only text, so it built as one ParagraphNode and fix(documents): build a plain-text filing's blank-line blocks as paragraphs (llmp.12.1) #1531's split never ran. A preformatted div with no child elements and a blank line now builds as a container.
  • SGML <PAGE> markers. The marker is never closed, so lxml nested the rest of the filing inside it. The parser now drops it from plain-text input.
  • Regulation S-B titles. Items 1 and 2 titled "Description of Business" and "Description of Property" are now matched, item-numbered only. Both patterns are appended, and the 10-K pattern golden was re-snapshotted after checking that every existing pattern is byte-identical.
  • Table captions printed twice (2f4l0). Both table renderers open with the caption, and TextExtractor._extract_table appended it again. An SGML <CAPTION> is never closed, so it holds the whole table and the table printed twice. The extractor now adds the caption only when the rendered table doesn't already open with it.

Measured

  • 43 plain-text dev fixtures: 128k words removed and none gained. For each fixture, the removed words exactly match the skipped captions.
  • The 4 no-TABLE filings render the same text as before. The 2 <PAGE> filings render the same words, with paragraph breaks restored.
  • A 2004 plain-text 8-K's section tree now finds Items 1.01, 5.02 and 9.01; before, it found none. BriteSmile's 10-K adds Items 1 and 2, for 14 sections.
  • No 10-K, 10-Q or 20-F plain-text fixture changes its section keys apart from BriteSmile.
  • Held-out 10-K, report only and built without opening any held-out filing: both-exact 85.1% → 86.8%, recall 96.4% → 98.2%; 2001-06 both-exact 64.2% → 72.1%.

Verification

Locally:

  • test-fast: green after re-pins.
  • Regression lane: 4808 passed.
  • Slow lane: 157 passed. This includes the self-consistency ratchet and the boundary truth set, with no baseline changes.
  • Mutation check: each new test fails with its fix reverted.

🤖 Generated with Claude Code

… table caption once (edgartools-llmp.12.1, edgartools-2f4l0)

Three follow-ups to #1531, all measured on dev fixtures:

- A plain-text filing with no <TABLE> is one pre-wrap <div> of bare text,
  which _is_text_only_container built as a ParagraphNode, so its blank-line
  blocks could not split. Such a div now builds as a container.
- An unclosed SGML <PAGE> marker nested the rest of a filing in an inline
  element. The parser drops the marker from plain-text input.
- Regulation S-B 10-Ks title Items 1 and 2 "Description of Business" and
  "Description of Property"; both are appended, item-numbered only, and the
  10-K pattern golden re-snapshotted with every existing pattern verified
  byte-identical.

Unsplitting the <PAGE> S-1 exposed edgartools-2f4l0: both table renderers
open with the caption and TextExtractor._extract_table appended it again, so
every captioned table printed its caption twice, and an SGML <CAPTION> holds
the whole table. The caption is now added only when the rendered table does
not already open with it. Over 43 plain-text fixtures, 128k words go, every
one of them a skipped caption's (checked per fixture), and none are gained.

Held-out 10-K (report only, no held-out filing used): both-exact 85.1% ->
86.8%, recall 96.4% -> 98.2%; 2001-06 both-exact 64.2% -> 72.1%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dgunning
dgunning enabled auto-merge (squash) October 13, 2026 10:02
@dgunning
dgunning merged commit 2f3cb89 into main Oct 13, 2026
10 checks passed
@dgunning
dgunning deleted the fix/llmp12-1-heldout-findings branch October 13, 2026 10:22
dgunning pushed a commit that referenced this pull request Oct 18, 2026
…tement (GH #1563) (#1564)

* fix(sections): end an 8-K's last item at a preformatted signature statement (GH #1563)

An 8-K whose primary document is one preformatted (<pre>) block of plain
text kept the SIGNATURE block inside its last item, the behavior #1393
had already fixed for other layouts.

#1534 split a no-<TABLE> plain-text body at blank lines
(document_builder._add_text), so a bare SIGNATURE heading and the
sentence Form 8-K's General Instructions prescribe arrive as one
paragraph when the source has no blank line between them. Strategy 5c's
_SIGNATURE_STATEMENT was anchored at ^Pursuant to, so it no longer
matched and the last item ran on through the signature block.

_SIGNATURE_STATEMENT now accepts an optional leading SIGNATURE(S) label
before the prescribed sentence.

Filing 0000710782-24-000002 (CIK 710782, filed 2024-02-05, Item 8.01,
primary document 8k01.htm, one <pre> of 3,411 characters):
  before: Item 8.01 = 1,348 chars, SIGNATURE at offset 3,037 included
  after:  Item 8.01 = 972 chars, ending "...global competitiveness."

Regression test: tests/issues/regression/test_issue_1563.py (offline,
fixture tests/fixtures/issues/0000710782-24-000002.html).

* test(1563): parse the fixture once per module; trim changelog to behaviour

dgunning's review noted the document was parsed three times and that the
changelog bullet duplicated the root cause we keep in the PR and commit.
The fixture is now module-scoped and the bullet states the behaviour only.

No assertion or fixture content changes; 3 tests still pass.

---------

Co-authored-by: Shivam Maurya <shivam@programmingwithmaurya.com>
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