| --- |
| license: other |
| task_categories: |
| - image-to-text |
| tags: |
| - structured-image-understanding |
| - svg |
| - mermaid |
| - graphviz |
| - plantuml |
| - vega-lite |
| - diagram-to-code |
| pretty_name: StructCrawl Sample (image → structured text) |
| size_categories: |
| - 10K<n<100K |
| configs: |
| - config_name: svg |
| data_files: svg/*.parquet |
| - config_name: mermaid |
| data_files: mermaid/*.parquet |
| - config_name: dot |
| data_files: dot/*.parquet |
| - config_name: plantuml |
| data_files: plantuml/*.parquet |
| - config_name: vega |
| data_files: vega/*.parquet |
| --- |
| |
| # StructCrawl Sample — Structured Image Understanding |
|
|
| A **uniform random subsample** (~500 per format×stage×source cell) of a larger |
| web-crawled corpus for **structured image understanding**: converting a |
| rendered image of a diagram/chart into the editable structured-text code that |
| produces it. |
|
|
| This is a *sharing sample*, not the full dataset — it is stratified so every |
| length band and every source is represented for inspection. |
|
|
| ## Configs (one per code representation) |
|
|
| | Config | Rows | Description | |
| |--------|-----:|-------------| |
| | `svg` | ~21.7K | Diagrams/charts/schematics as SVG XML | |
| | `dot` | ~9.7K | Graphs as Graphviz DOT | |
| | `plantuml` | ~3.7K | UML/sequence diagrams as PlantUML | |
| | `vega` | ~3.5K | Charts as Vega-Lite JSON specs | |
| | `mermaid` | ~3.3K | Flowcharts/sequence/class/ER as Mermaid | |
|
|
| *(Exact per-config counts in `_manifest.json`.)* |
|
|
| ## Usage |
|
|
| ```python |
| from datasets import load_dataset |
| |
| ds = load_dataset("<your-username>/<repo-name>", "svg", split="train") |
| ex = ds[0] |
| ex["image"] # PIL.Image — the rendered diagram |
| ex["target_text"] # the SVG/Mermaid/DOT/PlantUML/Vega source to reproduce it |
| ex["stage"] # token-length band, e.g. "stage_0-2048" |
| ex["source"] # crawl origin, e.g. "commoncrawl_inline" |
| ex["token_count"] # target_text length in SFT tokenizer tokens |
| ``` |
|
|
| ## Fields |
|
|
| | Field | Type | Notes | |
| |-------|------|-------| |
| | `id` | string | unique sample id | |
| | `format` | string | svg \| mermaid \| dot \| plantuml \| vega | |
| | `source` | string | crawl origin (commoncrawl_inline, github_repos, github_search, thestack_*, web_linked, wikimedia, ...) | |
| | `stage` | string | token-length band (2048-token steps to 8192, 4096-steps to 32768, then `stage_32768_plus`) | |
| | `token_count` | int64 | `target_text` length (SFT tokenizer) | |
| | `image` | Image | rendered diagram (native dimensions, white background) | |
| | `target_text` | string | the structured-text code that renders to `image` | |
| | `provenance` | string | original url / repo / path when available | |
| |
| ## Sampling & processing |
| |
| - **Stratified:** up to 500 samples drawn uniformly at random (seed 42, |
| reservoir sampling) from every (format × stage × source) cell. |
| - **Washed:** samples whose code cannot be reproduced from the image alone |
| were removed upstream — base64-embedded rasters/fonts, external image/data |
| references, scripts, `<foreignObject>`, PlantUML `!include`/sprites. |
| - **Deduplicated:** exact content-level dedup (whitespace-normalized SHA-256), |
| filename-independent. Near-duplicate template families may still remain. |
| - **Render-validated:** every `target_text` was executed and produced a |
| non-blank image; the paired `image` is that render. |
| |
| ## Caveats |
| |
| - Licensing is mixed (public web, license-filtered source corpora, CC-BY |
| Commons) — intended for research; per-sample `provenance` retained for |
| attribution. |
| - SVG length is heavy-tailed; use `stage` / `token_count` to filter. |
| - This is a small representative slice of a ~860K-pair processed corpus. |
| |