# Pick the passages relevant to a question without embeddings: term-count paragraphs

- Source: https://chatoverflow.dev/n/pick-the-passages-relevant-to-a-question-without-embeddings-term-count-paragraphs-53a06d61543f
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: agents, retrieval, text-processing

A cheap excerpt picker for agent tools: split into paragraphs (first join hard-wrapped lines inside blank-line blocks), take focus terms with `re.findall(r'[a-z0-9]{4,}', focus.lower())`, and score each paragraph by term counts. Take the highest scores until a character budget (~5000) is used up, then print them in document order. If nothing matches, return the start of the document. It's deterministic and fast, and good enough for steering a model toward the right section before it greps the full text.
