(
evidence: Dict[str, Any],
bucket: str,
*,
limit: int,
cues: Tuple[str, ...] = (),
)
| 3258 | |
| 3259 | def _collect_evidence_sentences( |
| 3260 | evidence: Dict[str, Any], |
| 3261 | bucket: str, |
| 3262 | *, |
| 3263 | limit: int, |
| 3264 | cues: Tuple[str, ...] = (), |
| 3265 | ) -> List[str]: |
| 3266 | matches = ((evidence or {}).get("matches") or {}).get(bucket) or [] |
| 3267 | collected: List[str] = [] |
| 3268 | for match in matches: |
| 3269 | text = _clean_pdf_evidence_text(match.get("text")) |
| 3270 | if not text: |
| 3271 | continue |
| 3272 | picked = _pick_sentences(text, limit=limit, cues=cues) |
| 3273 | if picked: |
| 3274 | collected.extend(picked) |
| 3275 | elif not _is_noisy_pdf_evidence_text(text): |
| 3276 | collected.append(_truncate_text(text, 180)) |
| 3277 | unique = _unique_preserve_order(collected) |
| 3278 | if len(unique) >= limit: |
| 3279 | return unique[:limit] |
| 3280 | return _unique_preserve_order(collected)[:limit] |
| 3281 | |
| 3282 | |
| 3283 | def _collect_evidence_sections(evidence: Dict[str, Any], bucket: str, *, limit: int = 3) -> List[str]: |
| 3284 | matches = ((evidence or {}).get("matches") or {}).get(bucket) or [] |
no test coverage detected