Resolve broad user-facing topic names to a stable semantic family.
(topic_text: str)
| 466 | |
| 467 | |
| 468 | def resolve_semantic_topic_family(topic_text: str) -> Optional[str]: |
| 469 | """Resolve broad user-facing topic names to a stable semantic family.""" |
| 470 | target = normalize_topic_token(topic_text) |
| 471 | if not target: |
| 472 | return None |
| 473 | |
| 474 | for family_name, family in SEMANTIC_TOPIC_FAMILIES.items(): |
| 475 | alias_tokens = {normalize_topic_token(alias) for alias in family.get("aliases", set())} |
| 476 | if target in alias_tokens: |
| 477 | return family_name |
| 478 | return None |
| 479 | |
| 480 | |
| 481 | def derive_topic_key(topic: str) -> str: |
no test coverage detected