Skip to main content

🇪🇬 arabic-pdf-rag

Arabic-First PDF Extraction, RTL Normalization & Table Chunking Engine for RAG Pipelines.

PyPI License: 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

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

Metadata

Release files for arabic-pdf-rag 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arabic-pdf-rag 0.1.0
File Size Uploaded
arabic_pdf_rag-0.1.0.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for arabic-pdf-rag 0.1.0
File Interpreter ABI Platform
arabic_pdf_rag-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.8 kB

Release files / arabic_pdf_rag-0.1.0.tar.gz

Download URL arabic_pdf_rag-0.1.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
18c89443d0d1ac62ea7e605173b2e387f4832ec3ede408a0beb6308564882da6
BLAKE2b-256 checksum
How to use checksums
24f0b2fcaca38de35cde8ed9d5d37027768058092cd672894372ebd4deaa8b96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / arabic_pdf_rag-0.1.0-py3-none-any.whl

Download URL arabic_pdf_rag-0.1.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca39498325b36deea19b8bd5e677a51bb4859c7a58d5f61d10d514b58fc03da1
BLAKE2b-256 checksum
How to use checksums
f02e7f25c20ba8b67151c21579099221c9d50f4745a6d6dea4aec8035edd4d63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page