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

Method score

src/licensedcode/detection.py:398–409  ·  view source on GitHub ↗

Return the score for this detection as a rounded float between 0 and 100. The score is an indication of the confidence of the detection. This is computed as the sum of the underlying matches score weighted by the length of a match to the overall detection length.

(self)

Source from the content-addressed store, hash-verified

396 return compute_relevance(self.rules_length())
397
398 def score(self):
399 """
400 Return the score for this detection as a rounded float between 0 and 100.
401
402 The score is an indication of the confidence of the detection.
403
404 This is computed as the sum of the underlying matches score weighted
405 by the length of a match to the overall detection length.
406 """
407 length = self.length
408 weighted_scores = (m.score() * (m.len() / length) for m in self.matches)
409 return min([round(sum(weighted_scores), 2), 100])
410
411 def append(
412 self,

Callers 2

_identifierMethod · 0.45

Calls 2

roundFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected