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

Function _route_keyword_to_interest_direction

scripts/add_must_read.py:88–106  ·  view source on GitHub ↗
(profile, current_keywords, raw_value, canonical_direction)

Source from the content-addressed store, hash-verified

86
87def _route_keyword_to_interest_direction(profile, current_keywords, raw_value, canonical_direction):
88 current_keywords[:] = [
89 keyword for keyword in current_keywords
90 if not _keyword_resolves_to_direction(keyword, canonical_direction)
91 ]
92 core_directions = profile.get("core_directions")
93 if not isinstance(core_directions, dict):
94 core_directions = {}
95 topic_weights = profile.get("topic_weights")
96 if not isinstance(topic_weights, dict):
97 topic_weights = {}
98
99 previous_core = _coerce_float(core_directions.get(canonical_direction), 0.0)
100 previous_topic = _coerce_float(topic_weights.get(canonical_direction), 0.0)
101 core_directions[canonical_direction] = max(previous_core, SOFT_DIRECTION_WEIGHT)
102 topic_weights[canonical_direction] = max(previous_topic, SOFT_DIRECTION_WEIGHT)
103 profile["core_directions"] = core_directions
104 profile["topic_weights"] = topic_weights
105 return f"{raw_value} -> {canonical_direction}"
106
107
108def parse_input(user_input: str):
109 """Parse user input to extract operation type and entities"""

Callers 1

add_must_readFunction · 0.70

Calls 3

getMethod · 0.80
_coerce_floatFunction · 0.70

Tested by

no test coverage detected