Logo Lanfrica

Maevanirina/mg_translator

Domaine:

natural language processing

Type de record:

software
Créateur:
Mae
Hôte:
Using google cloud console API translate documents into Malagasy from french # PDF Official Document Processing Pipeline End-to-end pipeline for **extracting, translating and rebuilding** official PDF documents. Combines **Google Cloud Vision API** (OCR & layout analysis), **Google Cloud Translation API** (text translation), and **ReportLab** (PDF generation) into a single autonomous pipeline. ## Features - **Hybrid extraction**: automatically detects native text PDFs (PyMuPDF) vs scanned images (GCV OCR) - **Batch processing** of ~50+ PDF documents with parallel workers - **Google Cloud Vision API** for high-quality OCR on scanned documents - **Google Cloud Translation API** for automatic text translation (e.g. FR → MG) - **Structured extraction** (paragraphs & tables) with positional awareness - **Dual export**: clean rebuilt translated PDF + structured JSON side-car (original + translated) - **Full CLI**, logging, error handling, and type hints ## Architecture ``` ┌─────────────┐ ┌─────────────────────┐ ┌──────────────────┐ │ PDF Files │────→│ PyMuPDF (analyse) │────→│ Native text ? │ │ (~50 docs) │ │ _has_native_text() │ │ │ └─────────────┘ └─────────────────────┘ └────────┬─────────┘ │ ┌────────────────────┼────────────────────┐ │ YES │ NO (scanned) │ ▼ ▼ │ ┌──────────┐ ┌─────────────┐ │ │ PyMuPDF │ │ Rasterise │ │ │ extract │ │ → GCV OCR │ │ │ text │ │ │ │ └────┬─────┘ └──────┬──────┘ │ │ │ │ └──────────┬──────────┘ │ ▼ │ ┌─────────────┐ │ │ ContentBlocks│ │ │ (paragraphs, │ │ │ tables) │ │ └──────┬──────┘ │ │ │ ▼ │ ┌─────────────┐ …