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

Function finalize_section

scripts/extract_source_text.py:123–131  ·  view source on GitHub ↗
(record: dict[str, Any])

Source from the content-addressed store, hash-verified

121
122
123def finalize_section(record: dict[str, Any]) -> dict[str, Any] | None:
124 lines = [line for line in record.pop("_lines", []) if normalize_whitespace(str(line))]
125 text = "\n".join(lines).strip()
126 if not text:
127 return None
128 record["text"] = text
129 record["char_count"] = len(text)
130 record["text_hash_sha256"] = text_hash(text)
131 return record
132
133
134def extract_page_texts(pdf_path: Path, max_pages: int | None) -> list[dict[str, Any]]:

Callers 1

extract_raw_sectionsFunction · 0.85

Calls 2

normalize_whitespaceFunction · 0.90
text_hashFunction · 0.85

Tested by

no test coverage detected