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

Function _pick_sentences

agents/reading-agent/main.py:3030–3046  ·  view source on GitHub ↗
(text: str, *, limit: int, cues: Tuple[str, ...] = ())

Source from the content-addressed store, hash-verified

3028
3029def _pick_sentences(text: str, *, limit: int, cues: Tuple[str, ...] = ()) -> List[str]:
3030 sentences = _split_sentences(text)
3031 if not sentences:
3032 return []
3033
3034 ranked: List[str] = []
3035 if cues:
3036 lowered_sentences = [(sentence, sentence.lower()) for sentence in sentences]
3037 for sentence, lowered in lowered_sentences:
3038 if any(cue in lowered for cue in cues):
3039 ranked.append(sentence)
3040
3041 if len(ranked) < limit:
3042 ranked.extend(sentences)
3043
3044 unique_ranked = _unique_preserve_order(ranked)
3045 return [_truncate_text(sentence, 180) for sentence in unique_ranked[:limit]]
3046
3047
3048def _format_pdf_section_label(section: str) -> str:
3049 normalized = _clean_text(section).replace("_", " ").replace("-", " ")

Callers 2

Calls 3

_split_sentencesFunction · 0.85
_unique_preserve_orderFunction · 0.85
_truncate_textFunction · 0.85

Tested by

no test coverage detected