A modular, production-ready translation tool for technical documents, powered exclusively by the Groq API with a modern PyQt6 dark-themed GUI.
- 🔄 Groq API Translation — All translations powered by Groq's ultra-fast LLM inference
- 🧹 Text Preprocessing — Regex-based cleaning with technical token preservation
- 🌍 Language Detection — Automatic source language identification
- 📚 Custom Glossary — Manage technical terminology with priority-based replacement
- 🧠 Translation Memory — SQLite-backed cache to avoid redundant API calls
- 📊 Quality Evaluation — Length consistency, glossary coverage, and diff highlighting
- 📂 Multi-Format I/O — Support for TXT, DOCX, and PDF documents
- 🖥️ Modern GUI — Dark-themed PyQt6 interface with drag-and-drop support
ENSAM_Traduction/
├── main.py # Application entry point
├── config.py # Configuration & settings
├── requirements.txt # Python dependencies
├── LOGO.png # Application icon
│
├── src/ # Source code (MVC architecture)
│ ├── models/ # Business logic modules
│ │ ├── text_cleaner.py # Regex preprocessing pipeline
│ │ ├── language_detector.py # Language detection
│ │ ├── glossary_model.py # Technical glossary management
│ │ ├── translation_memory.py # SQLite TM cache
│ │ ├── groq_translator.py # Groq API integration
│ │ ├── document_parser.py # TXT/DOCX/PDF parsing
│ │ ├── document_writer.py # Multi-format output
│ │ ├── quality_evaluator.py # Translation quality metrics
│ │ ├── pipeline.py # Orchestration pipeline
│ │ ├── term_detector.py # Technical term detection
│ │ ├── term_explainer.py # AI-powered term definitions
│ │ ├── term_dictionary.py # Personal term dictionary
│ │ └── ocr_engine.py # Tesseract OCR integration
│ │
│ ├── views/ # PyQt6 UI layer (pure UI, no logic)
│ │ ├── main_view.py # Main application window
│ │ ├── glossary_editor_view.py # Glossary editor dialog
│ │ ├── tm_viewer_view.py # Translation memory viewer
│ │ ├── diff_viewer_view.py # Diff comparison viewer
│ │ ├── term_dictionary_panel.py # Term dictionary panel
│ │ ├── term_highlighter.py # Syntax highlighter for terms
│ │ ├── drop_zone.py # Drag-and-drop file zone
│ │ ├── styles_somber.qss # Somber (dark) theme
│ │ └── styles_light.qss # Light theme
│ │
│ └── controllers/ # Application logic
│ ├── app_controller.py # Main controller
│ └── workers.py # QThread background workers
│
├── data/ # Persistent data
│ ├── glossary.json # Default technical glossary
│ ├── term_dictionary.json # Personal term dictionary
│ └── translation_memory.db # Auto-created SQLite database
│
└── samples/ # Example input files
└── sample_technical.txt # Sample technical document
- Python 3.10 or higher
- A valid Groq API key
- Clone the repository:
git clone <repo-url>
cd ENSAM_Traduction- Install dependencies:
pip install -r requirements.txt- Run the application:
python main.py- Type or paste text into the Source Text area
- Select source language (or leave on "Auto-detect")
- Select target language
- Click ▶ Translate (or press
Ctrl+Enter)
- Drag & drop a
.txt,.docx, or.pdffile onto the drop zone - Alternatively, use File → Open File (
Ctrl+O) - Click ▶ Translate
- Export via File → Export as TXT/DOCX/PDF
Open the glossary editor via Tools → Glossary Editor (Ctrl+G):
- Add, edit, or delete technical terms
- Import/export glossaries as JSON
- Terms are automatically applied during translation
View cached translations via Tools → Translation Memory (Ctrl+M):
- Browse all cached translations
- View hit statistics
- Search and manage entries
After translation, check the 📊 Quality tab for:
- Overall quality score (A-F grade)
- Length ratio analysis
- Glossary term coverage
- Warnings for potential issues
| Shortcut | Action |
|---|---|
Ctrl+Enter |
Start translation |
Ctrl+O |
Open file |
Ctrl+G |
Open glossary editor |
Ctrl+M |
Open translation memory |
Ctrl+D |
View translation diff |
Ctrl+Q |
Quit |
| Component | Technology |
|---|---|
| Core | Python 3.10+ |
| GUI | PyQt6 |
| Translation | Groq API (llama-3.3-70b-versatile) |
| Language Detection | langdetect |
| Document Parsing | python-docx, PyMuPDF |
| PDF Generation | reportlab |
| Caching | SQLite3 |
The application follows a clean pipeline architecture:
Input → Parse → Clean → Detect Language → Glossary Pre-process
→ TM Cache Lookup → Groq API Translation
→ Glossary Post-process → Quality Evaluation → Output
All modules are loosely coupled and can be used independently.
MIT License — see LICENSE for details."# ENSAMTransLAB"