INNER CODE UNIT · Python
matches
LiuMengxuan04/shushu-internship-tool · skills/shushu-internship-tool/scripts/shushu_internship_tool/candidate_score.py:249
matches = _ordered_intersection(sorted(positive_tags - user_avoid_tags), prefer_tags)
mismatches = _ordered_intersection(sorted(project_avoid_tags), user_avoid_tags)
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: