MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / resemblance

Method resemblance

src/licensedcode/spans.py:332–342  ·  view source on GitHub ↗

Return a resemblance coefficient as a float between 0 and 1. 0 means the spans are completely different and 1 identical.

(self, other)

Source from the content-addressed store, hash-verified

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 """

Callers

nothing calls this directly

Calls 1

overlapMethod · 0.95

Tested by

no test coverage detected