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

Function _canonicalize_topics

scripts/drift_engine.py:86–98  ·  view source on GitHub ↗
(values: List[Any])

Source from the content-addressed store, hash-verified

84
85def _canonicalize_topics(values: List[Any]) -> List[str]:
86 if direction_lexicon and hasattr(direction_lexicon, "canonicalize_direction_terms"):
87 try:
88 return direction_lexicon.canonicalize_direction_terms(values, keep_unknown=True)
89 except Exception:
90 pass
91
92 canonical_topics: List[str] = []
93 for value in values:
94 cleaned = str(value or "").strip().lower().replace("_", "-").replace(" ", "-")
95 if cleaned and cleaned not in canonical_topics:
96 canonical_topics.append(cleaned)
97 return canonical_topics
98
99
100def _direction_match_terms(direction: str) -> List[str]:
101 cleaned = str(direction or "").strip()

Callers 6

_candidate_shift_topicsFunction · 0.85
_downweight_topicsFunction · 0.85
_extract_anchor_signalFunction · 0.85
_compute_topic_stalenessFunction · 0.85
_advance_anchor_profileFunction · 0.85
_trigger_satisfiedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected