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

Method containment

src/licensedcode/spans.py:344–356  ·  view source on GitHub ↗

Return a containment coefficient as a float between 0 and 1. This is an indication of how much of the other span is contained in this span. - 1 means the other span is entirely contained in this span. - 0 means that the other span is not contained at all this

(self, other)

Source from the content-addressed store, hash-verified

342 return resemblance
343
344 def containment(self, other):
345 """
346 Return a containment coefficient as a float between 0 and 1. This is an
347 indication of how much of the other span is contained in this span.
348 - 1 means the other span is entirely contained in this span.
349 - 0 means that the other span is not contained at all this span.
350 """
351 if self._set.isdisjoint(other._set):
352 return 0
353 if self._set == other._set:
354 return 1
355 containment = self.overlap(other) / len(other)
356 return containment
357
358 def surround(self, other):
359 """

Callers

nothing calls this directly

Calls 1

overlapMethod · 0.95

Tested by

no test coverage detected