This project implements an Optical Character Recognition (OCR) pipeline for Marathi-language PDF documents using Tesseract OCR and PyTesseract. The system extracts Marathi text from scanned or image-based PDFs and translates it into English using Google Translate, enabling easy understanding and further analysis.
This solution is especially useful for digitizing regional-language documents such as government records, academic documents, and historical archives.
- PDF to image conversion
- Marathi text recognition using Tesseract OCR
- Marathi Tesseract language model (
mar) - Translation from Marathi to English using Google Translate
- Clean and structured text extraction
- Works with scanned and image-based PDFs
- Python
- Tesseract OCR
- PyTesseract
- Marathi Tesseract Language Pack (
mar.traineddata) - pdf2image
- Pillow (PIL)
- Google Translate (API / googletrans library)
- Input Marathi PDF document
- Convert PDF pages to images using
pdf2image - (Optional) Image preprocessing for better OCR accuracy
- Extract Marathi text using PyTesseract (
lang="mar") - Clean OCR output text
- Translate Marathi text into English using Google Translate
- Store translated text in text files or structured format
git clone https://github.com/your-username/marathi-ocr-translation.git
cd marathi-ocr-translationpip install pytesseract pdf2image pillow googletrans==4.0.0-rc1sudo apt install tesseract-ocr
sudo apt install tesseract-ocr-mar-
Download Tesseract from: https://github.com/UB-Mannheim/tesseract/wiki
-
Add Tesseract to system PATH
-
Download
mar.traineddataand place it in:tessdata/
from pdf2image import convert_from_path
import pytesseract
from googletrans import Translator
translator = Translator()
images = convert_from_path("input.pdf")
for img in images:
marathi_text = pytesseract.image_to_string(img, lang="mar")
translated_text = translator.translate(marathi_text, src="mr", dest="en")
print(translated_text.text)- OCR Input Language: Marathi (
mr) - Translation Output Language: English (
en)
- OCR accuracy depends on scan quality and font clarity
- Google Translate accuracy may vary for complex or domain-specific Marathi text
- Handwritten Marathi text is not supported
- Tables and multi-column layouts may require extra processing
- Advanced image preprocessing
- Layout and table detection
- Offline translation support
- Web interface using Flask or Streamlit
- Batch processing for large datasets
Collaboration & Contributions
Contributions are welcome and encouraged!
Atharva Shinde Marathi OCR | NLP | Document Digitization
🚀