Projet en cours

cv-tool v0.1.0

PDF CV → JSON structuré via LLM local

Présentation

Un outil CLI Python qui transforme n'importe quel CV en PDF (scanné ou natif) en données JSON structurées, en utilisant un LLM local via LM Studio. Aucune clé API cloud nécessaire.

État d'avancement

Architecture

CV.pdf
  │
  ├─ PDF natif ──► pdfplumber ──► texte brut
  └─ PDF scanné ──► pdf2image + pytesseract ──► texte brut
                        │
                        ▼
                 texte nettoyé
                        │
                        ▼
         ┌─────────────────────────────┐
         │  Schéma JSON utilisateur    │
         │  + LLM local (LM Studio)    │
         └─────────────────────────────┘
                        │
                        ▼
                  JSON structuré
                        │
              ┌─────────┼─────────┐
              ▼         ▼         ▼
          stdout      fichier   (bonus)
                        docx

CLI — Exemples d'utilisation

# JSON avec schéma par défaut
cv-tool cv.pdf

# JSON avec schéma personnalisé
cv-tool cv.pdf --schema mon-schema.yaml

# Texte brut uniquement
cv-tool cv.pdf --extract

# Export Word (bonus)
cv-tool cv.pdf --format docx

# Sauvegarde dans un fichier
cv-tool cv.pdf -o output.json

# Verbose
cv-tool cv.pdf -v

Stack technique

📦 Dépendances principales

  • pdfplumber — extraction texte natif PDF
  • PyMuPDF — fallback extraction texte natif
  • pdf2image + pytesseract — OCR fallback pour scans
  • openai — client API compatible (LM Studio / Ollama)
  • pydantic — validation du JSON produit
  • click — interface CLI
  • pyyaml — chargement schéma YAML
  • python-dotenv — variables d'environnement
  • python-docx — export Word (optionnel)

→ Voir les détails des choix techniques

Schéma JSON — Feature principale

Le schéma JSON est totalement personnalisable. L'utilisateur le fournit via :

Un schéma par défaut est fourni dans schemas/default.yaml comme point de départ.

Configuration

Créer un fichier .env à la racine du projet :

LM_STUDIO_URL=http://localhost:1234/v1
LM_STUDIO_API_KEY=your-key-here

LM Studio expose une API compatible OpenAI. Chargez n'importe quel modèle (Llama, Mistral, Phi...) dans LM Studio et cv-tool l'utilisera automatiquement.

Structure du projet

cv-tool/
├── README.md
├── pyproject.toml
├── .env.example
├── cv_tool/
│   ├── __init__.py
│   ├── cli.py              ← interface CLI (click)
│   ├── extractor.py        ← PDF extraction + OCR
│   ├── llm.py              ← structuration LLM local
│   ├── schema.py           ← chargement schéma JSON
│   └── template.py         ← export docx (bonus)
├── schemas/
│   └── default.yaml        ← schéma par défaut
└── config/
    └── default.yaml        ← config par défaut