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

Callers 2

Calls 3

_split_sentencesFunction · 0.85
_unique_preserve_orderFunction · 0.85
_truncate_textFunction · 0.85

Tested by

no test coverage detected