CV_Analyze / utils /scoring.py
Danial7's picture
Create utils/scoring.py
8616f6a verified
raw
history blame contribute delete
647 Bytes
from keybert import KeyBERT
import re
kw_model = KeyBERT()
def classify_cv(text) -> str:
technical_keywords = ['python', 'engineering', 'developer', 'AI', 'ML', 'software']
non_technical_keywords = ['sales', 'management', 'HR', 'marketing', 'finance']
tech_score = sum([text.lower().count(k) for k in technical_keywords])
nontech_score = sum([text.lower().count(k) for k in non_technical_keywords])
return "Technical" if tech_score >= nontech_score else "Non-Technical"
def get_skill_score(text) -> int:
keywords = kw_model.extract_keywords(text, top_n=10)
score = min(100, int(len(keywords) * 10))
return score