Skip to main content

arxiv-sectionizer

Extract semantic sections — Future Work, Limitations, Conclusion, Discussion, etc. — from arXiv LaTeX source archives. Zero runtime dependencies.

The arxiv package hands you metadata and a PDF URL. This library hands you the sections you actually want, pulled from LaTeX source with \input{} / \include{} / \subfile{} includes resolved.

Install

pip install arxiv-sectionizer

Quickstart

from arxiv_sectionizer import sectionize

# Accepts a tar.gz path, raw bytes, a .gz, or a .tex string.
for s in sectionize("2401.01234.tar.gz", kinds="future_work"):
    print(s.title)
    print(s.body[:300])

Want every section? Omit kinds:

sections = sectionize("paper.tar.gz")
for s in sections:
    print(s.kind or "-", s.level, s.title)

Lower-level API

from arxiv_sectionizer import read_archive, flatten, extract_sections, find_sections

files = read_archive("paper.tar.gz")          # dict[str, str] of every .tex member
tex = flatten(files)                          # resolve \input{}/\include{}/\subfile{}
sections = extract_sections(tex)              # all sections, with .kind classification
future = find_sections(tex, "future_work")    # only matching categories

Each Section is:

Section(
    title: str,
    body: str,
    level: int,          # 0=chapter, 1=section, 2=subsection, ...
    kind: str | None,    # "future_work" | "limitations" | "conclusion" | ...
    start: int,          # byte offsets into the flattened source
    end: int,
)

Custom categories

The default category map covers the usual targets. Override it with your own keyword map:

from arxiv_sectionizer import Categories, extract_sections

cats = Categories(mapping={
    "open_problems": ("open problem", "unsolved"),
    "ablation":      ("ablation",),
})
sections = extract_sections(tex, categories=cats, only_classified=True)

Default categories: future_work, limitations, conclusion, discussion, related_work, introduction, abstract, methods, results.

CLI

arxiv-sectionize paper.tar.gz --kind future_work,limitations
arxiv-sectionize paper.tar.gz --titles-only
arxiv-sectionize paper.tar.gz --json > sections.json

Why

Every paper-mining pipeline re-implements "give me this section from this paper" over LaTeX, and every implementation re-discovers the same edge cases:

  • nested \subsection / \paragraph
  • starred forms (\section*{...})
  • titles with inline LaTeX commands (\section{Results on \textsc{LibriTTS}})
  • split-file papers using \input{conclusion}
  • comment-outed sections (% \section{Old})
  • PDF-only submissions with no .tex source

This library handles those once.

License

MIT

Metadata

Release files for arxiv-sectionizer 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arxiv-sectionizer 0.1.0
File Size Uploaded Provenance
arxiv_sectionizer-0.1.0.tar.gz 9.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for arxiv-sectionizer 0.1.0
File Interpreter ABI Platform
arxiv_sectionizer-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / arxiv_sectionizer-0.1.0.tar.gz

Download URL arxiv_sectionizer-0.1.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d691fa9b17a0f61e67600e742af9ea0c077f253cd3efc5d5be1f24328a72d139
BLAKE2b-256 checksum
How to use checksums
9ec31794ed0bcd67521b3a1c24a4479d7b80d3109757b31e4ede7c90ef9087e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / arxiv_sectionizer-0.1.0-py3-none-any.whl

Download URL arxiv_sectionizer-0.1.0-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ffa9d3a6f623c68e95d82998703e79275ae651e5920d559c9f725536a2b238ed
BLAKE2b-256 checksum
How to use checksums
42115f654451fe681aac5c3b019e7c29e365c895231341939aca97a7bb2ce4fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for arxiv-sectionizer 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page