MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / resolve_canonical_topic_key

Function resolve_canonical_topic_key

agents/master-coordinator/main.py:430–449  ·  view source on GitHub ↗

Map user-facing topic aliases onto a stable internal key when known.

(topic_text: str)

Source from the content-addressed store, hash-verified

428
429
430def resolve_canonical_topic_key(topic_text: str) -> Optional[str]:
431 """Map user-facing topic aliases onto a stable internal key when known."""
432 resolved = resolve_canonical_direction(topic_text, include_paper_terms=True)
433 if resolved:
434 return str(resolved.get("canonical_name"))
435
436 target = normalize_topic_token(topic_text)
437 if not target:
438 return None
439
440 for topic_key in DIRECTION_TRANSLATIONS.keys():
441 alias_tokens = {
442 normalize_topic_token(alias)
443 for alias in get_canonical_topic_aliases(topic_key)
444 if normalize_topic_token(alias)
445 }
446 if target in alias_tokens:
447 return topic_key
448
449 return None
450
451
452SEMANTIC_TOPIC_FAMILIES = {

Callers 1

derive_topic_keyFunction · 0.85

Calls 4

normalize_topic_tokenFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected