(left: Dict[str, float], right: Dict[str, float])
| 283 | |
| 284 | |
| 285 | def cosine(left: Dict[str, float], right: Dict[str, float]) -> float: |
| 286 | if not left or not right: |
| 287 | return 0.0 |
| 288 | if len(left) > len(right): |
| 289 | left, right = right, left |
| 290 | return sum(value * right.get(key, 0.0) for key, value in left.items()) |
| 291 | |
| 292 | |
| 293 | def scaled_similarity(left: Dict[str, float], right: Dict[str, float]) -> float: |
no test coverage detected