(text: str, directions: Sequence[str])
| 345 | |
| 346 | |
| 347 | def aspect_coverage_score(text: str, directions: Sequence[str]) -> float: |
| 348 | if not directions: |
| 349 | return 0.0 |
| 350 | normalized_text = normalize_phrase_text(text) |
| 351 | covered = 0 |
| 352 | for direction in directions: |
| 353 | direction_terms = _direction_terms(direction) |
| 354 | if any(contains_phrase(normalized_text, term) for term in direction_terms): |
| 355 | covered += 1 |
| 356 | return clamp(covered / min(len(directions), 3)) |
| 357 | |
| 358 | |
| 359 | def label_for_score(score: float) -> str: |
no test coverage detected