Swarmauri Parser Slate
PDF text parser for Swarmauri using Slate3k (a lightweight PDFMiner wrapper). Extracts text from each PDF page and returns Document instances with page metadata.
Features
- Opens PDFs with Slate3k and returns a
Documentper page (content= text,metadataincludespage_numberandsource). - Accepts file paths (string). Raises a
TypeErrorwhen given anything else to prevent silent failures. - Returns an empty list if Slate encounters parsing errors, logging the exception to stdout.
Prerequisites
- Python 3.10 or newer.
- Slate3k depends on
pdfminer.six; make sure operating-system libraries required by PDFMiner (e.g.,libxml2,libxslton Linux) are installed. - Read access to the PDF path you pass in.
Installation
# pip
pip install swarmauri_parser_slate
# poetry
poetry add swarmauri_parser_slate
# uv (pyproject-based projects)
uv add swarmauri_parser_slate
Quickstart
from swarmauri_parser_slate import SlateParser
parser = SlateParser()
documents = parser.parse("pdfs/handbook.pdf")
for doc in documents:
print(doc.metadata["page_number"], doc.content[:120])
Handling Errors
parser = SlateParser()
try:
docs = parser.parse("missing.pdf")
if not docs:
print("No pages parsed or Slate returned no text.")
except TypeError as exc:
print(f"Bad input: {exc}")
Tips
- Slate3k works best on text-based PDFs. For scanned/bitmap PDFs, run OCR first (e.g.,
swarmauri_ocr_pytesseract). - Large PDFs can consume memory; consider chunking results or streaming pages to downstream processors.
- Combine with token counting or summarization measurements in Swarmauri to further process the extracted content.
Want to help?
If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.
Metadata
Release files for swarmauri_parser_slate 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swarmauri_parser_slate-0.3.0.tar.gz | 7.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmauri_parser_slate-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.5 kB
Release files / swarmauri_parser_slate-0.3.0.tar.gz
| Download URL | swarmauri_parser_slate-0.3.0.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb35608ac14899d057f89b1a9854b164b21f5699aa32dd9442c7c18956bb1908
|
|
BLAKE2b-256 checksum How to use checksums |
3782afa85814425a390f63f7e9d17ada086c5d57b6d455b822c05ae0a4a0bb57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_parser_slate-0.3.0-py3-none-any.whl
| Download URL | swarmauri_parser_slate-0.3.0-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1600043aec37dc9c302aab875949c3ec0a05ee2bed83d511a1ca672fa8fcadf8
|
|
BLAKE2b-256 checksum How to use checksums |
f266a80050a24dcc961c51a4595329d987fd2044c507e23a3b18dc17ffbe81b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|