mutaibamohsin845 commited on
Commit
55c0eec
·
verified ·
1 Parent(s): 11171fc

Create model.py

Browse files
Files changed (1) hide show
  1. model.py +33 -0
model.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pdfplumber
2
+ import spacy
3
+ import re
4
+
5
+ # Load NLP Model
6
+ nlp = spacy.load("en_core_web_sm")
7
+
8
+ # Predefined ATS-friendly keywords
9
+ REQUIRED_SKILLS = {"Python", "Machine Learning", "NLP", "Deep Learning", "AI", "Data Science", "Cloud", "Hugging Face"}
10
+
11
+ def extract_text_from_pdf(pdf_path):
12
+ text = ""
13
+ with pdfplumber.open(pdf_path) as pdf:
14
+ for page in pdf.pages:
15
+ text += page.extract_text() + "\n"
16
+ return text.strip()
17
+
18
+ def analyze_resume(text):
19
+ doc = nlp(text)
20
+
21
+ # Extract skills and education
22
+ words = set([token.text for token in doc if token.is_alpha])
23
+ matched_skills = REQUIRED_SKILLS.intersection(words)
24
+ missing_skills = REQUIRED_SKILLS - matched_skills
25
+
26
+ # Basic ATS Check
27
+ ats_score = (len(matched_skills) / len(REQUIRED_SKILLS)) * 100
28
+
29
+ return {
30
+ "matched_skills": list(matched_skills),
31
+ "missing_skills": list(missing_skills),
32
+ "ats_score": round(ats_score, 2)
33
+ }