INNER CODE UNIT · Python
points
LiuMengxuan04/shushu-internship-tool · skills/shushu-internship-tool/scripts/shushu_internship_tool/candidate_score.py:252
points = min(USER_PREFERENCE_MAX_SCORE, len(matches) * 2) - min(4, len(mismatches) * 2)
notes: list[str] = []
if matches:
notes.append("匹配用户偏好:" + ", ".join(matches[:8]))
else:
notes.append("未命中显式用户偏好标签")
if mismatches:
notes.append("命中用户避雷项:" + ", ".join(mismatches[:8]))
notes.append(f"user_preference={points}/{USER_PREFERENCE_MAX_SCORE}")
return points, matches, mismatches, notes
def normalize_score(raw_score: float, max_raw_score: float) -> float:
if max_raw_score <= 0:
return 0.0
x = max(0.0, min(float(raw_score), float(max_raw_score)))
return round(x * 100 / float(max_raw_score), 2)