import pdfplumber import spacy # 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): """Extract text from a resume PDF""" 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): """Analyze the resume text and provide ATS recommendations""" doc = nlp(text) # Extract skills words = set([token.text for token in doc if token.is_alpha]) matched_skills = REQUIRED_SKILLS.intersection(words) missing_skills = REQUIRED_SKILLS - matched_skills # Calculate ATS Score 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) }