File size: 2,867 Bytes
96a2583
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# ============================================================
# skill_extractor.py
# This file automatically detects technical skills
# mentioned inside resume or job description text.
# ============================================================

# A dictionary of technical skills we want to detect
# You can add more skills to this list anytime!
TECH_SKILLS = [
    # Programming Languages
    'python', 'java', 'javascript', 'c++', 'c#', 'r', 'scala', 'kotlin',
    'swift', 'go', 'ruby', 'php', 'typescript',

    # Data Science & ML
    'machine learning', 'deep learning', 'nlp', 'natural language processing',
    'computer vision', 'neural network', 'tensorflow', 'keras', 'pytorch',
    'scikit-learn', 'xgboost', 'random forest', 'decision tree',

    # Data Tools
    'pandas', 'numpy', 'matplotlib', 'seaborn', 'plotly', 'tableau',
    'power bi', 'excel', 'sql', 'mysql', 'postgresql', 'mongodb',

    # Web & APIs
    'flask', 'django', 'fastapi', 'rest api', 'node.js', 'react',
    'html', 'css', 'bootstrap',

    # Cloud & DevOps
    'docker', 'kubernetes', 'aws', 'azure', 'gcp', 'git', 'github',
    'linux', 'ci/cd',

    # Other AI/Data
    'data analysis', 'feature engineering', 'model deployment',
    'recommendation system', 'cloud computing', 'spark', 'hadoop',
]


def extract_skills(text):
    """
    Looks through a resume or job description text
    and returns a list of matching technical skills found.
    """
    if not isinstance(text, str):
        return []  # return empty list if text is missing

    text_lower = text.lower()  # make lowercase for matching

    found_skills = []

    for skill in TECH_SKILLS:
        # Check if the skill word/phrase is in the text
        if skill in text_lower:
            found_skills.append(skill)

    return found_skills


def get_skill_overlap(resume_skills, job_skills):
    """
    Finds which skills are present in BOTH the resume AND the job.
    This tells us how well the candidate matches the job requirements.

    Example:
        resume_skills = ['python', 'sql', 'docker']
        job_skills    = ['python', 'flask', 'docker']
        overlap       = ['python', 'docker']
    """
    resume_set = set([s.lower() for s in resume_skills])
    job_set = set([s.lower() for s in job_skills])
    overlap = resume_set.intersection(job_set)
    return list(overlap)


def skill_match_percentage(resume_skills, job_skills):
    """
    Calculates what percentage of required job skills
    the candidate has in their resume.

    Returns a number between 0 and 1.
    1.0 = candidate has ALL required skills
    0.0 = candidate has NONE of the required skills
    """
    if not job_skills:
        return 0.0  # avoid divide by zero

    overlap = get_skill_overlap(resume_skills, job_skills)
    percentage = len(overlap) / len(job_skills)
    return round(percentage, 2)