(
page_texts: list[dict[str, Any]],
sections: list[dict[str, Any]],
)
| 190 | |
| 191 | |
| 192 | def build_pages( |
| 193 | page_texts: list[dict[str, Any]], |
| 194 | sections: list[dict[str, Any]], |
| 195 | ) -> list[dict[str, Any]]: |
| 196 | pages: list[dict[str, Any]] = [] |
| 197 | for page in page_texts: |
| 198 | page_number = int(page["page"]) |
| 199 | text = str(page.get("text", "")) |
| 200 | pages.append( |
| 201 | { |
| 202 | "page": page_number, |
| 203 | "char_count": len(normalize_whitespace(text)), |
| 204 | "section_ids": section_ids_for_page(sections, page_number), |
| 205 | } |
| 206 | ) |
| 207 | return pages |
| 208 | |
| 209 | |
| 210 | def primary_section_for_page(sections: list[dict[str, Any]], page_number: int) -> str: |
no test coverage detected