TalentSync

AI resume builder and ATS optimizer for job seekers. Tailored resumes, outreach, and interview prep from one profile.

NLP and skill extraction

The NLP and skill extraction subsystem powering resume analysis, structured data extraction, and predictive capabilities.

  • Document ingestion and preprocessing
  • Structured extraction via LLM prompts aligned to Pydantic schemas
  • JSON validation and normalization
  • Career path prediction and skill gap analysis using trained scikit-learn models
  • TF-IDF vectorization for text similarity
  • Model versioning, fallback strategies, and performance optimization

Repository layout#

The NLP subsystem spans three primary layers:

  • Routes: Expose endpoints for resume analysis and detailed extraction
  • Services: Orchestrate document processing, LLM calls, and schema validation
  • Prompts and Models: Define extraction schemas, prompts, and ML assets

Building blocks#

  • Document processing and fallback conversion for PDFs and office documents
  • Structured extraction using Pydantic-aligned prompts
  • JSON normalization and validation
  • Career path prediction and skill gap analysis using trained scikit-learn models
  • TF-IDF vectorization for text similarity
  • Schema-driven outputs for work experience, education, projects, skills, and more

How it fits together#

Flow from upload to structured output and predictions:

Document processing and fallback conversion#

  • Converts TXT/MD/PDF/DOCX to plain text/markdown
  • Uses PyMuPDF and pymupdf4llm for parsing
  • Falls back to Google GenAI multimodal conversion when PDF parsing fails and provider is Google/Gemini

Structured extraction with Pydantic schemas#

  • Detailed analysis prompt defines a rich schema covering skills, work experience, projects, education, certifications, achievements, languages, and metadata
  • JSON extractor prompt normalizes raw LLM outputs to a strict schema with validation rules
  • Both prompts are constructed as LangChain PromptTemplates and chained to the LLM

Key schema highlights:

  • ComprehensiveAnalysisData: Top-level container for all extracted sections
  • SkillProficiency: Skill name and inferred proficiency percentage
  • UIDetailedWorkExperienceEntry: Role, company_and_duration, bullet points
  • UIProjectEntry: Title, technologies_used, links, description
  • EducationEntry, UICertificationEntry, UIPositionOfResponsibilityEntry, UIPublicationEntry, UIAchievementEntry: Standardized entries
  • ResumeAnalysis: Legacy schema for normalized JSON extraction

Career path prediction and skill gap analysis#

  • Trained scikit-learn model (GradientBoostingClassifier) stored as best_model.pkl
  • Used to predict candidate roles and assist in skill gap analysis
  • Typical workflow:
  • Extract skills and normalize to canonical list
  • Vectorize with TF-IDF (tfidf.pkl)
  • Predict role/category and compute similarity scores
  • Generate recommendations for missing skills

TF-IDF vectorization and similarity#

  • TF-IDF vectors enable semantic similarity comparisons between candidate profiles and job descriptions
  • Used alongside trained classifier for detailed scoring and recommendations

Skill catalog and normalization#

  • Canonical skill list maintained centrally for consistent extraction and matching
  • Supports normalization and enrichment during analysis

API endpoints and workflows#

  • File-based analysis: Upload resume, preprocess, clean, validate, and return structured data
  • Detailed analysis: Full extraction pipeline with rich schema alignment
  • Text-based analysis: Accept preformatted text and run detailed extraction
  • Validation catches malformed inputs

Dependencies#

  • Routes depend on services for orchestration
  • Services depend on:
  • Document processor for text extraction
  • LLM chains for structured extraction
  • Pydantic schemas for validation
  • ML assets (best_model.pkl, tfidf.pkl) for predictions and similarity
  • Prompts define the contract between unstructured text and structured outputs

Performance#

  • Prefer plain text or markdown inputs to avoid heavy parsing overhead
  • Cache TF-IDF vectors and model predictions where feasible
  • Use streaming or chunked processing for long documents
  • Monitor LLM latency and apply retry/backoff strategies
  • Validate early to reduce downstream processing costs

Troubleshooting#

Common issues:

  • Unsupported file type: Ensure TXT/MD/PDF/DOCX; check extension handling
  • Empty or unreadable PDF: Trigger fallback conversion if provider supports it
  • LLM errors: Validate API keys and provider configuration; confirm the model is available
  • Schema validation failures: Review prompt instructions and refine extraction logic
  • Missing predictions: Verify model and vectorizer files are present and loadable

Operational checks:

  • Confirm GOOGLE_API_KEY and provider settings for fallback conversion
  • Validate Pydantic schema compliance for extracted data
  • Test TF-IDF and model loading independently