-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresume_rewriter.py
More file actions
55 lines (42 loc) · 1.45 KB
/
Copy pathresume_rewriter.py
File metadata and controls
55 lines (42 loc) · 1.45 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# resume_rewriter.py
import re
ACTION_VERBS = [
"Developed", "Designed", "Implemented", "Built",
"Optimized", "Integrated", "Created", "Maintained"
]
def extract_keywords(text: str):
text = text.lower()
words = re.findall(r"[a-zA-Z+#.]+", text)
stopwords = {
"and","or","the","with","using","for","to","of","in","on","a","an"
}
return set(w for w in words if w not in stopwords and len(w) > 2)
def rewrite_resume(resume_text: str, resume_skills: str, job_description: str):
resume_kw = extract_keywords(resume_text)
job_kw = extract_keywords(job_description)
common_keywords = resume_kw.intersection(job_kw)
bullets = []
verb_index = 0
for skill in resume_skills.split(","):
skill = skill.strip().lower()
if not skill:
continue
related = [kw for kw in common_keywords if skill in kw or kw in skill]
if not related:
continue
verb = ACTION_VERBS[verb_index % len(ACTION_VERBS)]
verb_index += 1
bullet = (
f"{verb} backend components using {skill} "
f"aligned with job requirements"
)
bullets.append(bullet)
# fallback (resume empty nahi rehna chahiye)
if not bullets:
bullets.append(
"Worked on backend development tasks relevant to the job role"
)
return {
"rewritten_bullets": bullets,
"used_keywords": sorted(common_keywords)
}