INNER CODE UNIT · Python
parse_user_taste
LiuMengxuan04/shushu-internship-tool · skills/shushu-internship-tool/scripts/shushu_internship_tool/candidate_score.py:203
def parse_user_taste(taste_text: str | None) -> tuple[set[str], set[str]]:
"""Read structured user preference tags from JSON or key-value text.
The agent must do natural-language interpretation before calling this script.
This helper only slugs explicit prefer_tags / avoid_tags and never applies a
built-in domain vocabulary.
"""
if taste_text is None or not taste_text.strip():
return set(), set()
prefer, avoid = _parse_json_taste(taste_text)
explicit_prefer, explicit_avoid = _parse_explicit_tag_lines(taste_text)
prefer.update(explicit_prefer)
avoid.update(explicit_avoid)
prefer.difference_update(avoid)
return prefer, avoid