Skip to content

mouradboutrid/ENSAMTransLAB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ENSAM Traduction — Technical Document Translator

A modular, production-ready translation tool for technical documents, powered exclusively by the Groq API with a modern PyQt6 dark-themed GUI.


✨ Features

  • 🔄 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

📁 Project Structure

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

🚀 Installation

Prerequisites

  • Python 3.10 or higher
  • A valid Groq API key

Steps

  1. Clone the repository:
git clone <repo-url>
cd ENSAM_Traduction
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the application:
python main.py

🎮 Usage

Text Translation

  1. Type or paste text into the Source Text area
  2. Select source language (or leave on "Auto-detect")
  3. Select target language
  4. Click ▶ Translate (or press Ctrl+Enter)

Document Translation

  1. Drag & drop a .txt, .docx, or .pdf file onto the drop zone
  2. Alternatively, use File → Open File (Ctrl+O)
  3. Click ▶ Translate
  4. Export via File → Export as TXT/DOCX/PDF

Glossary Management

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

Translation Memory

View cached translations via Tools → Translation Memory (Ctrl+M):

  • Browse all cached translations
  • View hit statistics
  • Search and manage entries

Quality Reports

After translation, check the 📊 Quality tab for:

  • Overall quality score (A-F grade)
  • Length ratio analysis
  • Glossary term coverage
  • Warnings for potential issues

⌨️ Keyboard Shortcuts

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

📦 Tech Stack

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

🏗️ Architecture

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.


📄 License

MIT License — see LICENSE for details."# ENSAMTransLAB"

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages