📄

Chuyển ảnh/PDF scan thành văn bản (OCR)

Trích xuất văn bản tiếng Việt từ file scan hoặc ảnh chụp tài liệu để copy/edit trong Word.

Document ⭐⭐⭐ Advanced ⏱️ 10 phút

😫 Vấn đề (The Pain Point)

Sếp đưa cho bạn một tờ văn bản giấy (hoặc file scan PDF) và bảo: “Gõ lại cái này vào Word cho anh”. Ngồi gõ lại từng chữ? Thời đại nào rồi!

🚀 Giải pháp Agentic (The Solution)

Sử dụng công nghệ OCR (Optical Character Recognition) với engine Tesseract nổi tiếng của Google để đọc chữ từ ảnh.

Tính năng:

  • Vietnamese Support: Hỗ trợ tiếng Việt có dấu cực tốt (cần cài data tiếng Việt).
  • Layout Preservation: Cố gắng giữ nguyên đoạn văn.
  • Bulk OCR: Chuyển đổi cả xấp tài liệu cùng lúc.

OCR Vietnamese Screenshot

🤖 Engineering Prompt (Copy & Paste)

**Role:** Python OCR Developer

**Task:** Create a "Vietnamese OCR Tool" (Image/PDF to Text).

**Requirements:**
1.  **Tech Stack:** Python, `tkinter`, `pytesseract`.
2.  **System Dependency:** Requires `Tesseract-OCR` installed and language data `vie` (Vietnamese).
3.  **GUI:**
    *   Select Input File (Image or PDF).
    *   Language Selection (eng, vie).
    *   "Convert to Text" button.
    *   Text Area to show result + "Copy" button.
    *   "Save as .txt" button.
4.  **Logic:**
    *   If PDF: convert to images first (using `pdf2image`).
    *   Run `pytesseract.image_to_string(img, lang='vie')`.
    *   Display output.
5.  **Deliverables:**
    *   `ocr_tool.py`
    *   `run.bat`
    *   `requirements.txt`

**Context:** Digitizing paper documents.

🧠 Giải mã Prompt

  • Tesseract & Data: Tesseract mặc định chỉ giỏi tiếng Anh. Để đọc tiếng Việt, bạn cần tải file vie.traineddata (Ebook sẽ hướng dẫn).
  • PDF Handling: Tesseract không đọc file PDF trực tiếp, nó đọc ảnh. Nên tool phải có bước trung gian “PDF -> Ảnh -> Chữ”.

🛠️ Hướng dẫn

  1. Cài đặt Tesseract OCR và gói Tiếng Việt.
  2. Copy Prompt -> Paste -> Chạy.
  3. Chọn ảnh văn bản -> Convert -> Copy text sang Word.

Workflows liên quan

Khám phá danh mục khác

📬

Get Started with Agentic Working

Subscribe to receive updates from AgenticWorking.io

📖 Free eBook Guide 📦 7 Ready-to-use Scripts 🔔 Weekly Tips

No spam, unsubscribe anytime. Join 1,000+ subscribers.