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

Function cosine

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

Source from the content-addressed store, hash-verified

229
230
231def cosine(left: Dict[str, float], right: Dict[str, float]) -> float:
232 if not left or not right:
233 return 0.0
234 if len(left) > len(right):
235 left, right = right, left
236 return sum(value * right.get(key, 0.0) for key, value in left.items())
237
238
239def 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