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

Function _select_hidden_anchor_from_trigger

scripts/drift_engine.py:295–312  ·  view source on GitHub ↗
(
    profile: Dict[str, Any],
    selected_papers: Optional[List[Dict]],
)

Source from the content-addressed store, hash-verified

293
294def _select_hidden_anchor_from_trigger(
295 profile: Dict[str, Any],
296 selected_papers: Optional[List[Dict]],
297) -> Optional[str]:
298 shift_topics = _candidate_shift_topics(profile)
299 if not shift_topics:
300 return None
301
302 if selected_papers:
303 topic_hits = {
304 topic: _keyword_hit_count(selected_papers, _direction_match_terms(topic))
305 for topic in shift_topics
306 }
307 ranked = sorted(topic_hits.items(), key=lambda item: (-item[1], item[0]))
308 if ranked and ranked[0][1] > 0:
309 return ranked[0][0]
310
311 return shift_topics[0]
312
313
314def _activate_anchor_from_checkfile(
315 profile: Dict[str, Any],

Callers 1

Calls 3

_candidate_shift_topicsFunction · 0.85
_keyword_hit_countFunction · 0.85
_direction_match_termsFunction · 0.70

Tested by

no test coverage detected