File size: 953 Bytes
55c0eec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pdfplumber
import spacy
import re

# Load NLP Model
nlp = spacy.load("en_core_web_sm")

# Predefined ATS-friendly keywords
REQUIRED_SKILLS = {"Python", "Machine Learning", "NLP", "Deep Learning", "AI", "Data Science", "Cloud", "Hugging Face"}

def extract_text_from_pdf(pdf_path):
    text = ""
    with pdfplumber.open(pdf_path) as pdf:
        for page in pdf.pages:
            text += page.extract_text() + "\n"
    return text.strip()

def analyze_resume(text):
    doc = nlp(text)

    # Extract skills and education
    words = set([token.text for token in doc if token.is_alpha])
    matched_skills = REQUIRED_SKILLS.intersection(words)
    missing_skills = REQUIRED_SKILLS - matched_skills

    # Basic ATS Check
    ats_score = (len(matched_skills) / len(REQUIRED_SKILLS)) * 100

    return {
        "matched_skills": list(matched_skills),
        "missing_skills": list(missing_skills),
        "ats_score": round(ats_score, 2)
    }