🇪🇬 arabic-pdf-rag
Arabic-First PDF Extraction, RTL Normalization & Table Chunking Engine for RAG Pipelines.
📌 The Problem
Standard PDF readers (PyPDF, PDFMiner, Unstructured) mangle Arabic text:
- ❌ Arabic letters come out disconnected (
م ح م دinstead ofمحمد). - ❌ Sentences are reversed from Left-to-Right instead of Right-to-Left (RTL).
- ❌ Digits and mixed Arabic/English technical terms get garbled.
- ❌ Vector embeddings in Qdrant/Chroma store corrupted text, leading to failed RAG retrieval.
arabic-pdf-rag solves this completely in 2 lines of Python code!
⚡ Quick Start
pip install arabic-pdf-rag
Usage Example:
from arabic_pdf_rag import ArabicRAGExtractor
extractor = ArabicRAGExtractor()
# Extract and normalize Arabic PDF for RAG
documents = extractor.extract_pdf("egyptian_law_document.pdf")
for doc in documents:
print(f"Page {doc.page_number}:")
print(doc.clean_text)
# Generate RAG-ready chunks
chunks = extractor.chunk_document(documents, chunk_size=500, overlap=50)
print(f"Generated {len(chunks)} RAG chunks ready for Vector DB!")
🛠️ Features
- 🔄 Automatic RTL Reshaping & Bidi Normalization.
- 📄 Multi-Format Extraction: PDF, scanned text, and tables.
- 📑 Smart Paragraph & Semantic Chunking tailored for Arabic syntax.
- 🔒 100% Offline & Air-Gapped Safe: Zero external API calls.
👤 Author
Mohamed Shaban (محمد شعبان العتماني) — Applied AI Engineer
🌐 Website: msalatmani.org | 📧 Email: msalatmani@gmail.com
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 arabic_pdf_rag-0.1.0.tar.gz.
File metadata
- Download URL: arabic_pdf_rag-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18c89443d0d1ac62ea7e605173b2e387f4832ec3ede408a0beb6308564882da6
|
|
| MD5 |
ef8375c0e76bc6cbfd8938040356404f
|
|
| BLAKE2b-256 |
24f0b2fcaca38de35cde8ed9d5d37027768058092cd672894372ebd4deaa8b96
|
File details
Details for the file arabic_pdf_rag-0.1.0-py3-none-any.whl.
File metadata
- Download URL: arabic_pdf_rag-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca39498325b36deea19b8bd5e677a51bb4859c7a58d5f61d10d514b58fc03da1
|
|
| MD5 |
77eb425c1502df7783571ec4e1f231e1
|
|
| BLAKE2b-256 |
f02e7f25c20ba8b67151c21579099221c9d50f4745a6d6dea4aec8035edd4d63
|