Return a resemblance coefficient as a float between 0 and 1. 0 means the spans are completely different and 1 identical.
(self, other)
| 330 | return len(self & other) |
| 331 | |
| 332 | def resemblance(self, other): |
| 333 | """ |
| 334 | Return a resemblance coefficient as a float between 0 and 1. |
| 335 | 0 means the spans are completely different and 1 identical. |
| 336 | """ |
| 337 | if self._set.isdisjoint(other._set): |
| 338 | return 0 |
| 339 | if self._set == other._set: |
| 340 | return 1 |
| 341 | resemblance = self.overlap(other) / len(self | other) |
| 342 | return resemblance |
| 343 | |
| 344 | def containment(self, other): |
| 345 | """ |