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

Function cosine

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

Source from the content-addressed store, hash-verified

198
199
200def cosine(left: Dict[str, float], right: Dict[str, float]) -> float:
201 if not left or not right:
202 return 0.0
203 if len(left) > len(right):
204 left, right = right, left
205 return sum(value * right.get(key, 0.0) for key, value in left.items())
206
207
208def 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