(left: Dict[str, float], right: Dict[str, float])
| 198 | |
| 199 | |
| 200 | def 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 | |
| 208 | def scaled_similarity(left: Dict[str, float], right: Dict[str, float]) -> float: |
no test coverage detected