""" 查询分类工具 当前仅保留枚举查询检测函数(被生产管线使用)。 原有的 QueryClassifier 类和 classify() 方法未被生产路径调用,已清理。 使用方式: from core.query_classifier import is_enumeration_query if is_enumeration_query(query): # 枚举类查询需要连续上下文 ... """ import re def is_enumeration_query(query: str) -> bool: """Return True for list/numbered-clause questions that need contiguous context.""" if not query: return False strong_markers = ("哪些", "有哪些", "列出", "严禁", "禁止", "不得", "包括", "要求") if any(marker in query for marker in strong_markers): return True return bool(re.search(r"(哪几|几类|几种|多少项|第[一二三四五六七八九十\d]+条)", query))