π« The Pain Point
You have scanned contracts or photos of documents in Vietnamese. You need the text searchable and editable. Retyping manually is slow and error-prone.
π Agentic Solution
An OCR Tool optimized for Vietnamese text with high accuracy.
Key Features:
- Vietnamese Language Pack: Trained for VN characters (Δ, Γ’, Δ, Ζ‘, Ζ°).
- Image Preprocessing: Enhance contrast for better recognition.
- Batch Processing: Extract text from multiple images.
βοΈ Phase 1: Commander (Quick Fix)
For quick OCR.
Prompt:
βI have a folder
scanswith images of Vietnamese documents. Write a Python script using pytesseract to:
- Preprocess: Convert to grayscale, increase contrast.
- OCR: Extract text using Vietnamese language pack (
vie).- Output: Save text to
{filename}.txtfor each image.Print progress. Handle unreadable images (skip with warning).β
Result: Editable text from all scanned documents.
ποΈ Phase 2: Architect (Permanent Tool)
For Archivists.
Engineering Prompt:
**Role:** Python GUI Developer (PyQt6 Specialist)
**Task:** Create "Vietnamese OCR Pro" Desktop App
**Objective:** A dedicated OCR tool for Vietnamese documents with image preprocessing and bulk export.
**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* OCR Engine: Tesseract 5.0 (via pytesseract)
* Packaging: PyInstaller
**Functional Requirements:**
1. **UI Layout (PyQt6):**
* **Input:** Scan Folder / Drag & Drop Images.
* **Adjustments:** Sliders for "Contrast", "Brightness", "Threshold" (Live Preview).
* **Settings:** Language Selector (vie/eng), Output Format (TXT/Word).
* **Status:** "Processing 3/10..." progress bar.
2. **Core Logic:**
* **Preprocessing:** Convert to Grayscale -> Deskew -> Increase Contrast (using OpenCV/Pillow).
* **OCR:** Multithreaded calls to Tesseract engine.
* **Export:** Reconstruct paragraphs and save files.
* **Threading:** Essential for heavy image processing tasks.
3. **Deliverables:**
* `main.py`: Complete source code.
* `requirements.txt`: Dependencies.
* **Build Instructions:**
* Windows: `pyinstaller --onefile --noconsole main.py`
* macOS: `pyinstaller --windowed --noconsole main.py`
π§ Prompt Decoding
- Tesseract vie: Must download Vietnamese language data separately.
π οΈ Instructions
- Install Tesseract OCR engine.
- Download Vietnamese language pack.
- Install:
pip install pytesseract pillow - Copy Prompt β Run.