(left: Dict[str, float], right: Dict[str, float])
| 312 | |
| 313 | |
| 314 | def 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 | |
| 322 | def scaled_similarity(left: Dict[str, float], right: Dict[str, float]) -> float: |
no test coverage detected