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

Function cosine

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

Source from the content-addressed store, hash-verified

312
313
314def cosine(left: Dict[str, float], right: Dict[str, float]) -> float:
315 if not left or not right:
316 return 0.0
317 if len(left) > len(right):
318 left, right = right, left
319 return sum(value * right.get(key, 0.0) for key, value in left.items())
320
321
322def 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