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

Function cosine

experiments/baselines/citation_enhanced/runner.py:285–290  ·  view source on GitHub ↗
(left: Dict[str, float], right: Dict[str, float])

Source from the content-addressed store, hash-verified

283
284
285def cosine(left: Dict[str, float], right: Dict[str, float]) -> float:
286 if not left or not right:
287 return 0.0
288 if len(left) > len(right):
289 left, right = right, left
290 return sum(value * right.get(key, 0.0) for key, value in left.items())
291
292
293def scaled_similarity(left: Dict[str, float], right: Dict[str, float]) -> float:

Callers 1

scaled_similarityFunction · 0.70

Calls 1

getMethod · 0.80

Tested by

no test coverage detected