MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _collect_evidence_sentences

Function _collect_evidence_sentences

agents/reading-agent/main.py:3260–3281  ·  view source on GitHub ↗
(
    evidence: Dict[str, Any],
    bucket: str,
    *,
    limit: int,
    cues: Tuple[str, ...] = (),
)

Source from the content-addressed store, hash-verified

3258
3259def _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
3283def _collect_evidence_sections(evidence: Dict[str, Any], bucket: str, *, limit: int = 3) -> List[str]:
3284 matches = ((evidence or {}).get("matches") or {}).get(bucket) or []

Callers 1

Calls 6

_clean_pdf_evidence_textFunction · 0.85
_pick_sentencesFunction · 0.85
_truncate_textFunction · 0.85
_unique_preserve_orderFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected