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)
| 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, |
no test coverage detected