INNER CODE UNIT · Python
keyword_score
LiuMengxuan04/shushu-internship-tool · skills/shushu-internship-tool/scripts/shushu_internship_tool/candidate_score.py:138
def keyword_score(candidate: dict[str, Any]) -> tuple[int, list[str], str]:
agent_matches = normalize_list(candidate.get("matched_jd_terms"))
matched = list(dict.fromkeys(agent_matches))
explicit_score, source = _clamped_explicit_score(
candidate,
("jd_match_score", "jd_score", "jd_match_points"),
default=min(30, len(matched) * 5),
minimum=0,
maximum=30,
)
score = explicit_score
reason = f"JD match score from {source}" if source else f"{len(matched)} agent-supplied JD matches"
return score, matched, reason
def _tag_slug(value: Any) -> str:
text = str(value or "").strip().lower()
text = text.replace("_", "-").replace("+", "-")