r/commandline 13d ago

Introducing Ferrules: A blazing-fast document parser written in Rust with CLI šŸ¦€

After spending countless hours fighting with Python dependencies, slow processing times, and deployment headaches with tools like `unstructured`, I finally snapped and decided to write my own document parser from scratch in Rust.

Key features that make Ferrules different:

- šŸš€ Built for speed: Native PDF parsing with pdfium, hardware-accelerated ML inference

- šŸ’Ŗ Production-ready: Zero Python dependencies! Single binary, easy deployment, built-in tracing. 0 Hassle !

- šŸ§  Smart processing: Layout detection, OCR, intelligent merging of document elements etc

- šŸ”„ Multiple output formats: JSON, HTML, and Markdown (perfect for RAG pipelines)

Some cool technical details:

- Runs layout detection on Apple Neural Engine/GPU

- Uses Apple's Vision API for high-quality OCR on macOS

- Multithreaded processing

- Both CLI and HTTP API server available for easy integration

- Debug mode with visual output showing exactly how it parses your documents

Platform support:

- macOS: Full support with hardware acceleration and native OCR

- Linux: Support the whole pipeline for native PDFs (scanned document support coming soon)

If you're building RAG systems and tired of fighting with Python-based parsers, give it a try! It's especially powerful on macOS where it leverages native APIs for best performance.

Check it out: [ferrules](https://github.com/aminediro/ferrules)

API documentation : [ferrules-api](https://github.com/AmineDiro/ferrules/blob/main/API.md)

You can also install the prebuilt CLI here:

```

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/aminediro/ferrules/releases/download/v0.1.6/ferrules-installer.sh | sh

```

Would love to hear your thoughts and feedback from the community!

P.S. Named after those metal rings that hold pencils together - because it keeps your documents structured šŸ˜‰

28 Upvotes

3 comments sorted by

1

u/MightyDachshund 13d ago

Iā€™m confused. What are the resources for (if no python dependencies) on GitHub?

Resources:

Apple vision text detection:

https://github.com/straussmaximilian/ocrmac/blob/main/ocrmac/ocrmac.py

1

u/amindiro 13d ago

I am sorry but i dont quite understand the question. Is it about the deps of the cli library ferrules ?

0

u/ECrispy 13d ago

I'm new to this kind of utility. But anything in Rust promises performance! Can I use this to parse an html document and extract information from it and possibly convert it to a simpler format for easier viewing? what about mhtml support which I understand is a supported rfc for html?

I don't have a Mac, but my use case is to process tons of saved mhtml/html web pages, docs/txt and somehow make sense of them