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

Function _seed_direction_entries

experiments/baselines/nl_profile/runner.py:233–248  ·  view source on GitHub ↗
(raw_value: Any)

Source from the content-addressed store, hash-verified

231
232
233def _seed_direction_entries(raw_value: Any) -> List[Tuple[str, float]]:
234 entries: List[Tuple[str, float]] = []
235 if isinstance(raw_value, dict):
236 for key, value in raw_value.items():
237 entries.append((str(key), safe_float(value, 0.6)))
238 elif isinstance(raw_value, list):
239 for item in raw_value:
240 if isinstance(item, dict):
241 key = str(item.get("canonical_name") or item.get("bootstrap_phrase") or "").strip()
242 weight = safe_float(item.get("weight"), 0.6)
243 else:
244 key = str(item or "").strip()
245 weight = 0.6
246 if key:
247 entries.append((key, weight))
248 return entries
249
250
251def _direction_terms(direction: Any) -> List[str]:

Callers 1

Calls 2

getMethod · 0.80
safe_floatFunction · 0.70

Tested by

no test coverage detected