Metadata-Version: 2.4
Name: arabic-pdf-rag
Version: 0.1.0
Summary: Arabic-First PDF Extraction, RTL Normalization & Table Chunking Engine for RAG Systems.
Home-page: https://msalatmani.org
Author: Mohamed Shaban (محمد شعبان العتماني)
Author-email: msalatmani@gmail.com
Project-URL: Homepage, https://msalatmani.org
Project-URL: Source, https://github.com/m0shaban/arabic-pdf-rag
Project-URL: Company, https://robovai.tech
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: pypdf>=3.10.0
Requires-Dist: pdfplumber>=0.10.0
Requires-Dist: python-bidi>=0.4.2
Requires-Dist: arabic-reshaper>=3.0.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 🇪🇬 arabic-pdf-rag
> **Arabic-First PDF Extraction, RTL Normalization & Table Chunking Engine for RAG Pipelines.**

[![PyPI](https://img.shields.io/badge/PyPI-arabic--pdf--rag-38bdf8?style=for-the-badge&logo=pypi&logoColor=white)](https://pypi.org/project/arabic-pdf-rag)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)

---

## 📌 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

```bash
pip install arabic-pdf-rag
```

### Usage Example:

```python
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](https://msalatmani.org) | 📧 Email: msalatmani@gmail.com
