(
page_texts: list[dict[str, Any]],
sections: list[dict[str, Any]],
)
| 213 | |
| 214 | |
| 215 | def caption_manifest( |
| 216 | page_texts: list[dict[str, Any]], |
| 217 | sections: list[dict[str, Any]], |
| 218 | ) -> dict[str, list[dict[str, Any]]]: |
| 219 | captions = {"figures": [], "tables": []} |
| 220 | for page in page_texts: |
| 221 | page_number = int(page["page"]) |
| 222 | section = primary_section_for_page(sections, page_number) |
| 223 | for key, kind in (("figures", "figure"), ("tables", "table")): |
| 224 | for item in extract_caption_lines(str(page.get("text", "")), kind): |
| 225 | captions[key].append( |
| 226 | { |
| 227 | **item, |
| 228 | "page": page_number, |
| 229 | "pages": [page_number], |
| 230 | "section_id": section, |
| 231 | } |
| 232 | ) |
| 233 | return captions |
| 234 | |
| 235 | |
| 236 | def math_index(sections: list[dict[str, Any]], *, max_items: int = 200) -> list[dict[str, Any]]: |
no test coverage detected