INNER CODE UNIT · Python

consumed_patterns

LiuMengxuan04/shushu-internship-tool · skills/shushu-internship-tool/scripts/shushu_internship_tool/candidate_score.py:188

    consumed_patterns = [*EXPLICIT_PREFER_KEYS, *EXPLICIT_AVOID_KEYS]
    line_pattern = re.compile(
        rf"(?im)^\s*({'|'.join(re.escape(key) for key in consumed_patterns)})\s*[:=]\s*(.+)$"
    )
    for match in line_pattern.finditer(text):
        key = match.group(1).lower()
        raw_values = match.group(2).strip().strip("[]{}()")
        values = normalize_list(raw_values.replace('"', "").replace("'", ""))
        if key in EXPLICIT_AVOID_KEYS:
            avoid.update(canonicalize_tags(values))
        else:
            prefer.update(canonicalize_tags(values))
    return prefer, avoid


def parse_user_taste(taste_text: str | None) -> tuple[set[str], set[str]]:
    """Read structured user preference tags from JSON or key-value text.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…