MCPcopy Create free account
hub / github.com/Open-Quant/openquant / flush_section

Function flush_section

scripts/afml_semantic_index.py:186–209  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

184 curr_end_page: int | None = None
185
186 def flush_section() -> None:
187 nonlocal curr_lines, curr_start_page, curr_end_page
188 text = normalize_text("\n".join(curr_lines))
189 if not text:
190 curr_lines = []
191 curr_start_page = None
192 curr_end_page = None
193 return
194
195 sec_idx = len(sections) + 1
196 sections.append(
197 {
198 "section_id": f"S{sec_idx:05d}",
199 "part": part_title,
200 "chapter": chapter_title,
201 "section": section_title,
202 "page_start": curr_start_page,
203 "page_end": curr_end_page,
204 "text": text,
205 }
206 )
207 curr_lines = []
208 curr_start_page = None
209 curr_end_page = None
210
211 for p in cleaned_pages:
212 page_num = int(p["page"])

Callers 1

build_sectionsFunction · 0.85

Calls 2

normalize_textFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected