(left: Dict[str, float], right: Dict[str, float])
| 267 | |
| 268 | |
| 269 | def cosine(left: Dict[str, float], right: Dict[str, float]) -> float: |
| 270 | if not left or not right: |
| 271 | return 0.0 |
| 272 | if len(left) > len(right): |
| 273 | left, right = right, left |
| 274 | return sum(value * right.get(key, 0.0) for key, value in left.items()) |
| 275 | |
| 276 | |
| 277 | def scaled_similarity(left: Dict[str, float], right: Dict[str, float]) -> float: |
no test coverage detected