Parse PDF files using different parsers.
Project description
ParserStudio
Parsestudio is a powerful Python library for extracting and parsing content from PDF documents. It provides an intuitive interface for handling diverse tasks such as extracting text, tables, and images using different parsing backends.
Key Features
- Modular Design: Choose between multiple parser backends (Docling, PymuPDF, Llama Parse) to suit your needs.
- Multimodal Parsing: Extract text, tables, and images seamlessly.
- Extensible: Easily adjust parsing behavior with additional parameters.
Installation
Get started with Parsestudio by installing it via pip:
pip install parsestudio
Install the library from source by cloning the repository and running:
git clone https://github.com/chatclimate-ai/ParseStudio.git
cd ParseStudio
pip install .
Quick Start
1. Import and Initialize the Parser
from parsestudio.parse import PDFParser
# Initialize with the desired parser backend
parser = PDFParser(parser="docling") # Options: "docling", "pymupdf", "llama"
2. Parse a PDF File
outputs = parser.run("path/to/file.pdf", modalities=["text", "tables", "images"])
# Access text content
print(outputs[0].text)
# Output: text="This is the extracted text content from the PDF file."
# Access tables
for table in outputs[0].tables[0]:
print(table.markdown)
# Output: | Header 1 | Header 2 |
# |----------|----------|
# | Value 1 | Value 2 |
# Access images
for image in outputs[0].images[0]:
image.image.show()
metadata = image.metadata
print(metadata)
# Output: Metadata(page_number=1, bbox=[0, 0, 100, 100])
3. Supported Parsers
Choose from the following parsers based on your requirements:
- Docling: Advanced parser with multimodal capabilities.
- PyMuPDF: Lightweight and efficient.
- LlamaParse: AI-enhanced parser with advanced capabilities.
Each parser has its own strengths. Choose the one that best fits your use case.
Llama Setup
If you choose to use the LlamaPDFParser, you need to set up an API key. Follow these steps:
- Create a
.envFile: In the root directory of your project, create a file named.env. - Add Your API Key: Add the following line to the .env file, replacing your-api-key with your Llmap API key:
LLAMA_API_KEY=your-api-key
Contributing
We welcome contributions from the community! To contribute to Parsestudio, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them.
- Push your changes to your fork.
- Open a pull request.
- Our team will review your changes and merge them if they meet our guidelines.
Congratulations! You've contributed to Parsestudio.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file parsestudio-1.0.3.tar.gz.
File metadata
- Download URL: parsestudio-1.0.3.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e78bb3464eee3fe9924d0168c1e36ac3ed5da4767226a31dbf112ccf0dcb4a33
|
|
| MD5 |
d19ac37994e6389ddb616303d5b9e46b
|
|
| BLAKE2b-256 |
d171d8b09afc01c219e892573b58214806af5518f7ceed2cb3768b92f8361b19
|
File details
Details for the file parsestudio-1.0.3-py3-none-any.whl.
File metadata
- Download URL: parsestudio-1.0.3-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e566a58911383691baf6a55b002531beecabc4fe17d463314dcb1c2ad38a5c7c
|
|
| MD5 |
b4eb1fb7e7938bfc32362cc1dbdf2a13
|
|
| BLAKE2b-256 |
23f8abb05d6bf5b454cb5e3fb494289b3f9fe53b9a291aec11c1401a61e534d0
|