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

Function _extract_report_answer

agents/reading-agent/main.py:2059–2073  ·  view source on GitHub ↗
(report_content: str, question: str)

Source from the content-addressed store, hash-verified

2057
2058def _extract_report_answer(report_content: str, question: str) -> str:
2059 text = str(report_content or "")
2060 if not text.strip():
2061 return ""
2062 escaped = re.escape(question)
2063 pattern = re.compile(
2064 rf"(?:^|\n)(?:#+\s*)?Q\d+\s*[::]\s*{escaped}\s*\n+(.*?)(?=\n(?:#+\s*)?Q\d+\s*[::]|\n##\s+|$)",
2065 flags=re.IGNORECASE | re.DOTALL,
2066 )
2067 match = pattern.search(text)
2068 if not match:
2069 return ""
2070 answer = match.group(1).strip()
2071 answer = re.sub(r"\n{3,}", "\n\n", answer)
2072 return answer
2073
2074
2075def _remove_daily_note_entry(current: str, marker: str) -> Optional[str]:
2076 marker_index = current.find(marker)

Callers 1

_daily_note_entryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected