(left: Dict[str, float], right: Dict[str, float])
| 229 | |
| 230 | |
| 231 | def cosine(left: Dict[str, float], right: Dict[str, float]) -> float: |
| 232 | if not left or not right: |
| 233 | return 0.0 |
| 234 | if len(left) > len(right): |
| 235 | left, right = right, left |
| 236 | return sum(value * right.get(key, 0.0) for key, value in left.items()) |
| 237 | |
| 238 | |
| 239 | def scaled_similarity(left: Dict[str, float], right: Dict[str, float]) -> float: |
no test coverage detected