Datasets:
Download src/explicit_learning/renderers/text_manifest.py from sungguk/visual-answerability: direct link, hf CLI and curl.
- Browser
- Download file 931 Bytes
-
https://huggingface.co/datasets/sungguk/visual-answerability/resolve/main/src/explicit_learning/renderers/text_manifest.py
- Command line
-
hf download hf://datasets/sungguk/visual-answerability/src/explicit_learning/renderers/text_manifest.py
-
curl -L -o text_manifest.py https://huggingface.co/datasets/sungguk/visual-answerability/resolve/main/src/explicit_learning/renderers/text_manifest.py
931 Bytes
| """Text manifest — every rendered glyph linked to a semantic node (§9, P6). | |
| The P6 gate "every text glyph is linked to semantic node" is enforced here: a | |
| :class:`GlyphRecord` cannot be constructed without a ``node_id``, and | |
| :func:`link_verdict` flags any record missing one. Kind-specific renderers build | |
| records during their draw pass (a point label → the point id, a series label → | |
| the series id, a tick label → a synthetic axis node, an angle measure → the | |
| angle entity), and :func:`renderers.base.build_text_manifest` serializes them. | |
| """ | |
| from __future__ import annotations | |
| from collections.abc import Sequence | |
| from .base import GlyphRecord | |
| def link_verdict(glyphs: Sequence[GlyphRecord]) -> tuple[bool, list[int]]: | |
| """``(all_linked, bad_indices)`` — every glyph must carry a node id.""" | |
| bad = [i for i, g in enumerate(glyphs) if not g.node_id] | |
| return (not bad, bad) | |
| __all__ = ["link_verdict"] | |