Skip to content

Latest commit

 

History

History
81 lines (61 loc) · 4.39 KB

File metadata and controls

81 lines (61 loc) · 4.39 KB

Title 26 Parsing

This document covers the Title 26-specific parsing and hierarchy extraction behavior. It is intentionally separate from readme.md to keep the directory README focused on the overall parsing pipeline.

Parser behavior

Implemented in title26_parser.py:

  • Limited to certain page ranges of focused sections
  • Uses a regex-based accumulator to identify hierarchy markers and maintain state (section/subsection/paragraph/...).
  • Emits Document objects with hierarchy metadata:
    • section, subsection, paragraph, subparagraph, clause, subclause, item
    • breadcrumb, full_path, nlp_path
    • provenance: source, page_number, bbox
  • Enforces a hard size limit by splitting at paragraph boundaries (and marking continuations when needed).
  • Ends a section when encountering statutory “notes” regions (amendments/editorial notes/citations/cross references).

Downstream hierarchy graph construction is done by Title26HierarchyExtractor in packages/src/ingestion/kg_extractors/title26_heirarchy_extractor.py.

Focused document sections

Section Title Pages
§11 Tax imposed 153
§61 Gross income defined 789
§62 Adjusted gross income defined 793–797
§63 Taxable income defined 805–807
§162 Trade or business expenses 1259–1271
§163 Interest 1285–1300
§164 Taxes 1312–1315
§165 Losses 1320–1325
§170 Charitable, etc., contributions and gifts 1448–1476
§197 Amortization of goodwill and certain other intangibles 1583–1588
§199A Qualified business income 1593–1602
§1017 Discharge of indebtedness 3774–3776
§263A Capitalization and inclusion in inventory costs 1714–1720
§501. Exemption from tax on corporations, certain trusts, etc. 2781–2802
§861 Income from sources within the United States 3377–3380
§864 Definitions and special rules 3398–3406
§6011 General requirement of return, statement, or list 5519–5521
§6651 Failure to file tax return or to pay tax 6251–6253
§6652 Failure to file certain information returns, etc. 6257–6262
§6654 Failure by individual to pay estimated income tax 6275–6280
§6655 Failure by corporation to pay estimated income tax 6289–6259

Section hierarchy markers

Level Name Marker Pattern Description
1 Subsection (a), (b), (c)... Primary subdivision under a section
2 Paragraph (1), (2), (3)... Nested under a subsection
3 Subparagraph (A), (B), (C)... Nested under a paragraph
4 Clause (i), (ii), (iii)... Nested under a subparagraph
5 Subclause (I), (II), (III)... Nested under a clause
6 Item (aa), (bb)... Optional deeper subdivision

Example layout:

§162. Trade or business expenses.

(a) In general.—
    (1) Allowance of deduction.—
        (A) Ordinary and necessary.—
            (i) Definition.—
                (I) In general.—
                    (aa) First detail...
                    (bb) Second detail...
            (ii) Additional rule.—
        (B) Special limitations.—
    (2) Other rules.—