Spaces:
Sleeping
Sleeping
| # ============================================================ | |
| # 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) | |