Return the score for this detection as a rounded float between 0 and 100. This is an indication of the how much this detection covers the rules of the underlying match. This is computed as the sum of the underlying matches coverage weighted by the length of
(self)
| 371 | return sum(m.self.rule.length for m in self.matches) |
| 372 | |
| 373 | def coverage(self): |
| 374 | """ |
| 375 | Return the score for this detection as a rounded float between 0 and 100. |
| 376 | |
| 377 | This is an indication of the how much this detection covers the rules of |
| 378 | the underlying match. |
| 379 | |
| 380 | This is computed as the sum of the underlying matches coverage weighted |
| 381 | by the length of a match to the overall detection length. |
| 382 | """ |
| 383 | length = self.length |
| 384 | weighted_coverages = (m.coverage() * (m.len() / length) for m in self.matches) |
| 385 | return min([round(sum(weighted_coverages), 2), 100]) |
| 386 | |
| 387 | def relevance(self): |
| 388 | """ |
no test coverage detected