PDF CV → JSON structuré via LLM local
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.
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
# 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
pdfplumber — extraction texte natif PDFPyMuPDF — fallback extraction texte natifpdf2image + pytesseract — OCR fallback pour scansopenai — client API compatible (LM Studio / Ollama)pydantic — validation du JSON produitclick — interface CLIpyyaml — chargement schéma YAMLpython-dotenv — variables d'environnementpython-docx — export Word (optionnel)Le schéma JSON est totalement personnalisable. L'utilisateur le fournit via :
cv-tool cv.pdf --schema mon-schema.yamlcv-tool cv.pdf --schema mon-schema.jsoncv-tool cv.pdf --schema '{"personal": {...}}'Un schéma par défaut est fourni dans schemas/default.yaml comme point de départ.
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.
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