A lightweight, high-performance rule-based parsing engine designed to extract unstructured text from PDF resumes and convert it into schema-validated, ATS-friendly JSON.
Unlike rigid ML models that can hallucinate or overfit to specific resume templates, this engine utilizes deterministic heuristics—such as anchor-collision detection—to robustly handle multi-column layouts, varied regional formatting, and complex narrative structures.
Applicant Tracking Systems (ATS) rely on strict, predictable data models to index candidates for search. This project is built with downstream database integration and API consumption in mind:
- Pydantic Data Contracts: Guarantees strict schema validation. Output JSON is deeply nested and strictly typed, making it plug-and-play for FastAPI microservices or Document/Vector databases.
- Canonical Skill Normalization: Extracts varied technical phrases (e.g., "NodeJS", "node.js") and maps them to a canonical taxonomy for standardized database querying.
- Context-Aware Chunking: Employs a 2-pass algorithmic slicing strategy to prevent "section bleeding" (e.g., keeping Education metadata out of the Work Experience blocks).
- International PII Validation: Uses RFC-compliant regex for emails and ITU E.164 length verification to accurately extract international phone numbers without capturing false positives like date ranges.
The pipeline is decoupled into three primary stages to ensure maintainability and fault isolation:
- Ingestion (
pdf_extractor.py): Safely streams document binaries, preserving spatial layout and reading order using PyMuPDF. - Heuristic Parsers (
parse_*.py): A Facade pattern orchestrates isolated sub-parsers. If the Experience parser fails on a bizarre template, the Pipeline gracefully degrades rather than crashing, ensuring Email and Skills are still captured. - Serialization (
models.py): Domain entities are serialized into a heavily typed Pydantic model.
- Python 3.9+
pippackage manager
Clone the repository and install the required dependencies:
git clone https://github.com/YOUR_USERNAME/resume_parser.git
cd resume_parser
# It is recommended to use a virtual environment
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
pip install pymupdf pydanticRun the orchestration script to process a sample resume:
python main.pyNote: To test your own resume, place the .pdf file in the root directory and update the
input_resumepath variable inside main.py.
The engine outputs deterministic, strictly typed JSON ready for indexing:
{
"name": "Utkarsh Vaibhav",
"email": "utkarshvaibhav888@gmail.com",
"phone": "+91 9876543210",
"skills": [
"Docker",
"Git",
"Java",
"Machine Learning",
"Python",
"SQL"
],
"education": [
[
"Bachelor of Technology in Computer Science",
"2020 - 2024",
"# Vel Tech Rangarajan Dr. Sagunthala R&D Institute of Science and Technology"
]
],
"experience": [
[
"Software Engineer",
"Tech Corp | 2025 - Present",
"Developed automated resume parsing microservice using Pydantic and PyMuPDF.",
"Optimized heuristic algorithms reducing false positive extraction by 40%."
]
]
}Extracting multi-line work experience without explicit XML/HTML tags is notoriously difficult. This engine solves this using Anchor Collision Detection:
-
It scans a section line-by-line, looking for structural anchors (Dates, Job Titles, Company Names).
-
It filters out descriptive narrative lines (bullets or lines >10 words).
-
If an incoming line contains an anchor type that already exists in the current working block, it triggers a "collision," safely finalizing the previous job entry and beginning a new one.
-
FastAPI Wrapper: Expose the
process_resume()pipeline as a RESTful API endpoint. -
LLM Fallback Sub-parser: Integrate a lightweight local LLM to serve as a fallback parser for heavily obfuscated PDF layouts that fail the heuristic passes.
Utkarsh Vaibhav
Built with a focus on clean code, software architecture, and practical AI/ML data engineering.