MCPcopy Create free account
hub / github.com/917Dhj/DeepPaperNote / math_index

Function math_index

scripts/extract_source_text.py:236–253  ·  view source on GitHub ↗
(sections: list[dict[str, Any]], *, max_items: int = 200)

Source from the content-addressed store, hash-verified

234
235
236def math_index(sections: list[dict[str, Any]], *, max_items: int = 200) -> list[dict[str, Any]]:
237 items: list[dict[str, Any]] = []
238 for section in sections:
239 for line in str(section.get("text", "")).splitlines():
240 cleaned = normalize_whitespace(line)
241 if not cleaned or len(cleaned) > 240 or not MATH_SIGNAL_RE.search(cleaned):
242 continue
243 items.append(
244 {
245 "text": cleaned,
246 "section_id": section.get("section_id", ""),
247 "page_start": section.get("page_start"),
248 "page_end": section.get("page_end"),
249 }
250 )
251 if len(items) >= max_items:
252 return items
253 return items
254
255
256def write_jsonl(records: list[dict[str, Any]], output_path: str) -> None:

Callers 1

build_manifestFunction · 0.85

Calls 1

normalize_whitespaceFunction · 0.90

Tested by

no test coverage detected