Battam's picture
portal: data page of repository commit 651a2e860efe
ddbb8f3 verified
Raw History Blame Contribute Delete
105 kB
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> <title>Training Data Foundation</title> <meta name="description" content="Every source of the Training Data Foundation's public index of real public data for pre-training, mid-training and post-training, sorted by recognized standards, with the one command that fetches what you select."> <link rel="icon" href="data:,"> <link rel="alternate" type="text/plain" href="llms.txt" title="For agents"> <meta name="color-scheme" content="light dark"> <link rel="preload" href="locales/en.json" as="fetch" crossorigin> <link rel="preload" href="locales/zh.json" as="fetch" crossorigin> <!-- the data page: a story told by scrolling over one picture of the sources, then the explorer and the command; its data files are written at each deploy (03_data_line/steps/portal.py): sources.json from the index commit it shows (sources_screen), and terms.json, the terms and stage rules of meta/vocabulary.json, from catalog/terms.yaml and catalog/stages.yaml (vocabulary_files), whose glossary terms the notes show; each stage's rules and every term are in the user manual, a page of its own, manual.html; the page's words are read from locales/en.json and locales/zh.json through i18n.js --> <style> /* layout: a story told by scrolling, then the tools. The page opens on a dark stage that stays in place while the reader scrolls: one picture of glowing points in three dimensions, a cluster a source, which regroups at every step of the text beside it (the sources, their subjects, their resource types, their training use, label coverage, how a unit reaches a training stage). After the story, on paper: the explorer (charts and a table that filter each other), how to get the data, and the notes folded away. The paper, the display face and the accent are the reference style's; the stage is dark in both themes, so its colors are fixed. */ :root { --bg: #f6f4ef; --panel: #fffdf9; --soft: #f0ede5; --ink: #1b1915; --ink2: #4c4840; --muted: #6b655a; --line: #e3ddd1; --line2: #cfc7b7; --accent: #24414f; --accent2: #3d6a7d; --on-accent: #ffffff; --tint: #e6edef; --bar: #3d6a7d; --bar-off: #d9d3c6; --bar-hot: #24414f; --hot: #c8702a; --shadow: 0 1px 2px rgba(27, 25, 21, .05), 0 8px 28px rgba(27, 25, 21, .06); --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif; --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif; --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace; color-scheme: light; } @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #121110; --panel: #1b1a18; --soft: #24221f; --ink: #f0ede6; --ink2: #c9c3b6; --muted: #9a9488; --line: #2f2c28; --line2: #403c36; --accent: #a8c7d4; --accent2: #7fa9ba; --on-accent: #10181c; --tint: #1f2a2e; --bar: #7fa9ba; --bar-off: #3a3631; --bar-hot: #d3e8f0; --hot: #f0a45c; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25); color-scheme: dark; } } :root[data-theme="dark"] { --bg: #121110; --panel: #1b1a18; --soft: #24221f; --ink: #f0ede6; --ink2: #c9c3b6; --muted: #9a9488; --line: #2f2c28; --line2: #403c36; --accent: #a8c7d4; --accent2: #7fa9ba; --on-accent: #10181c; --tint: #1f2a2e; --bar: #7fa9ba; --bar-off: #3a3631; --bar-hot: #d3e8f0; --hot: #f0a45c; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25); color-scheme: dark; } * { box-sizing: border-box; } [hidden] { display: none !important; } html { scroll-behavior: smooth; } body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.62 var(--sans); -webkit-font-smoothing: antialiased; } a { color: var(--accent2); } button, input { font: inherit; color: inherit; } button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; border-radius: 6px; } .wrap { max-width: 1200px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); } h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; text-wrap: balance; margin: 0; } /* the bar on top: on the stage's dark, as the page opens there */ .top { position: absolute; left: 0; right: 0; top: 0; z-index: 3; color: #e8eef1; } .top .wrap { display: flex; align-items: center; gap: 8px 26px; min-height: 58px; flex-wrap: wrap; padding-block: 8px; max-width: none; padding-inline: max(16px, 5vw); } .brand { display: flex; align-items: baseline; gap: 10px; color: inherit; text-decoration: none; white-space: nowrap; } .brand b { font: 400 20px/1 var(--serif); } .brand span { font-size: 12.5px; color: #9fb6c1; letter-spacing: .1em; text-transform: uppercase; } .links { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-right: auto; } .links a { color: inherit; text-decoration: none; font-size: 14.5px; opacity: .82; } .links a:hover { opacity: 1; text-decoration: underline; } .lang { display: flex; border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; overflow: hidden; } .lang button { border: 0; background: none; padding: 3px 12px; font-size: 13px; color: #b9c9d1; cursor: pointer; } .lang button[aria-pressed="true"] { background: #e8eef1; color: #0b1419; } /* the story: the stage stays, the steps scroll over it */ .story { position: relative; background: #0b1419; color: #e8eef1; } .stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: radial-gradient(120% 90% at 68% 46%, #12242d 0%, #0b1419 62%); } .gl, .labels { position: absolute; inset: 0; } .gl canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; } .labels { pointer-events: none; overflow: hidden; } .tag { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; line-height: 1.3; color: #eef3f5; white-space: nowrap; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); opacity: 0; } .tag i { flex: none; width: 9px; height: 9px; border-radius: 50%; } .tag small { font-size: 12.5px; font-weight: 400; color: #b9c9d1; font-variant-numeric: tabular-nums; } .wire { position: absolute; left: 0; top: 0; height: 1px; background: rgba(190, 208, 216, .6); transform-origin: 0 0; opacity: 0; } @keyframes come { from { opacity: 0; } to { opacity: 1; } } /* where the reader is in the story: a dot a step, at the right edge; a click goes there */ .rail { position: absolute; right: max(8px, 1.4vw); top: 50%; z-index: 2; display: grid; gap: 2px; transform: translateY(-50%); } .rail button { position: relative; width: 22px; height: 22px; border: 0; padding: 0; background: none; cursor: pointer; } .rail button::before { content: ''; position: absolute; left: 8px; top: 8px; width: 6px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .32); transition: top .3s, height .3s, background .3s; } .rail button:hover::before, .rail button:focus-visible::before { background: rgba(255, 255, 255, .75); } .rail button:focus-visible { outline: 1.5px solid #8fb6c6; outline-offset: -3px; border-radius: 6px; } .rail button[aria-current='step']::before { top: 3px; height: 16px; background: #f4f7f8; } .rail button span { position: absolute; right: 26px; top: 50%; transform: translateY(-50%); padding: 2px 8px; border-radius: 6px; background: rgba(12, 23, 29, .92); color: #e8eef1; font-size: 12.5px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .2s; } .rail button:hover span, .rail button:focus-visible span { opacity: 1; } .tip { position: absolute; left: 0; top: 0; z-index: 3; max-width: 300px; padding: 8px 11px; border-radius: 9px; background: rgba(244, 247, 248, .97); color: #14191d; font-size: 13px; line-height: 1.45; pointer-events: none; box-shadow: 0 6px 22px rgba(0, 0, 0, .4); } .tip b { display: block; font-size: 14px; } .tip span { display: block; color: #3f4a53; } /* the source a click picked: a ring on its cluster, and a card that says what it is */ .halo { position: absolute; left: 0; top: 0; width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 1.5px solid #f4f7f8; border-radius: 50%; box-shadow: 0 0 14px rgba(244, 247, 248, .55); pointer-events: none; } .src-card { position: fixed; right: max(16px, 5vw); bottom: 46px; z-index: 3; pointer-events: auto; width: min(340px, calc(100% - 32px)); padding: 14px 16px 12px; border-radius: 14px; background: rgba(12, 23, 29, .96); border: 1px solid rgba(255, 255, 255, .16); font-size: 13.5px; line-height: 1.5; color: #c3d0d6; animation: come .35s both; } .src-card b { display: block; padding-right: 24px; font-size: 15px; color: #f4f7f8; } .src-card p { margin: 4px 0 8px; overflow-wrap: anywhere; } .src-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 1px 12px; margin: 0 0 8px; } .src-card dt { color: #9fb6c1; } .src-card dd { margin: 0; text-align: right; color: #e8eef1; font-variant-numeric: tabular-nums; } .src-card .link { color: #a8c7d4; } .src-card .shut { position: absolute; right: 8px; top: 6px; border: 0; padding: 4px 7px; background: none; color: #b9c9d1; font-size: 18px; line-height: 1; cursor: pointer; } .stage-note { position: absolute; right: max(16px, 5vw); bottom: 14px; margin: 0; max-width: 32em; font-size: 12.5px; color: #8fa3ad; text-align: right; } .steps { position: relative; z-index: 1; margin-top: -100vh; margin-top: -100svh; pointer-events: none; } .step { min-height: 100vh; min-height: 100svh; display: flex; align-items: center; padding: 76px max(16px, 5vw) 48px; } .say { pointer-events: auto; width: min(430px, 100%); padding: 20px 22px 22px; border-radius: 16px; background: rgba(12, 23, 29, .9); border: 1px solid rgba(255, 255, 255, .12); } .step.first .say { width: min(600px, 39vw); padding: 0; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; } .kicker { margin: 0 0 8px; font-size: 12.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #8fb6c6; } .story h1 { font-size: clamp(42px, 6.4vw, 78px); line-height: 1.04; color: #f6f9fa; } .lede { margin: 16px 0 0; max-width: 32em; font-size: 18px; line-height: 1.55; color: #c9d5da; text-wrap: pretty; } .claim { margin: 0; font: 400 clamp(22px, 2.3vw, 27px)/1.28 var(--serif); color: #f4f7f8; text-wrap: balance; } .txt { margin: 12px 0 0; font-size: 14.5px; line-height: 1.6; color: #c3d0d6; } .tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 26px 0 0; border-block: 1px solid rgba(255, 255, 255, .16); } .tiles div { padding: 14px 14px 13px 0; } .tiles div + div { padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, .16); } .tiles dt { font-size: 13px; color: #9fb6c1; } .tiles dd { margin: 2px 0 0; } .tiles b { display: block; font: 400 clamp(24px, 2.8vw, 34px)/1.1 var(--serif); font-variant-numeric: tabular-nums; color: #f6f9fa; } .tiles small { display: block; margin-top: 2px; font-size: 12.5px; color: #9fb6c1; } .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 22px; } .btn { display: inline-block; border-radius: 999px; padding: 9px 20px; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid #e8eef1; } .btn.primary { background: #e8eef1; color: #0b1419; } .btn.ghost { background: none; color: #e8eef1; } .hint { margin: 0 0 0 6px; font-size: 13.5px; color: #9fb6c1; } .hint::after { content: " ↓"; display: inline-block; animation: nod 1.8s ease-in-out infinite; } @keyframes nod { 50% { transform: translateY(4px); } } /* the small figures inside a step: parts of a whole as one bar, and rows with a measure each */ .split { display: flex; gap: 2px; height: 12px; margin-top: 16px; border-radius: 6px; overflow: hidden; } .split i { display: block; height: 100%; min-width: 3px; flex: 0 0 0; transition: flex-basis 1.1s cubic-bezier(.2, .7, .2, 1); } .step.on .split i { flex-basis: var(--w); } .rows { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 13.5px; } .rows li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 3px 8px; align-items: center; } .rows i { width: 10px; height: 10px; border-radius: 50%; } .rows span { color: #e8eef1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .rows span.wrapit { white-space: normal; } .rows b { font-weight: 400; color: #b9c9d1; font-variant-numeric: tabular-nums; white-space: nowrap; } .rows .trk { grid-column: 2 / -1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; } .rows .trk u { display: block; width: 0; height: 100%; border-radius: 2px; background: #8fb6c6; transition: width 1.1s cubic-bezier(.2, .7, .2, 1); } .step.on .rows .trk u { width: var(--w); } /* a row that answers the pointer: its part of the picture stays lit, the rest goes dim; a click holds it */ .rows li.can { margin: -3px -8px; padding: 3px 8px; border-radius: 7px; cursor: pointer; transition: background .2s, opacity .2s; } .rows li.can.hot, .rows li.can:focus-visible { background: rgba(255, 255, 255, .07); outline: none; } .rows li.can:focus-visible { box-shadow: 0 0 0 1.5px #8fb6c6; } .rows.held li:not(.pin) { opacity: .5; } .rows li.pin { background: rgba(255, 255, 255, .11); } /* the paper below the story */ section.paper { padding-top: 64px; scroll-margin-top: 8px; } .paper h2 { font-size: clamp(26px, 3vw, 34px); line-height: 1.18; } .sub { margin: 8px 0 0; max-width: 46em; color: var(--ink2); text-wrap: pretty; } .js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s, transform .7s; } .js .reveal.in { opacity: 1; transform: none; } .frame { margin-top: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); } .ex-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 16px 0; } .seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--soft); } .seg button { border: 0; border-radius: 7px; padding: 4px 13px; background: none; color: var(--muted); font-size: 14px; cursor: pointer; } .seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 25, 29, .14); } .ex-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14.5px; color: var(--ink2); } .ex-meta b { color: var(--ink); font-variant-numeric: tabular-nums; } .chip { border: 1px solid var(--line2); border-radius: 999px; padding: 2px 10px; background: var(--tint); font-size: 13.5px; cursor: pointer; } .link { border: 0; background: none; padding: 0; color: var(--accent2); font-size: 13.5px; text-decoration: underline; cursor: pointer; } .ex-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 0; margin-top: 12px; border-top: 1px solid var(--line); } .charts { padding: 14px 16px 6px; min-width: 0; } .charts-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; color: var(--muted); } .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; margin-top: 10px; } .chart h3 { margin: 0 0 4px; font: 600 14.5px/1.4 var(--sans); } .chart h3 small { margin-left: 8px; font-weight: 400; font-size: 13px; color: var(--muted); } .chart figure, .chart svg { margin: 0; max-width: 100%; } .charts-note { margin: 10px 0 4px; font-size: 13px; color: var(--muted); } .side { border-left: 1px solid var(--line); padding: 14px 14px 10px; min-width: 0; background: var(--soft); border-radius: 0 0 16px 0; } .side h3 { margin: 0 0 8px; font: 600 12.5px/1.4 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); } .search { width: 100%; padding: 7px 10px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel); font-size: 14.5px; } .picked { margin-top: 10px; padding: 11px 12px; border: 1px solid var(--line2); border-left: 3px solid var(--hot); border-radius: 8px; background: var(--panel); font-size: 13.5px; line-height: 1.5; } .picked b { display: block; font-size: 15px; } .picked p { margin: 4px 0 6px; color: var(--ink2); overflow-wrap: anywhere; } .picked dl { display: grid; grid-template-columns: max-content 1fr; gap: 1px 12px; margin: 0; } .picked dt { color: var(--muted); } .picked dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; } .list { margin: 10px 0 0; padding: 0; list-style: none; max-height: 430px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); } .list button { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 6px 10px; background: none; font-size: 13.5px; text-align: left; cursor: pointer; } .list li:last-child button { border-bottom: 0; } .list button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .list button b { flex: none; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; } .list button:hover { background: var(--tint); } .list button[aria-pressed="true"] { background: var(--tint); font-weight: 600; box-shadow: inset 3px 0 0 var(--hot); } .table-view { margin-top: 12px; border-top: 1px solid var(--line); padding: 14px 16px 12px; } .table-view .search { max-width: 360px; } .tablewrap { margin-top: 10px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); } table { width: 100%; border-collapse: collapse; font-size: 14px; } th, td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); } tbody tr:last-child td { border-bottom: 0; } thead th { background: var(--soft); font-size: 13px; font-weight: 600; color: var(--ink2); white-space: nowrap; } thead button { border: 0; background: none; padding: 0; font-weight: 600; cursor: pointer; } th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; } td.src { min-width: 280px; max-width: 520px; } td.src b { display: block; font-size: 14.5px; } td.src span { display: block; color: var(--ink2); font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; } td small { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; } #explore tbody tr { cursor: pointer; } #explore tbody tr:hover { background: var(--soft); } #explore tbody tr[aria-selected="true"] { background: var(--tint); box-shadow: inset 3px 0 0 var(--hot); } #explore th.pick, #explore td.pick { width: 30px; padding-right: 0; } #explore .pick input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent2); cursor: pointer; } .pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 10px; font-size: 14px; color: var(--muted); } .pager button { border: 1px solid var(--line2); border-radius: 8px; padding: 4px 12px; background: var(--panel); cursor: pointer; } .pager button:disabled { opacity: .45; cursor: default; } .ex-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 11px 16px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); } .ex-foot .acts { display: flex; flex-wrap: wrap; gap: 8px; } .ex-foot a { border: 1px solid var(--line2); border-radius: 8px; padding: 4px 12px; color: var(--ink); text-decoration: none; background: var(--panel); } .empty { padding: 18px 4px; color: var(--muted); font-size: 14px; } .how { margin-top: 18px; max-width: 880px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); padding: 6px 18px 18px; } .tabs { display: flex; flex-wrap: wrap; gap: 2px 20px; border-bottom: 1px solid var(--line); } .tabs button { padding: 10px 0 8px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--muted); font-size: 15px; cursor: pointer; } .tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; } .note { margin: 12px 0 8px; color: var(--ink2); font-size: 14.5px; } .say-it { margin: 0; padding: 12px 14px; border-left: 3px solid var(--accent2); background: var(--tint); border-radius: 0 10px 10px 0; overflow-wrap: anywhere; } pre { margin: 0; padding: 12px 14px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; font: 13.5px/1.6 var(--mono); white-space: pre-wrap; word-break: break-all; } /* a command that names many sources (a training stage's) scrolls in its box; Copy takes it whole */ #cmd { max-height: 28em; overflow-y: auto; } .copy { margin-top: 12px; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 6px 18px; font-size: 14.5px; font-weight: 600; cursor: pointer; } .notes { max-width: 880px; } details { border-bottom: 1px solid var(--line); } details:first-of-type { margin-top: 14px; border-top: 1px solid var(--line); } summary { padding: 12px 0; font-weight: 600; cursor: pointer; } details p, details li { color: var(--ink2); } details p { margin: 0 0 14px; max-width: 52em; } details ol { margin: 0 0 14px; padding-left: 1.4em; max-width: 52em; } dl.terms { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 24px; margin: 0 0 16px; } dl.terms dt { font-weight: 600; } dl.terms dd { margin: 0; color: var(--ink2); } .cover td:first-child { font-weight: 600; white-space: nowrap; } .cover td.why { color: var(--ink2); min-width: 200px; } footer { margin-top: 56px; padding: 18px 0 44px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); } /* on a wide screen the first screen's words stand on the picture's left edge: a shade keeps them readable */ @media (min-width: 901px) { .stage::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(11, 20, 25, .9) 0, rgba(11, 20, 25, .72) 30%, rgba(11, 20, 25, 0) 54%); opacity: 0; transition: opacity .7s; } .story[data-step='0'] .stage::after { opacity: 1; } } @media (max-width: 560px) { #brand-sub { display: none; } } @media (max-width: 1200px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tiles div:nth-child(3) { padding-left: 0; border-left: 0; } .tiles div:nth-child(n + 3) { border-top: 1px solid rgba(255, 255, 255, .16); } } @media (max-width: 900px) { .links { display: none; } /* on a narrow screen the picture keeps the upper part of the screen and the words pass under it: a card never lies on the picture */ .stage { height: 44vh; height: 44svh; z-index: 2; box-shadow: 0 14px 18px -6px #0b1419; } .steps { margin-top: 0; } .step { min-height: 0; align-items: flex-start; padding: 14px 14px 34vh; } .step.first { padding-top: 10px; } .step[data-step='6'] { padding-bottom: 12vh; } .say { width: 100%; padding: 16px 16px 18px; } .step.first .say { width: 100%; padding: 0 2px; } .story h1 { font-size: 40px; } .lede { font-size: 16px; } .txt { font-size: 14px; } .stage-note { left: 14px; right: 14px; top: auto; bottom: 6px; text-align: left; } .src-card { left: 14px; right: 14px; bottom: 14px; width: auto; } /* the dots of the steps lie in a row under the bar */ .rail { display: flex; top: 56px; left: 8px; right: auto; transform: none; } .rail button::before { left: 8px; top: 8px; transition: left .3s, width .3s, background .3s; } .rail button[aria-current='step']::before { left: 3px; top: 8px; width: 16px; height: 6px; } .rail button span { display: none; } .ex-body { grid-template-columns: minmax(0, 1fr); } .side { border-left: 0; border-top: 1px solid var(--line); border-radius: 0 0 16px 16px; } .grid { grid-template-columns: minmax(0, 1fr); } .list { max-height: 300px; } dl.terms { grid-template-columns: minmax(0, 1fr); gap: 2px; } dl.terms dd { margin-bottom: 10px; } } @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .hint::after { animation: none; } .split i, .rows .trk u { transition: none; } } </style> </head> <body> <nav class="top" aria-label="Sections"><div class="wrap"> <a class="brand" href="#top"><b id="brand"></b><span id="brand-sub"></span></a> <div class="links" id="links"></div> <div class="lang" id="lang" role="group" aria-label="Language"><button type="button" data-lang="zh"></button><button type="button" data-lang="en"></button></div> </div></nav> <main id="top"> <section class="story" id="story"> <div class="stage" id="stage"><div class="gl" id="gl"></div><div class="labels" id="labels"></div><nav class="rail" id="rail"></nav><div class="halo" id="halo" hidden></div><div class="tip" id="tip" hidden></div><p class="stage-note" id="stage-note"></p></div> <div class="steps" id="steps"> <article class="step first" data-step="0"><div class="say"> <p class="kicker" id="kicker"></p> <h1 id="title"></h1> <p class="lede" id="lede"></p> <dl class="tiles" id="tiles"></dl> <div class="actions"><a class="btn primary" href="#get" id="cta"></a><a class="btn ghost" id="hub" href="https://huggingface.co/datasets/Battam/training-data-foundation" target="_blank" rel="noopener"></a><p class="hint" id="hint"></p></div> </div></article> <article class="step" data-step="1"><div class="say" id="say1"></div></article> <article class="step" data-step="2"><div class="say" id="say2"></div></article> <article class="step" data-step="3"><div class="say" id="say3"></div></article> <article class="step" data-step="4"><div class="say" id="say4"></div></article> <article class="step" data-step="5"><div class="say" id="say5"></div></article> <article class="step" data-step="6"><div class="say" id="say6"></div></article> <aside class="src-card" id="src-card" hidden></aside> </div> </section> <div class="wrap"> <section id="explore" class="paper reveal"> <h2 id="ex-title"></h2> <p class="sub" id="ex-sub"></p> <div class="frame"> <div class="ex-bar"><div class="ex-meta" id="meta"></div><div class="seg" id="views" role="group"></div></div> <div class="ex-body" id="graph"> <div class="charts"> <div class="charts-head"><span id="metric-cap"></span><span class="seg" id="metrics" role="group"></span></div> <div class="grid" id="charts"></div> <p class="charts-note" id="charts-note"></p> </div> <aside class="side"> <h3 id="side-title"></h3> <input class="search" id="q1" type="search" autocomplete="off"> <div id="picked"></div> <ul class="list" id="list"></ul> </aside> </div> <div class="table-view" id="table" hidden> <input class="search" id="q2" type="search" autocomplete="off"> <div class="tablewrap"><table><thead><tr id="thead"></tr></thead><tbody id="tbody"></tbody></table></div> <div class="pager" id="pager"></div> </div> <div class="ex-foot"><span></span><span class="acts"><a id="dl" href="https://huggingface.co/datasets/Battam/training-data-foundation/resolve/main/meta/catalog.parquet" target="_blank" rel="noopener"></a><a id="toget" href="#get"></a></span></div> </div> </section> <section id="get" class="paper reveal"> <h2 id="get-title"></h2> <p class="sub" id="sel"></p> <div class="how"> <div class="tabs" id="how" role="tablist"></div> <p class="note" id="how-note"></p> <p class="say-it" id="say"></p> <pre id="cmd" hidden></pre> <button class="copy" id="copy" type="button"></button> </div> </section> <section id="notes" class="paper reveal notes"> <h2 id="notes-title"></h2> <div id="notes-list"></div> </section> <footer id="foot"></footer> </div> </main> <script type="module"> import * as Plot from 'https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6.17/+esm'; import { t as words } from './i18n.js'; // the manual was a view of the page at #manual and #manual/<part>; it is the page manual.html now if (location.hash.startsWith('#manual')) location.replace(`manual.html${location.search}${location.hash}`); document.documentElement.classList.add('js'); const $ = (id) => document.getElementById(id); const el = (tag, cls, text) => { const n = document.createElement(tag); if (cls) n.className = cls; if (text != null) n.textContent = text; return n; }; const cssv = (name) => getComputedStyle(document.documentElement).getPropertyValue(name).trim(); const still = () => matchMedia('(prefers-reduced-motion: reduce)').matches; // the language: the reader's choice if they made one, else Chinese for a Chinese browser, English for any other let lang = 'en'; // ?lng=zh or ?lng=en in the address (the links of the manual and of the dataset card) comes before the choice kept here const asked = /^(zh|en)$/.test(new URLSearchParams(location.search).get('lng')) ? new URLSearchParams(location.search).get('lng') : null; try { lang = asked || localStorage.getItem('lang') || (/^zh/i.test(navigator.language) ? 'zh' : 'en'); } catch { lang = asked || (/^zh/i.test(navigator.language) ? 'zh' : 'en'); } // every word the page writes, by its key in locales/en.json and locales/zh.json, in the language in force const t = (key, o) => words(key, { ...o, lng: lang }); // the switch names each language in that language, whichever is in force for (const b of $('lang').children) b.textContent = t(`page.lang.${b.dataset.lang}`); /** A count in the language in force: under ten thousand in full, else three significant digits (four from a hundred * billion) with the word of its scale in the language's compact notation: 140.2B and 1.40B in English. */ function num(n) { const loc = lang === 'zh' ? 'zh-CN' : 'en'; if (n < 1e4) return new Intl.NumberFormat(loc).format(Math.round(n)); const sig = n >= 1e11 ? 4 : 3; const p = new Intl.NumberFormat(loc, { notation: 'compact', useGrouping: false, maximumSignificantDigits: sig, minimumSignificantDigits: sig }).formatToParts(n); const a = p.filter((x) => x.type !== 'compact' && x.type !== 'literal').map((x) => x.value).join(''); const w = p.filter((x) => x.type === 'compact').map((x) => x.value).join(''); const fig = Number(a) >= 1000 ? new Intl.NumberFormat(loc).format(Number(a)) : a; return lang === 'zh' ? `${fig} ${w}` : `${fig}${w}`; } const units = (n) => t('page.figure.units', { count: n, n: num(n) }); const srcs = (n) => t('page.figure.sources', { count: n, n: num(n) }); // a release tag's date (release-2026-11-22.5.p763: 2026-11-22), the name the page gives a release const dateOf = (tag) => (/\d{4}-\d{2}-\d{2}/.exec(String(tag)) || [tag])[0]; const bytesText = (b) => { const u = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']; let k = 0; while (b >= 1000 && k < u.length - 1) { b /= 1000; k++; } return `${Number(b.toPrecision(3))} ${u[k]}`; }; const pct = (a, b) => { const p = b ? a / b * 100 : 0; return `${p >= 95 && p < 100 ? Math.min(99.9, p).toFixed(1) : p >= 10 ? Math.round(p) : p >= 0.1 ? p.toFixed(1) : p > 0 ? '<0.1' : '0'}%`; }; const HUB = 'https://huggingface.co/datasets/Battam/training-data-foundation'; const DOC = 'https://huggingface.co/spaces/Battam/training-data-foundation/resolve/main/llms.txt'; // The stage's colors, fixed, as its ground is dark in both themes. The six class colors pass the palette validator // on all pairs against that ground (worst pair: 18.4 in normal vision, 9.7 for protan and deutan readers); the // classes past the six largest share one neutral tone, and the formal values another. const STAGE = [11, 20, 25], HUES = [[61, 120, 178], [200, 128, 13], [167, 110, 248], [35, 172, 116], [179, 75, 113], [92, 108, 20]], REST = [112, 130, 140], NONE = [84, 99, 108]; const rgb = (c) => `rgb(${c.map(Math.round).join(',')})`; const mix = (a, b, t) => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t]; // a link to another site opens in a new tab: the Space runs this page in a frame that may not go to another site, // and huggingface.co refuses to be framed, so such a link in the same tab shows only an error (2026-11-12; the old // page's app.js did this and went with it on 2026-11-23) addEventListener('click', (e) => { const a = e.target.closest && e.target.closest('a[href]'); if (a && a.origin !== location.origin) { a.target = '_blank'; a.rel = 'noopener'; } }, true); Promise.all(['sources.json', 'terms.json'].map((f) => fetch(f).then((r) => r.json()))).then(([d, v]) => start(d, v)); function start(D, V) { const short = (t) => t.split(/[:\uFF1A(\uFF08]/)[0].trim(); // one record a source, as the file gives it: id, title, its classes of subject and of industry, cataloged, units, // bytes, units by license, publisher, what it is in English and in Chinese, its classes of resource type, how its // units can be fetched, its training stages (places in STAGES), the units each stage counts of it (null when the // stage figures give none) const A = D.sources.map((s) => ({ id: s[0], title: short(s[1]), subject: s[2], industry: s[3], listed: !!s[4], units: s[5], bytes: s[6], permit: s[7], who: s[8], en: s[9], zh: s[10], rtype: s[11], fetch: s[12], stages: s[13] || [], staged: s[14] || null })).sort((a, b) => b.units - a.units); A.forEach((o, k) => { o.k = k; o.main = o.permit.indexOf(Math.max(...o.permit)); o.text = `${o.title} ${o.id} ${o.who}`.toLowerCase(); }); const total = A.reduce((a, o) => a + o.units, 0); // the sources whose units the index does not record one by one (it reads their own index) const indexed = A.filter((o) => !o.listed), indexedUnits = indexed.reduce((a, o) => a + o.units, 0), listedUnits = total - indexedUnits; // the sources whose units the fetch tool cannot take one by one yet (fetch 0; 1, by their rows; 2, through their // upstream's index), and the units it can take const notYet = A.filter((o) => o.fetch === 0), fetchUnits = total - notYet.reduce((a, o) => a + o.units, 0); // the units of the sources with a training stage: every unit of a source has its source's stages const stagedUnits = A.reduce((a, o) => a + (o.stages.length ? o.units : 0), 0); const stated = A.reduce((a, o) => a + o.permit[0] + o.permit[1] + o.permit[2], 0); const scaleBytes = D.distinct_bytes / A.reduce((a, o) => a + o.bytes, 0); const LOGMAX = Math.log10(A[0].units); /** The words dating a figure of the release given, whose day is date, when that release is not the newest of the * releases the page's figures are of (D.newest); null when it is, or when the file names no newest. */ const asOfLate = (release, date) => (D.newest && release && release !== D.newest ? t('page.figure.asOfLate', { date }) : null); // a class as the file names it: [code, Chinese name, English name for a label, the standard's full English name]; // formal: the values that say a source or a unit is not classified, which every chart shows last and pale const named = (x) => (lang === 'zh' ? x[1] : x[2]), about = (o) => (lang === 'zh' ? o.zh || o.en : o.en); const formal = (g) => g[0] === 'unclassified' || g[0] === 'multi' || g[0] === 'unknown' || g[0] === 'none'; const loose = A.filter((o) => D.subjects[o.subject[0]][0] === 'unclassified'), looseUnits = loose.reduce((a, o) => a + o.units, 0); for (const o of loose) o.loose = true; const STAGES = [ { key: 'page.figure.stage.pre', hint: 'page.figure.stage.pre.hint', c: HUES[0] }, { key: 'page.figure.stage.mid', hint: 'page.figure.stage.mid.hint', c: HUES[2] }, { key: 'page.figure.stage.post', hint: 'page.figure.stage.post.hint', c: HUES[3] }, ]; // a source's places in STAGES, or the place after them when it has no stage; a source in several stages is in each const STAGE_KEYS = [...STAGES.map((s) => s.key), 'page.figure.stage.none']; for (const o of A) o.stage = o.stages.length ? o.stages : [STAGES.length]; // the colors of the story's first step: of its three largest sources, then of the others, in its rows and its marks const LARGEST = [[236, 245, 255], [150, 192, 230], [92, 146, 200], [54, 86, 111]]; // The first three are classifications by recognized standards, which the catalog gives every source (a source // may hold several classes of one standard); std names the standard. The training stages follow once they are // counted: their names are the page's words in the language in force, in their own order (fixed), with no code. const DIMS = [ { id: 'subject', key: 'page.figure.dim.subject', names: D.subjects, top: 10, std: 'OECD FOS 2007' }, { id: 'industry', key: 'page.figure.dim.industry', names: D.industries, top: 10, std: 'ISIC Rev. 5' }, { id: 'rtype', key: 'page.figure.dim.rtype', names: D.rtypes, top: 10, std: 'DataCite Metadata Schema' }, { id: 'permit', key: 'page.figure.permit', names: D.permits }, ...(D.stages ? [{ id: 'stage', key: 'page.story.cover.stage', fixed: true, get names() { return STAGE_KEYS.map((k) => [k.split('.').pop(), t(k), t(k), t(k)]); } }] : []), ]; // the dimensions whose values a source holds as a list of classes const PARTS = DIMS.slice(0, 3), CLASSED = DIMS.filter((d) => d.id !== 'permit'), PERMC = [HUES[3], HUES[1], HUES[4], NONE]; const classes = (o, dim) => o[dim.id].map((k) => named(dim.names[k])).join(t('page.figure.sep.list')); /** The group of the source o under the dimension dim: its first class when that is one of the six largest, else * the group of the other classes, or that of a formal value. */ const zoneOf = (o, dim) => { const k = o[dim.id][0]; return formal(dim.names[k]) ? `f${k}` : k < HUES.length ? `c${k}` : 'rest'; }; const zoneColor = (key) => (key === 'rest' ? REST : key[0] === 'f' ? NONE : HUES[Number(key.slice(1))]); const zoneName = (dim, key) => (key === 'rest' ? t('page.figure.otherClasses') : named(dim.names[Number(key.slice(1))])); /** The groups of the dimension dim, the largest first, the other classes and the formal values last: of each its * key, its sources and its units. */ function zones(dim) { const m = new Map(); for (const o of A) { const key = zoneOf(o, dim); let g = m.get(key); if (!g) m.set(key, g = { key, n: 0, units: 0 }); g.n++; g.units += o.units; } const last = (g) => (g.key === 'rest' ? 1 : g.key[0] === 'f' ? 2 : 0); return [...m.values()].sort((a, b) => last(a) - last(b) || b.n - a.n); } // the filters: of each classification the classes picked (none: no filter), as in a faceted search; picks, the // sources ticked in the table or the list, which the fetch then takes in place of the filters // metric: what a bar's length counts, units by default (the page counts units; sources are the other choice) const state = { metric: 'units', subject: [], industry: [], rtype: [], permit: [], stage: [], q: '', picks: [], view: 'graph', sort: ['units', -1], page: 0, more: 60, all: {}, how: 'say' }; const toggle = (o) => { const i = state.picks.indexOf(o); if (i < 0) state.picks.push(o); else state.picks.splice(i, 1); }; /** Whether the source o is in the selection: each dimension's filter (but the one named skip, whose own chart * shows every value) and the search words. */ // within one classification a source passes with any of the classes picked, across classifications with each const pass = (o, skip) => CLASSED.every((dim) => skip === dim.id || !state[dim.id].length || state[dim.id].some((k) => o[dim.id].includes(k))) && (skip === 'permit' || !state.permit.length || state.permit.some((k) => o.permit[k] > 0)) && (!state.q || o.text.includes(state.q)); // a source's units in the training stage at place k of STAGES: those the stage figures count of it, after // deduplication and benchmark decontamination; under the bar of the sources with no stage, the units it registers const stageUnits = (o, k) => (k < STAGES.length && o.staged ? o.staged[k] : o.units); // a source's units in the selection, or in the stage at place k: under a stage filter, the most one of the stages // picked counts of it, so a unit in two of them counts once; under a license filter, their share of that license const unitsOf = (o, k = null) => { const n = k != null ? stageUnits(o, k) : state.stage.length ? Math.max(0, ...state.stage.filter((s) => o.stage.includes(s)).map((s) => stageUnits(o, s))) : o.units; return !state.permit.length ? n : o.units > 0 ? n * state.permit.reduce((a, j) => a + o.permit[j], 0) / o.units : 0; }; // ---- the picture: glowing points in three dimensions, by three.js. A cluster of points is a source, with more // points the more units it has (on a log scale); the same points regroup at each step of the story. let picture = null, stepNow = 0; async function scene() { const stage = $('stage'), host = $('gl'), labs = $('labels'), tip = $('tip'); let T, renderer; try { T = await import('https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js'); renderer = new T.WebGLRenderer({ antialias: false, alpha: true }); } catch (e) { console.warn(`the picture did not start: ${e}`); return null; } renderer.setPixelRatio(Math.min(devicePixelRatio || 1, 2)); host.append(renderer.domElement); const FOV = 38, HALF = Math.tan(FOV / 2 * Math.PI / 180); const world = new T.Scene(), cam = new T.PerspectiveCamera(FOV, 1, 0.1, 100), group = new T.Group(); world.add(group); const n = A.length, share = (u) => Math.log10(Math.max(10, u)) / LOGMAX; const first = new Uint32Array(n + 1); A.forEach((o, s) => { first[s + 1] = first[s] + Math.max(2, Math.round(0.5 * Math.log10(Math.max(10, o.units)) ** 2)); }); const N = first[n]; const pos = new Float32Array(N * 3), tgt = new Float32Array(N * 3), col = new Float32Array(N * 3), tcol = new Float32Array(N * 3), off = new Float32Array(N * 3); const size = new Float32Array(N), seed = new Float32Array(N), was = new Float32Array(N), own = new Uint16Array(N), perm = new Uint8Array(N), lane = new Int8Array(N), ctr = new Float32Array(n * 3); // the same random numbers at every visit, so that the picture is the same picture let r32 = 20261122; const rnd = () => { r32 = r32 + 0x6D2B79F5 | 0; let t = Math.imul(r32 ^ r32 >>> 15, 1 | r32); t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t; return ((t ^ t >>> 14) >>> 0) / 4294967296; }; const gauss = () => Math.sqrt(-2 * Math.log(1 - rnd())) * Math.cos(6.2831853 * rnd()); A.forEach((o, s) => { // its points by training use, in proportion to its units of each const k = first[s + 1] - first[s], sum = o.permit.reduce((a, b) => a + b, 0) || 1, want = o.permit.map((u) => u / sum * k), got = want.map(Math.floor); for (let left = k - got.reduce((a, b) => a + b, 0); left > 0; left--) { let m = 0; for (let j = 1; j < 4; j++) if (want[j] - got[j] > want[m] - got[m]) m = j; got[m]++; } let j = 0, used = 0; for (let i = first[s]; i < first[s + 1]; i++) { while (j < 3 && used >= got[j]) { j++; used = 0; } perm[i] = j; used++; own[i] = s; seed[i] = rnd(); size[i] = 0.06 + 0.075 * share(o.units); for (let c = 0; c < 3; c++) { off[i * 3 + c] = gauss(); pos[i * 3 + c] = gauss() * 7; } // in the river: a few points leave at each of the three gates, the others end in one of the three streams const u = rnd(); lane[i] = u < 0.05 ? -1 : u < 0.1 ? -2 : u < 0.15 ? -3 : i % 3; } }); // lit: the part of the picture a row of the words points at (a test of a point), or null for the whole of it; // base holds each point's own color, grp the cloud it stands in const base = new Float32Array(N * 3), grp = new Int16Array(N), DIM = 0.13; let lit = null; // where things are now, read from the points themselves at each frame, so that a name, a ring or a pointer's hit // is where its points are seen and not where they are going: ctr, the middle of each source's points (those in // its own cloud, inHome); cloudAt, of each cloud its middle and how wide its points lie (the sums of x, of y and // of the squared distance, and the count); gap, how far the points are from their places on average const inHome = new Uint8Array(N).fill(1), cloudAt = new Float64Array(64), cnt = new Uint16Array(n); let gap = 9; const put = (i, x, y, z, sig, c) => { const a = i * 3, f = !lit || lit(i) ? 1 : DIM; tgt[a] = x + off[a] * sig; tgt[a + 1] = y + off[a + 1] * sig; tgt[a + 2] = z + off[a + 2] * sig; for (let j = 0; j < 3; j++) { base[a + j] = c[j] / 255; tcol[a + j] = base[a + j] * f; } }; const spread = (s) => 0.03 + 0.022 * Math.cbrt(first[s + 1] - first[s]); const star = (o) => mix([64, 124, 186], [236, 245, 255], share(o.units) ** 2); /** The galaxy: the sources on a disc of three winding arms, the largest at its heart, each in the color paint gives. */ function galaxy(paint) { A.forEach((o, s) => { const t = s / n, r = 0.16 + 4.5 * Math.sqrt(t), a = (s % 3) * 2.0944 + r * 0.92 + (seed[first[s]] - 0.5) * (0.5 + 0.9 * t), x = r * Math.cos(a), y = r * Math.sin(a), z = (seed[first[s + 1] - 1] - 0.5) * 0.7 * (1 - t), c = paint(o); for (let i = first[s]; i < first[s + 1]; i++) put(i, x, y, z, spread(s), c); }); inHome.fill(1); return []; } /** The points in groups, a round cloud a group, packed around the middle with the largest first; inside a group * its sources again as a sunflower's seeds. keyOf gives a point's group, home a source's own group. */ function clouds(keyOf, colorOf, home) { const groups = new Map(); for (let i = 0; i < N; i++) { const key = keyOf(i); let g = groups.get(key); if (!g) groups.set(key, g = { key, w: 0, of: new Map() }); g.w++; let pts = g.of.get(own[i]); if (!pts) g.of.set(own[i], pts = []); pts.push(i); } const list = [...groups.values()].sort((a, b) => b.w - a.w), placed = []; for (const g of list) { g.R = 0.4 + 1.3 * Math.sqrt(g.w / list[0].w); seek: for (let r = 0; r < 16; r += 0.1) for (let a = 0; a < 6.2832; a += 0.2618) { const x = r * 1.8 * Math.cos(a), y = r * 0.95 * Math.sin(a); if (placed.every((p) => Math.hypot(p.x - x, p.y - y) >= p.R + g.R + 0.34)) { g.x = x; g.y = y; placed.push(g); break seek; } } } const x0 = Math.min(...list.map((g) => g.x - g.R)), x1 = Math.max(...list.map((g) => g.x + g.R)), y0 = Math.min(...list.map((g) => g.y - g.R)), y1 = Math.max(...list.map((g) => g.y + g.R)); const k = Math.min(8.8 / (x1 - x0), 5.2 / (y1 - y0), 1.3); for (const [gi, g] of list.entries()) { g.x = (g.x - (x0 + x1) / 2) * k; g.y = (g.y - (y0 + y1) / 2) * k; g.R *= k; const c = colorOf(g.key), all = [...g.of.entries()]; for (const [, pts] of all) for (const i of pts) grp[i] = gi; all.forEach(([s, pts], j) => { const rr = g.R * 0.86 * Math.sqrt((j + 0.5) / all.length), a = j * 2.39996, x = g.x + rr * Math.cos(a), y = g.y + rr * Math.sin(a), z = (seed[pts[0]] - 0.5) * 0.5; const tone = mix(c, [255, 255, 255], 0.04 + 0.34 * share(A[s].units) ** 2), mine = home(s) === g.key ? 1 : 0; for (const i of pts) { put(i, x, y, z, spread(s) * 0.8, tone); inHome[i] = mine; } }); // how wide the cloud's points lie once in place: its name comes up as they close in to that let sx = 0, sy = 0, sq = 0, m = 0; for (const [, pts] of all) for (const i of pts) { const a = i * 3; sx += tgt[a]; sy += tgt[a + 1]; sq += tgt[a] * tgt[a] + tgt[a + 1] * tgt[a + 1]; m++; } g.rest = Math.sqrt(Math.max(1e-6, sq / m - (sx / m) ** 2 - (sy / m) ** 2)); } return list; } // the river: every point flows from the left to the right; at three gates a few fall away, and what is left // parts into three streams, one a training stage // FLAG: how high each gate's line stands; its name flies from the top, the first the highest, so that no line // crosses a name const GATE = [-2.7, -1.3, 0.1], FLAG = [3.0, 2.58, 2.16], PART = [1.2, 3.3], REACH = 5.9, STREAM = [1.5, 0, -1.5], PALE = [205, 218, 226]; function river(t, jump) { for (let i = 0; i < N; i++) { const a = i * 3, ph = (t * 0.045 + seed[i]) % 1, x = -REACH + 2 * REACH * ph, ln = lane[i]; let y = off[a + 1] * 0.4, c = PALE, glow = Math.min(1, ph * 14, (1 - ph) * 14); if (ln < 0) { const d = x - GATE[-ln - 1]; if (d > 0) { y -= d * d * 0.5 + d * 0.25; glow *= Math.max(0, 1 - d / 2.4); c = NONE; } } else { const m = Math.min(1, Math.max(0, (x - PART[0]) / (PART[1] - PART[0]))), e = m * m * (3 - 2 * m); y = y * (1 - 0.5 * e) + STREAM[ln] * e; c = mix(PALE, STAGES[ln].c, e); } if (lit && !lit(i)) glow *= DIM; tgt[a] = x; tgt[a + 1] = y; tgt[a + 2] = off[a + 2] * 0.4; tcol[a] = c[0] / 255 * glow; tcol[a + 1] = c[1] / 255 * glow; tcol[a + 2] = c[2] / 255 * glow; // a point that starts again at the left does not fly back across the picture if (jump || ph < was[i]) { pos[a] = tgt[a]; pos[a + 1] = tgt[a + 1]; pos[a + 2] = tgt[a + 2]; col[a] = col[a + 1] = col[a + 2] = 0; } was[i] = ph; } } const geo = new T.BufferGeometry(); geo.setAttribute('position', new T.BufferAttribute(pos, 3)); geo.setAttribute('aColor', new T.BufferAttribute(col, 3)); geo.setAttribute('aSize', new T.BufferAttribute(size, 1)); const mat = new T.ShaderMaterial({ // light only adds: a point writes no opacity of its own, so a point gone dark leaves no mark on the ground uniforms: { uScale: { value: 600 } }, transparent: true, depthWrite: false, depthTest: false, blending: T.CustomBlending, blendSrc: T.OneFactor, blendDst: T.OneFactor, vertexShader: 'attribute vec3 aColor; attribute float aSize; uniform float uScale; varying vec3 vC; void main() { vC = aColor; vec4 mv = modelViewMatrix * vec4(position, 1.0); gl_PointSize = max(1.6, aSize * uScale / -mv.z); gl_Position = projectionMatrix * mv; }', fragmentShader: 'varying vec3 vC; void main() { float a = smoothstep(0.5, 0.0, length(gl_PointCoord - 0.5)); gl_FragColor = vec4(vC * a * a, 0.0); }', }); const points = new T.Points(geo, mat); points.frustumCulled = false; group.add(points); // the river's three gates, thin lines the points pass through const gates = new T.LineSegments(new T.BufferGeometry().setAttribute('position', new T.BufferAttribute(new Float32Array(GATE.flatMap((x, k) => [x, -2.1, 0, x, FLAG[k], 0])), 3)), new T.LineBasicMaterial({ color: 0x8fa3ad, transparent: true, opacity: 0.55 })); gates.visible = false; group.add(gates); // which arrangement each step shows, how far the picture leans back, whether it turns by itself const SHOW = [['galaxy', -1.02, 1], ['galaxy', -1.02, 1], ['subject', -0.14, 0], ['rtype', -0.14, 0], ['permit', -0.14, 0], ['cover', -1.02, 1], ['river', -0.3, 0]]; let form = '', since = 0, lean = -1.02, turns = true, spun = 0, swung = 0, lift = 0, seen = true, lastT = performance.now(), marks = [], drag = null, at = null, cloudsNow = []; /** The names in the picture at the step in force: of each, a point of the picture, its words, and for a name * that stands away from its point the offset in pixels (then a thin line joins them). */ function label() { const out = [], step = stepNow, [f] = SHOW[step]; // key: the row of the words the name belongs to, so that it stays bright when that row is pointed at // mid: the name stands centered over its point (a cloud's name over the cloud), or with 'end' ends at it // from: what the name follows at each frame, a source ({s}) or a cloud ({g}: its place in cloudsNow); none for a // name with a place of its own (p) const tag = (p, color, text, small, away, key, mid, from) => { const node = el('div', 'tag'); if (color) { const dot = el('i'); dot.style.background = rgb(color); node.append(dot); } node.append(text); if (small) node.append(el('small', '', small)); const wire = away ? el('div', 'wire') : null; node.style.opacity = 0; if (wire) wire.style.opacity = 0; out.push({ p, node, wire, away, key, mid, from }); }; // the largest sources named in the picture where it has the room (700 pixels across; the words name them anyway); // a narrower picture marks the three largest with a line to a dot of their row's color in the rows under it if (step === 1 && roomW >= 700) [[-190, -120], [150, -140], [190, -30], [170, 80]].forEach((away, k) => { const o = A[k]; tag([0, 0, 0], null, o.title, num(o.units), away, k < 3 ? k : 'rest', null, { s: k }); }); else if (step === 1) [[-72, -62], [74, -70], [80, 36]].forEach((away, k) => tag([0, 0, 0], LARGEST[k], '', null, away, k, null, { s: k })); // a narrow picture has no room for more than a few names: the rows under it then name the clouds by their color if ((f === 'subject' || f === 'rtype') && (stage.clientWidth > 900 || cloudsNow.length <= 4)) { const dim = DIMS.find((d) => d.id === f); cloudsNow.forEach((g, gi) => tag([g.x, g.y + g.R + 0.16, 0], zoneColor(g.key), zoneName(dim, g.key), null, null, g.key, true, { g: gi })); } if (f === 'permit') cloudsNow.forEach((g, gi) => tag([g.x, g.y + g.R + 0.16, 0], PERMC[g.key], named(D.permits[g.key]), null, null, g.key, true, { g: gi })); if (f === 'river') { tag([GATE[0] - 1.7, 0.95, 0], null, t('page.story.river.all')); [t('page.story.river.overlap'), t('page.story.river.notCompared'), t('page.story.river.duplicate')].forEach((t, k) => tag([GATE[k] + 0.08, FLAG[k] - 0.02, 0], NONE, `${k + 1} ${t}`)); STAGES.forEach((s, k) => tag([PART[1] + 1.0, STREAM[k] + 0.62, 0], s.c, t(s.key), null, null, k, 'end')); } marks = out; labs.replaceChildren(...out.flatMap((m) => (m.wire ? [m.wire, m.node] : [m.node]))); $('stage-note').textContent = f === 'river' ? t('page.story.note.river') : f === 'galaxy' || f === 'cover' ? t('page.story.note.galaxy') : f === 'permit' ? t('page.story.note.permit') : t('page.story.note.first'); } /** Lights the part of the picture the row with this key stands for and dims the rest; null lights all of it. */ function spot(key) { const gi = cloudsNow.findIndex((g) => String(g.key) === String(key)); lit = key == null ? null : form === 'river' ? (i) => lane[i] === key : form === 'cover' ? ({ fetch: (i) => A[own[i]].fetch > 0, listed: (i) => A[own[i]].listed, stated: (i) => perm[i] < 3, classed: (i) => !A[own[i]].loose, staged: (i) => A[own[i]].stages.length > 0, none: () => false })[key] || null : form === 'galaxy' ? (key === 'rest' ? (i) => own[i] > 2 : (i) => own[i] === key) : (i) => grp[i] === gi; if (form !== 'river') for (let i = 0; i < N; i++) { const a = i * 3, f = !lit || lit(i) ? 1 : DIM; tcol[a] = base[a] * f; tcol[a + 1] = base[a + 1] * f; tcol[a + 2] = base[a + 2] * f; } for (const m of marks) m.dim = lit != null && String(m.key) !== String(key); } let shown = -1; function show(step) { const [f, back, turn] = SHOW[step]; lean = back; turns = !!turn; gates.visible = f === 'river'; if (step !== shown && lit && f === form) spot(null); shown = step; aim(); if (f !== form) { form = f; lit = null; since = performance.now(); cloudsNow = []; if (f === 'galaxy') galaxy(star); else if (f === 'cover') galaxy((o) => (o.listed ? mix(star(o), STAGE, 0.66) : [255, 196, 96])); else if (f === 'permit') cloudsNow = clouds((i) => perm[i], (key) => PERMC[key], (s) => A[s].main); else if (f === 'river') river(performance.now() / 1000, false); else { const dim = DIMS.find((d) => d.id === f); cloudsNow = clouds((i) => zoneOf(A[own[i]], dim), zoneColor, (s) => zoneOf(A[s], dim)); } } label(); } // where the picture stands and how far the camera is: the frame moves both there // roomL, roomW: the left edge and the width of the room the picture has, in pixels let aimX = 0, aimY = 0, aimZ = 14, fitted = false, roomL = 0, roomW = 0; /** The picture takes the room it has, whatever the window's shape: on a wide screen what is right of the card of * the step in force; on a narrow one the stage, which is the upper part of the screen, below its bar. */ function aim() { const w = stage.clientWidth, h = stage.clientHeight, card = document.querySelectorAll('.step .say')[stepNow]; if (!w || !h || !card) return; const r = card.getBoundingClientRect(), wide = w > 900; const left = wide ? r.right + 28 : 0, right = wide ? w - 44 : w, top = wide ? 64 : 80, bottom = wide ? h - 44 : h - 26; const per = Math.max(14, Math.min((right - left) / (wide ? 9.4 : 10.6), (bottom - top) / 6.4)); aimZ = h / (2 * HALF * per); aimX = ((left + right) / 2 - w / 2) / per; aimY = (h / 2 - (top + bottom) / 2) / per; roomL = left; roomW = right - left; if (!fitted) { fitted = true; cam.position.z = aimZ; group.position.set(aimX, aimY, 0); } } function fit() { const w = stage.clientWidth, h = stage.clientHeight; if (!w || !h) return; renderer.setSize(w, h, false); cam.aspect = w / h; cam.updateProjectionMatrix(); mat.uniforms.uScale.value = h * renderer.getPixelRatio() / (2 * HALF); aim(); // the names depend on the room too if (shown >= 0) label(); } new ResizeObserver(fit).observe(stage); fit(); new IntersectionObserver(([e]) => { seen = e.isIntersecting; }).observe($('story')); // a drag turns the picture; a pointer at rest over a cluster names its source const cv = renderer.domElement; // and a click on a cluster opens the card of its source const halo = $('halo'), card = $('src-card'); let moved = 0, tap = null, opened = null; cv.addEventListener('pointerdown', (e) => { drag = [e.clientX, e.clientY]; moved = 0; cv.setPointerCapture(e.pointerId); cv.style.cursor = 'grabbing'; }); cv.addEventListener('pointermove', (e) => { if (drag) { moved += Math.abs(e.clientX - drag[0]) + Math.abs(e.clientY - drag[1]); swung += (e.clientX - drag[0]) * 0.005; lift = Math.max(-0.5, Math.min(0.5, lift + (e.clientY - drag[1]) * 0.003)); drag = [e.clientX, e.clientY]; at = null; } else at = [e.offsetX, e.offsetY]; }); const drop = (e) => { if (drag && moved < 6 && e.type === 'pointerup') tap = [e.offsetX, e.offsetY]; drag = null; cv.style.cursor = 'grab'; }; cv.addEventListener('pointerup', drop); cv.addEventListener('pointercancel', drop); // the card stands over the words while the picture is in place, and goes when the story is left addEventListener('scroll', () => { if (opened && $('story').getBoundingClientRect().bottom < innerHeight) open(null); }, { passive: true }); function open(o) { opened = o; if (!o) { card.hidden = halo.hidden = true; return; } const dl = el('dl'), row = (k, v) => dl.append(el('dt', '', k), el('dd', '', v)), what = el('p', '', about(o)); const more = el('button', 'link', t('page.story.card.inTable')), shut = el('button', 'shut', '×'); if (lang === 'zh' && !o.zh) what.lang = 'en'; row(t('page.figure.publisher'), o.who || t('page.figure.notStated')); row(t('page.figure.unitCount'), num(o.units)); for (const dim of PARTS) row(t(dim.key), classes(o, dim)); row(t('page.figure.permit'), named(D.permits[o.main])); more.type = shut.type = 'button'; shut.setAttribute('aria-label', t('page.story.card.close')); shut.onclick = () => open(null); more.onclick = () => { if (!state.picks.includes(o)) state.picks.push(o); state.view = 'table'; state.q = o.id.toLowerCase(); $('q1').value = $('q2').value = o.id; state.page = 0; render(); $('explore').scrollIntoView(); }; card.replaceChildren(shut, el('b', '', o.title), what, dl, more); card.hidden = false; } cv.addEventListener('pointerleave', () => { at = null; tip.hidden = true; }); const v = new T.Vector3(); const seenAt = (x, y, z, w, h) => { v.set(x, y, z).applyMatrix4(group.matrixWorld).project(cam); return [(v.x * 0.5 + 0.5) * w, (-v.y * 0.5 + 0.5) * h]; }; (function frame(now) { requestAnimationFrame(frame); const dt = Math.min(0.05, (now - lastT) / 1000), calm = still(); lastT = now; if (!seen) return; if (form === 'river') river(calm ? 11.3 : now / 1000, false); // every point goes to its place at its own pace; in the river it keeps to the flow once it has joined it const joined = form === 'river' ? Math.min(1, (now - since) / 1500) ** 3 : 0, ease = Math.min(1, dt * 5); ctr.fill(0); cnt.fill(0); cloudAt.fill(0); let far = 0; const inClouds = cloudsNow.length > 0; for (let i = 0; i < N; i++) { const a = i * 3, r = calm ? 1 : Math.max(joined, 1 - Math.exp(-dt * (1.5 + 3.4 * seed[i]))); pos[a] += (tgt[a] - pos[a]) * r; pos[a + 1] += (tgt[a + 1] - pos[a + 1]) * r; pos[a + 2] += (tgt[a + 2] - pos[a + 2]) * r; const e = calm ? 1 : ease; col[a] += (tcol[a] - col[a]) * e; col[a + 1] += (tcol[a + 1] - col[a + 1]) * e; col[a + 2] += (tcol[a + 2] - col[a + 2]) * e; // where the points are now (the comment at ctr) far += Math.abs(tgt[a] - pos[a]) + Math.abs(tgt[a + 1] - pos[a + 1]); if (inHome[i]) { const s = own[i], c = s * 3; ctr[c] += pos[a]; ctr[c + 1] += pos[a + 1]; ctr[c + 2] += pos[a + 2]; cnt[s]++; } if (inClouds) { const g = grp[i] * 4; cloudAt[g] += pos[a]; cloudAt[g + 1] += pos[a + 1]; cloudAt[g + 2] += pos[a] * pos[a] + pos[a + 1] * pos[a + 1]; cloudAt[g + 3]++; } } for (let s = 0; s < n; s++) if (cnt[s]) { const c = s * 3; ctr[c] /= cnt[s]; ctr[c + 1] /= cnt[s]; ctr[c + 2] /= cnt[s]; } gap = far / N; // how nearly the points are in place, from 0 to 1: what stands on the picture by itself comes up with it const settled = Math.max(0, Math.min(1, 1.15 - gap / 0.45)); gates.material.opacity = 0.55 * settled; geo.attributes.position.needsUpdate = true; geo.attributes.aColor.needsUpdate = true; if (turns && !calm && !drag) spun = (spun + dt * 0.045) % 6.2831853; const k = calm ? 1 : Math.min(1, dt * 2.6), goal = (turns ? spun : 0) + swung; group.rotation.x += (lean + lift - group.rotation.x) * k; group.rotation.z += (goal - group.rotation.z) * k; group.position.x += (aimX - group.position.x) * k; group.position.y += (aimY - group.position.y) * k; cam.position.z += (aimZ - cam.position.z) * k; group.updateMatrixWorld(); renderer.render(world, cam); const w = stage.clientWidth, h = stage.clientHeight; for (const m of marks) { // a name follows what it names: a source's points, a cloud's points (and comes up as they close in) let up = settled; if (m.from && m.from.s != null) { const c = m.from.s * 3; m.p[0] = ctr[c]; m.p[1] = ctr[c + 1]; m.p[2] = ctr[c + 2]; } else if (m.from && cloudAt[m.from.g * 4 + 3]) { const g = cloudsNow[m.from.g], c = m.from.g * 4, q = cloudAt[c + 3], gx = cloudAt[c] / q, gy = cloudAt[c + 1] / q, wide = Math.sqrt(Math.max(1e-6, cloudAt[c + 2] / q - gx * gx - gy * gy)); m.p[0] = gx; m.p[1] = gy + g.R + 0.16; up = Math.max(0, Math.min(1, (g.rest / wide - 0.55) / 0.35)); } const op = (up * (m.dim ? 0.22 : 1)).toFixed(2); if (m.op !== op) { m.op = op; m.node.style.opacity = op; if (m.wire) m.wire.style.opacity = op; } const [x, y] = seenAt(m.p[0], m.p[1], m.p[2], w, h); if (!m.away) { m.node.style.transform = `translate(${m.mid ? `calc(${x.toFixed(1)}px - ${m.mid === 'end' ? 100 : 50}%)` : `${x.toFixed(1)}px`}, calc(${y.toFixed(1)}px - 100%))`; continue; } // a name that stands away keeps inside the picture's edges, and its line reaches it where it then stands m.wd = m.wd || m.node.offsetWidth; let lx = x + m.away[0]; const ly = y + m.away[1]; lx = m.away[0] < 0 ? Math.max(lx, roomL - 14 + m.wd) : Math.min(lx, w - m.wd - 50); m.node.style.transform = m.away[0] < 0 ? `translate(calc(${lx.toFixed(1)}px - 100% - 6px), calc(${ly.toFixed(1)}px - 50%))` : `translate(${(lx + 6).toFixed(1)}px, calc(${ly.toFixed(1)}px - 50%))`; m.wire.style.width = `${Math.hypot(lx - x, ly - y).toFixed(1)}px`; m.wire.style.transform = `translate(${x.toFixed(1)}px, ${y.toFixed(1)}px) rotate(${Math.atan2(ly - y, lx - x).toFixed(4)}rad)`; } // the source under the pointer: the one whose heart is nearest on the screen const nearest = (p) => { let best = -1, near = 22 * 22; for (let s = 0; s < n; s++) { const [x, y] = seenAt(ctr[s * 3], ctr[s * 3 + 1], ctr[s * 3 + 2], w, h), d = (x - p[0]) ** 2 + (y - p[1]) ** 2; if (d < near) { near = d; best = s; } } return best; }; if (tap) { const s = form === 'river' ? -1 : nearest(tap); tap = null; tip.hidden = true; open(s < 0 ? null : A[s]); } halo.hidden = !opened || form === 'river'; if (!halo.hidden) { const [x, y] = seenAt(ctr[opened.k * 3], ctr[opened.k * 3 + 1], ctr[opened.k * 3 + 2], w, h); halo.style.transform = `translate(${x.toFixed(1)}px, ${y.toFixed(1)}px)`; } if (at && form !== 'river') { const best = nearest(at); cv.style.cursor = best < 0 ? 'grab' : 'pointer'; if (best < 0 || A[best] === opened) tip.hidden = true; else { const o = A[best]; tip.replaceChildren(el('b', '', o.title), el('span', '', `${units(o.units)} · ${classes(o, DIMS[0])}`), el('span', '', about(o))); tip.hidden = false; tip.style.transform = `translate(${Math.min(at[0] + 14, w - 310)}px, ${Math.min(at[1] + 14, h - 120)}px)`; } at = null; } })(performance.now()); show(stepNow); return { show, spot, label: () => { label(); if (opened) open(opened); }, open: (o) => open(o) }; } scene().then((p) => { picture = p; }); // ---- the explorer's charts, by Observable Plot: a bar a value, a click a filter const ruler = document.createElement('canvas').getContext('2d'); /** The values of the dimension dim in the selection (every other filter applied, its own not): of each, its * sources and its units. */ function facet(dim) { const rows = new Map(); if (dim.id === 'permit') { D.permits.forEach((p, k) => rows.set(k, { key: k, name: named(p), full: named(p), pale: formal(p), sources: 0, units: 0 })); for (const o of A) if (pass(o, 'permit')) o.permit.forEach((u, k) => { if (u > 0) { rows.get(k).sources++; rows.get(k).units += u; } }); return [...rows.values()]; } // a source counts under each of its classes; the formal values come last, whatever their size for (const o of A) { if (!pass(o, dim.id)) continue; for (const v of o[dim.id]) { let r = rows.get(v); if (!r) { const g = dim.names[v]; rows.set(v, r = { key: v, name: named(g), full: formal(g) || dim.fixed ? named(g) : `${g[0]} ${(lang === 'zh' ? g[1] : g[3])}`, pale: formal(g), sources: 0, units: 0 }); } r.sources++; r.units += unitsOf(o, dim.id === 'stage' ? v : null); } } return [...rows.values()].sort((a, b) => a.pale - b.pale || (dim.fixed ? a.key - b.key : b[state.metric] - a[state.metric])); } function chart(dim) { const box = el('div', 'chart'), head = el('h3', '', t('page.explorer.chart.by', { dim: t(dim.key).toLowerCase() })), host = el('div'); box.append(head, host); let rows = facet(dim); const all = rows.length, open = !!state.all[dim.id], cut = dim.top && rows.filter((r) => !r.pale).length > dim.top; if (cut && !open) rows = [...rows.filter((r) => !r.pale).slice(0, dim.top), ...rows.filter((r) => r.pale)]; if (dim.std) head.append(el('small', '', dim.std)); if (cut) { const more = el('button', 'link', open ? t('page.explorer.chart.top', { top: dim.top }) : t('page.explorer.chart.all', { all: all })); more.type = 'button'; more.onclick = () => { state.all[dim.id] = !open; render(); }; box.append(more); } if (!rows.some((r) => r[state.metric] > 0)) { host.append(el('p', 'empty', t('page.figure.noMatch'))); return box; } requestAnimationFrame(() => { const W = host.clientWidth || 420, sel = state[dim.id], m = state.metric; ruler.font = `13px ${getComputedStyle(document.body).fontFamily}`; const cap = Math.min(190, W * 0.4); const clip = (s) => { if (ruler.measureText(s).width <= cap) return s; while (s.length > 2 && ruler.measureText(`${s}…`).width > cap) s = s.slice(0, -1); return `${s}…`; }; const data = rows.map((r) => ({ ...r, y: String(r.key), n: r[m], label: clip(r.name) })); const names = new Map(data.map((r) => [r.y, r.label])); // A chart whose largest bar is 100 times its smallest or more is drawn on a log scale, with ticks at powers of // ten and the exact figure at each bar's end: the units of the training stages and of the classes span several // orders of magnitude, and on a linear axis the small bars vanish. const pos = data.map((r) => r.n).filter((v) => v > 0), lo = Math.min(...pos), hi = Math.max(...pos), lg = hi / lo >= 100; const lo10 = lg ? 10 ** Math.floor(Math.log10(lo)) : 0, hi10 = lg ? 10 ** Math.ceil(Math.log10(hi)) : 0; const tens = lg ? Array.from({ length: Math.round(Math.log10(hi10 / lo10)) + 1 }, (_, k) => lo10 * 10 ** k) : []; const every = Math.ceil(tens.length / 5), end = (r) => (lg ? Math.max(r.n, lo10) : r.n); if (lg) head.append(el('small', '', t('page.explorer.chart.log'))); const fig = Plot.plot({ width: W, height: data.length * 26 + 30, marginLeft: Math.max(...data.map((r) => ruler.measureText(r.label).width)) + 14, marginRight: 64, marginTop: 2, marginBottom: 26, style: { fontSize: '13px', fontFamily: 'inherit', background: 'none', overflow: 'visible' }, x: lg ? { type: 'log', domain: [lo10, hi10], ticks: tens.filter((_, k) => k % every === 0), tickFormat: (v) => num(v).replace(/\.0+(?=\D|$)/, ''), grid: true, label: null, tickSize: 0 } : { ticks: 4, tickFormat: (v) => num(v), grid: true, label: null, nice: true, tickSize: 0 }, y: { label: null, domain: data.map((r) => r.y), tickFormat: (k) => names.get(k), tickSize: 0, padding: 0.3 }, marks: [ Plot.barX(data, { x1: lo10, x2: end, y: 'y', fill: (r) => (sel.length && !sel.includes(r.key) ? cssv('--bar-off') : r.pale ? cssv('--muted') : cssv('--bar')), rx: 2 }), Plot.barX(data, Plot.pointerY({ x1: lo10, x2: end, y: 'y', fill: cssv('--bar-hot'), rx: 2 })), Plot.text(data, { x: end, y: 'y', text: (r) => num(r.n), dx: 6, textAnchor: 'start', fill: 'currentColor' }), Plot.tip(data, Plot.pointerY({ x: end, y: 'y', title: (r) => `${r.full}\n${srcs(r.sources)}\n${units(r.units)}`, fill: cssv('--panel'), stroke: cssv('--line2') })), ], }); fig.style.cursor = 'pointer'; fig.setAttribute('role', 'img'); fig.setAttribute('aria-label', t('page.explorer.chart.label', { dim: t(dim.key).toLowerCase() })); fig.addEventListener('click', () => { const r = fig.value; if (!r) return; const s = state[dim.id], i = s.indexOf(r.key); if (i < 0) s.push(r.key); else s.splice(i, 1); state.page = 0; render(); }); host.replaceChildren(fig); }); return box; } // ---- the page's words, in the language in force const counted = new Set(); /** A figure that counts up to its value the first time it is shown. */ function count(node, key, n, text) { if (counted.has(key) || still()) { node.textContent = text(n); counted.add(key); return; } counted.add(key); const t = performance.now(); const tick = (now) => { const x = Math.min(1, (now - t) / 1100); node.textContent = text(n * (1 - (1 - x) ** 3)); if (x < 1) requestAnimationFrame(tick); else node.textContent = text(n); }; requestAnimationFrame(tick); } const seg = (node, name, list, now, set) => { node.setAttribute('aria-label', name); node.replaceChildren(...list.map(([id, text]) => { const b = el('button', '', text); b.type = 'button'; b.setAttribute('aria-pressed', String(id === now)); b.onclick = () => { if (id !== now) set(id); }; return b; })); }; const COLS = [ { id: 'title', name: 'page.explorer.col.source', key: (o) => o.title.toLowerCase() }, { id: 'subject', name: 'page.figure.dim.subject', key: (o) => classes(o, DIMS[0]) }, { id: 'rtype', name: 'page.figure.dim.rtype', key: (o) => classes(o, DIMS[2]) }, { id: 'main', name: 'page.figure.permit', key: (o) => o.main }, { id: 'units', name: 'page.figure.unitCount', key: (o) => unitsOf(o), numeric: true }, { id: 'bytes', name: 'page.figure.size', key: (o) => o.bytes, numeric: true }, ]; const size = (o) => (o.bytes > 0 ? bytesText(o.bytes * scaleBytes) : t('page.figure.notRecorded')); /** One step of the story: its kicker, its one sentence, then what follows (a small figure, a line of text). */ const say = (k, kicker, claim, ...rest) => $(`say${k}`).replaceChildren(el('p', 'kicker', kicker), el('h2', 'claim', claim), ...rest.filter(Boolean)); /** Rows with a measure each: [color, name, value, the share of the track it fills or null, key]. A row with a key, * in the card of the step given, answers the pointer: its part of the picture stays lit while the pointer is on it, * and a click holds it (pin: the step and the key of the row held). */ let pin = null; const spot = (key) => { if (picture) picture.spot(key); }; const rows = (list, wrap, step) => { const ul = el('ul', 'rows'); ul.append(...list.map(([c, name, value, part, key]) => { const li = el('li'), dot = el('i'); dot.style.background = rgb(c); li.append(dot, el('span', wrap ? 'wrapit' : '', name), el('b', '', value)); if (part != null) { const trk = el('div', 'trk'), fill = el('u'); fill.style.setProperty('--w', `${Math.max(1, part * 100).toFixed(1)}%`); fill.style.background = rgb(c); trk.append(fill); li.append(trk); } if (step == null || key === undefined) return li; li.className = 'can'; li.tabIndex = 0; li.setAttribute('role', 'button'); li.setAttribute('aria-pressed', 'false'); const hold = () => { if (stepNow !== step) return; const on = !(pin && pin[0] === step && pin[1] === key); pin = on ? [step, key] : null; for (const x of ul.children) { x.classList.toggle('pin', on && x === li); if (x.hasAttribute('aria-pressed')) x.setAttribute('aria-pressed', String(on && x === li)); } ul.classList.toggle('held', on); spot(on ? key : null); }; // the row's own mark and its part of the picture go together: both are set here, none by the style sheet alone li.addEventListener('pointerenter', (e) => { if (e.pointerType === 'mouse' && stepNow === step) { li.classList.add('hot'); spot(key); } }); li.addEventListener('pointerleave', (e) => { if (e.pointerType === 'mouse' && li.classList.contains('hot')) { li.classList.remove('hot'); if (stepNow === step) spot(pin && pin[0] === step ? pin[1] : null); } }); li.addEventListener('click', hold); li.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); hold(); } }); return li; })); return ul; }; /** What does not change with the selection: the bar, the story's words, the notes. */ function renderStatic() { document.documentElement.lang = lang === 'zh' ? 'zh-CN' : 'en'; document.title = t('page.story.docTitle'); for (const b of $('lang').children) b.setAttribute('aria-pressed', String(b.dataset.lang === lang)); $('brand').textContent = t('page.story.brand'); $('brand-sub').textContent = t('page.story.brandSub'); $('links').replaceChildren(...[['#explore', t('page.explorer.nav')], ['#get', t('page.get.nav')], ['#notes', t('page.notes.title')]].map(([h, t]) => { const a = el('a', '', t); a.href = h; return a; })); // the first screen // the day of the release the page's figures are of (D.date), not of main's last commit $('kicker').textContent = t('page.story.asOf', { date: D.date }); $('title').textContent = t('page.story.title'); $('lede').textContent = t('page.story.lede'); $('cta').textContent = t('page.story.cta'); $('hub').textContent = t('page.story.hub'); $('hint').textContent = t('page.story.hint'); // the first screen's totals are the release's (D.totals: its headline's units, its size figures' sources and bytes), // each dated when the size figures are of an older release than the newest of the page's figures const T0 = D.totals, sizeLate = asOfLate(D.at, D.date); $('tiles').replaceChildren(...[['units', t('page.story.tile.units'), T0.units, num], ['src', t('page.story.tile.sources'), T0.sources, num], ['who', t('page.story.tile.publishers'), T0.publishers, num], ['bytes', t('page.story.tile.size'), T0.bytes, bytesText]].map(([key, name, n, text]) => { const box = el('div'), dd = el('dd'), fig = el('b'); dd.append(fig); box.append(el('dt', '', name), dd); if (n == null) fig.textContent = t('page.story.cover.notCounted'); else { count(fig, key, Number(n), text); if (sizeLate) dd.append(el('small', '', sizeLate)); } return box; })); // step 1: where the units are const three = A.slice(0, 3), threeUnits = three.reduce((a, o) => a + o.units, 0), tones = LARGEST; const parts = [...three.map((o) => [o.title, o.units]), [t('page.story.sources.others', { n: num(A.length - 3) }), total - threeUnits]]; const bar = el('div', 'split'); bar.append(...parts.map(([, u], k) => { const i = el('i'); i.style.background = rgb(tones[k]); i.style.setProperty('--w', `${(u / total * 100).toFixed(2)}%`); return i; })); bar.setAttribute('role', 'img'); bar.setAttribute('aria-label', parts.map(([name, u]) => `${name} ${pct(u, total)}`).join(t('page.figure.sep.comma'))); say(1, t('page.story.sources.kicker'), t('page.story.sources.claim', { share: pct(threeUnits, total) }), bar, rows(parts.map(([name, u], k) => [tones[k], name, pct(u, total), null, k < 3 ? k : 'rest']), false, 1), el('p', 'txt', t('page.story.sources.point'))); // steps 2 and 3: the sources by two standard classifications for (const [k, dim] of [[2, DIMS[0]], [3, DIMS[2]]]) { const z = zones(dim), top = z.filter((g) => g.key[0] === 'c'); say(k, `${t(dim.key)} · ${dim.std} · ${t('page.story.classes.bySources')}`, k === 2 ? t('page.story.subject.claim', { zone: zoneName(dim, top[0].key), share: pct(top[0].n, A.length) }) : t('page.story.rtype.claim', { first: zoneName(dim, top[0].key), second: zoneName(dim, top[1].key) }), rows(z.map((g) => [zoneColor(g.key), zoneName(dim, g.key), num(g.n), g.n / z[0].n, g.key]), false, k)); } // step 4: training use, in units const byPermit = D.permits.map((p, k) => [PERMC[k], named(p), A.reduce((a, o) => a + o.permit[k], 0)]); const allowing = A.filter((o) => o.main === 0).length; say(4, t('page.story.permit.kicker'), t('page.story.permit.claim', { allow: pct(allowing, A.length), unstated: pct(total - stated, total) }), rows(byPermit.map(([c, name, u], k) => [c, name, `${num(u)} · ${pct(u, total)}`, u / total, k]), false, 4), el('p', 'txt', t('page.story.permit.note'))); // step 5: what is labeled const tone = [143, 182, 198]; say(5, t('page.story.cover.kicker'), t('page.story.cover.claim', { fetch: pct(fetchUnits, total), listed: pct(listedUnits, total) }), rows([[tone, t('page.story.cover.fetch'), pct(fetchUnits, total), fetchUnits / total, 'fetch'], [tone, t('page.story.cover.listed'), pct(listedUnits, total), listedUnits / total, 'listed'], [tone, t('page.figure.permit'), pct(stated, total), stated / total, 'stated'], [tone, t('page.figure.classes'), pct(total - looseUnits, total), (total - looseUnits) / total, 'classed'], D.stages ? [tone, t('page.story.cover.stage'), pct(stagedUnits, total), stagedUnits / total, 'staged'] : [tone, t('page.story.cover.stage'), t('page.story.cover.notCounted'), 0, 'none']], false, 5), el('p', 'txt', t('page.story.cover.note', { n: num(indexed.length) }))); // step 6: how a unit reaches a training stage, with each stage's units and, where it is counted by them, its bytes, // each dated when the stage figures are of an older release than the newest of the page's figures const stageLate = D.stages && asOfLate(D.stages.release, D.stages.date); const stageTotal = (x) => (!x || x.units == null ? t('page.story.cover.notCounted') : [units(x.units), x.bytes == null ? null : bytesText(x.bytes), stageLate].filter(Boolean).join(' · ')); say(6, t('page.figure.stages'), t('page.story.stages.claim'), rows(STAGES.map((s, k) => [s.c, `${t(s.key)}${t('page.figure.sep.label')}${t(s.hint)}`, D.stages ? stageTotal(D.stages.stages[k]) : '', null, k]), true, 6), el('p', 'txt', D.stages ? t('page.story.stages.counted', { date: dateOf(D.stages.on) }) : t('page.story.stages.notCounted'))); // the rows were made anew, so none is held; the dots of the steps carry the steps' names pin = null; spot(null); $('rail').setAttribute('aria-label', t('page.story.rail')); $('rail').replaceChildren(...[t('page.story.rail.start'), t('page.story.rail.sources'), t('page.figure.dim.subject'), t('page.figure.dim.rtype'), t('page.figure.permit'), t('page.story.rail.cover'), t('page.figure.stages')].map((t, k) => { const b = el('button'); b.type = 'button'; b.setAttribute('aria-label', t); b.append(el('span', '', t)); if (k === stepNow) b.setAttribute('aria-current', 'step'); b.onclick = () => jump(k); return b; })); // the explorer and what follows $('ex-title').textContent = t('page.explorer.title'); $('ex-sub').textContent = t('page.explorer.sub'); $('side-title').textContent = t('page.explorer.side'); for (const id of ['q1', 'q2']) { $(id).placeholder = t('page.explorer.search'); $(id).setAttribute('aria-label', $(id).placeholder); } $('dl').textContent = t('page.explorer.download'); $('toget').textContent = t('page.explorer.toGet'); // what the units of the charts are: each stage's own count of a source once the stage figures give it (staged), // else every unit a source registers (stageUnits) $('charts-note').textContent = t(A.some((o) => o.staged) ? 'page.explorer.chartsNote' : 'page.explorer.chartsNoteRegistered'); $('get-title').textContent = t('page.get.title'); // the notes, folded: how each number of the story is defined, and the glossary $('notes-title').textContent = t('page.notes.title'); const fold = (title, ...body) => { const d = el('details'); d.append(el('summary', '', title), ...body); return d; }; const link = (href, text) => Object.assign(el('a', '', text), { href }, /^https?:/.test(href) ? { target: '_blank', rel: 'noopener' } : {}); // how each number is defined, with the part it leaves out (Z, the index's size readings; std, the standard of a // classification); every term and the checks are in the manual, each stage's rules here and there const cover = el('table', 'cover'), cb = el('tbody'), Z = D.size, std = (id) => DIMS.find((d) => d.id === id).std; cover.append(cb); const cell = (x) => { const td = el('td', 'why'); td.append(x); return td; }; cb.append(...[ [t('page.notes.size'), t('page.notes.size.how', { units: units(Z.unsized) }) + (lang === 'zh' ? '' : ' ') + t('page.notes.size.check', { read: num(Z.read), compared: num(Z.compared), share: pct(Z.match, Z.compared) })], [t('page.figure.permit'), t('page.notes.permit.how', { tiers: D.permits.length })], [t('page.figure.classes'), t('page.notes.classes.how', { subject: std('subject'), industry: std('industry'), rtype: std('rtype') }) + (loose.length ? t('page.notes.classes.loose', { n: num(loose.length) }) : '')], [t('page.figure.stages'), t('page.notes.stages.how')], ].map(([name, how]) => { const row = el('tr'); row.append(el('td', '', name), cell(how)); return row; })); const head = el('thead'), hr = el('tr'); hr.append(...[t('page.notes.metric'), t('page.notes.definition')].map((t) => el('th', '', t))); head.append(hr); cover.prepend(head); const coverWrap = el('div', 'tablewrap'); coverWrap.append(cover); const more = el('p'); more.append(t('page.notes.more'), link(t('page.notes.moreHref'), t('page.notes.manual')), t('page.figure.period')); more.style.marginTop = '12px'; // the glossary: the terms catalog/terms.yaml marks for this page (glossary), each with its sentence (terms.json); // its name links to the standard that defines it, or to its section of the manual in the reader's language const terms = el('dl', 'terms'); const termHref = (h) => (h.startsWith('#') ? 'manual.html?lng=' + lang + h : h); terms.append(...V.terms.filter((t) => t.glossary).flatMap((t) => { const name = lang === 'zh' ? t.zh : t.term[0].toUpperCase() + t.term.slice(1), dt = el('dt'); dt.append(t.link ? link(termHref(t.link), name) : name); return [dt, el('dd', '', (lang === 'zh' ? t.about_zh : t.about))]; })); // each training stage's rule (catalog/stages.yaml through terms.json), in the order of the page's figures const rules = el('dl', 'terms'); rules.append(...STAGES.flatMap((s, i) => { const r = V.stages.find((x) => x.id === ['pre-training', 'mid-training', 'post-training'][i]); return r ? [el('dt', '', t(s.key)), el('dd', '', lang === 'zh' ? r.about_zh : r.about)] : []; })); // each stage's units by subject (D.stages.subjects): with the sample method, each subject's estimate with its 95% // interval and the line on how it was estimated; counted from every unit's label, the counts alone; the units given // no subject, not sampled or kept out by a rule at the end, and the subjects with no threshold in one line under it const SUB = D.stages && D.stages.subjects, bySubject = []; if (SUB) { const est = SUB.method === 'sample', tb = el('table'), sh = el('thead'), shr = el('tr'), sb = el('tbody'); const ROW_WORDS = { none: 'page.notes.subjects.none', not_sampled: 'page.notes.subjects.notSampled', kept_out: 'page.notes.subjects.keptOut' }; shr.append(el('th', '', t('page.notes.subjects.domain')), ...STAGES.map((s) => el('th', 'num', t(s.key)))); sh.append(shr); tb.append(sh, sb); sb.append(...SUB.rows.map(([zh, en, kind, got]) => { const row = el('tr'), name = el('td'); name.append(ROW_WORDS[kind] ? t(ROW_WORDS[kind]) : kind === 'major' ? el('b', '', lang === 'zh' ? zh : en) : (lang === 'zh' ? zh : en)); row.append(name, ...got.map((x) => el('td', 'num', x == null ? t('page.story.cover.notCounted') : est ? t('page.notes.subjects.range', { units: num(x[0]), low: num(x[1]), high: num(x[2]) }) : num(x[0])))); return row; })); const wrap = el('div', 'tablewrap'); wrap.append(tb); const how = el('p', '', est ? t('page.notes.subjects.sample', { k: new Intl.NumberFormat(lang === 'zh' ? 'zh-CN' : 'en').format(SUB.k) }) : null); how.style.marginTop = '12px'; const bare = el('p', '', SUB.no_threshold.length ? t('page.notes.subjects.noThreshold', { subjects: SUB.no_threshold.map(([zh, en]) => (lang === 'zh' ? zh : en)).join(lang === 'zh' ? '、' : ', ') }) : null); bare.style.marginTop = '12px'; bySubject.push(fold(t('page.notes.subjects'), wrap, ...(est ? [how] : []), ...(SUB.no_threshold.length ? [bare] : []))); } $('notes-list').replaceChildren( ...bySubject, fold(t('page.notes.methodology'), coverWrap, more), fold(t('page.notes.stages.rules'), rules), fold(t('page.notes.glossary'), terms)); $('foot').replaceChildren(t('page.notes.foot.data'), link(HUB, 'Battam/training-data-foundation'), t('page.notes.foot.use'), link(t('page.notes.foot.manualHref'), t('page.notes.manual')), t('page.notes.foot.names')); if (picture) picture.label(); } /** What follows the selection: the explorer and how to get the selected data. */ function render() { const sel = A.filter((o) => pass(o)), selUnits = sel.reduce((a, o) => a + unitsOf(o), 0); // a selection of every source and every unit: its units are the total the first screen shows, and are not shown // again const whole = sel.length === A.length && !state.permit.length && !state.picks.length; seg($('views'), t('page.explorer.view'), [['graph', t('page.explorer.view.charts')], ['table', t('page.explorer.view.table')]], state.view, (id) => { state.view = id; render(); }); seg($('metrics'), t('page.explorer.measure'), [['units', t('page.figure.unitCount')], ['sources', t('page.explorer.measure.sources')]], state.metric, (id) => { state.metric = id; render(); }); $('metric-cap').textContent = t('page.explorer.measure.caption'); // the selection in words, each filter a chip that removes it const meta = [el('span')]; meta[0].append(t('page.figure.selected'), el('b', '', srcs(sel.length)), ...(whole ? [] : [t('page.figure.sep.comma'), el('b', '', units(selUnits))])); const chip = (text, undo) => { const b = el('button', 'chip', `${text} ×`); b.type = 'button'; b.title = t('page.explorer.chip.remove'); b.onclick = () => { undo(); state.page = 0; render(); }; meta.push(b); }; for (const dim of DIMS) for (const k of state[dim.id]) chip(`${t(dim.key)}${t('page.figure.sep.label')}${named(dim.names[k])}`, () => { state[dim.id] = state[dim.id].filter((x) => x !== k); }); if (state.q) chip(`${t('page.explorer.chip.search')}${t('page.figure.sep.label')}${state.q}`, () => { state.q = ''; $('q1').value = $('q2').value = ''; }); // the sources ticked: a chip each, or one for them all past three if (state.picks.length > 3) chip(t('page.explorer.chip.ticked', { n: num(state.picks.length), sources: srcs(state.picks.length) }), () => { state.picks = []; }); else for (const o of state.picks) chip(`${t('page.explorer.chip.tick')}${t('page.figure.sep.label')}${o.title}`, () => { toggle(o); }); if (meta.length > 2) { const all = el('button', 'link', t('page.explorer.clear')); all.type = 'button'; all.onclick = () => { for (const dim of DIMS) state[dim.id] = []; state.picks = []; state.q = ''; $('q1').value = $('q2').value = ''; state.page = 0; render(); }; meta.push(all); } $('meta').replaceChildren(...meta); $('graph').hidden = state.view !== 'graph'; $('table').hidden = state.view !== 'table'; if (state.view === 'graph') { $('charts').replaceChildren(...DIMS.map(chart)); // the sources of the selection, the largest first, and the one picked const list = sel.slice(0, state.more).map((o) => { const li = el('li'), b = el('button'); b.type = 'button'; b.setAttribute('aria-pressed', String(state.picks.includes(o))); b.append(el('span', '', o.title), el('b', '', num(unitsOf(o)))); b.onclick = () => { toggle(o); render(); }; li.append(b); return li; }); if (sel.length > state.more) { const li = el('li'), b = el('button'); b.type = 'button'; b.append(el('span', '', t('page.explorer.more', { n: num(sel.length) }))); b.onclick = () => { state.more += 60; render(); }; li.append(b); list.push(li); } if (!list.length) list.push(el('li', 'empty', t('page.figure.noMatch'))); $('list').replaceChildren(...list); // the card of the source ticked last const o = state.picks[state.picks.length - 1]; if (o) { const box = el('div', 'picked'), dl = el('dl'), what = el('p', '', about(o)), undo = el('button', 'link', t('page.explorer.picked.clear')); if (lang === 'zh' && !o.zh) what.lang = 'en'; const row = (k, v) => dl.append(el('dt', '', k), el('dd', '', v)); row(t('page.figure.publisher'), o.who || t('page.figure.notStated')); row(t('page.figure.unitCount'), num(o.units)); row(t('page.figure.size'), size(o)); for (const dim of PARTS) row(t(dim.key), classes(o, dim)); row(t('page.figure.permit'), named(D.permits[o.main])); undo.type = 'button'; undo.onclick = () => { toggle(o); render(); }; box.append(el('b', '', o.title), what, dl, undo); $('picked').replaceChildren(box); } else $('picked').replaceChildren(); } else { const [by, dir] = state.sort, col = COLS.find((c) => c.id === by); const sorted = sel.slice().sort((a, b) => { const x = col.key(a), y = col.key(b); return (typeof x === 'string' ? x.localeCompare(y) : x - y) * dir; }); const per = 20, pages = Math.max(1, Math.ceil(sorted.length / per)); state.page = Math.min(state.page, pages - 1); const shown = sorted.slice(state.page * per, state.page * per + per); // a box a row to tick it, and one in the head for every row of the page const tick = (on, label, act) => { const box = el('input'); box.type = 'checkbox'; box.checked = on; box.setAttribute('aria-label', label); box.onclick = (e) => e.stopPropagation(); box.onchange = act; return box; }; const every = shown.length > 0 && shown.every((o) => state.picks.includes(o)), head = el('th', 'pick'); const all = tick(every, t('page.explorer.table.tickAll'), () => { if (every) state.picks = state.picks.filter((o) => !shown.includes(o)); else for (const o of shown) if (!state.picks.includes(o)) state.picks.push(o); render(); }); all.indeterminate = !every && shown.some((o) => state.picks.includes(o)); head.append(all); $('thead').replaceChildren(head, ...COLS.map((c) => { const th = el('th', c.numeric ? 'num' : ''), b = el('button', '', `${t(c.name)}${by === c.id ? (dir > 0 ? ' ↑' : ' ↓') : ''}`); b.type = 'button'; b.title = t('page.explorer.table.sort'); th.setAttribute('aria-sort', by === c.id ? (dir > 0 ? 'ascending' : 'descending') : 'none'); b.onclick = () => { state.sort = [c.id, by === c.id ? -dir : c.numeric ? -1 : 1]; state.page = 0; render(); }; th.append(b); return th; })); $('tbody').replaceChildren(...shown.map((o) => { const row = el('tr'), src = el('td', 'src'), what = el('span', '', about(o)), on = state.picks.includes(o), cell = el('td', 'pick'); if (lang === 'zh' && !o.zh) what.lang = 'en'; src.append(el('b', '', o.title), what, el('small', '', o.who || '')); cell.append(tick(on, t('page.explorer.table.tick', { title: o.title }), () => { toggle(o); render(); })); row.setAttribute('aria-selected', String(on)); row.onclick = () => { toggle(o); render(); }; row.append(cell, src, el('td', '', classes(o, DIMS[0])), el('td', '', classes(o, DIMS[2])), el('td', '', named(D.permits[o.main])), el('td', 'num', num(unitsOf(o))), el('td', 'num', size(o))); return row; })); if (!sorted.length) { const row = el('tr'), td = el('td', 'empty', t('page.figure.noMatch')); td.colSpan = COLS.length + 1; row.append(td); $('tbody').replaceChildren(row); } const prev = el('button', '', t('page.explorer.table.prev')), next = el('button', '', t('page.explorer.table.next')); prev.type = next.type = 'button'; prev.disabled = state.page === 0; next.disabled = state.page >= pages - 1; prev.onclick = () => { state.page--; render(); }; next.onclick = () => { state.page++; render(); }; $('pager').replaceChildren(el('span', '', t('page.explorer.table.page', { page: state.page + 1, pages: pages, n: num(sorted.length), sources: srcs(sorted.length) })), prev, next); } // how to get the selection: the source picked, else the filters; trainOnly, the one license filter the fetch // tool has; asks, the selection in the words of the sentence for an AI agent const flags = [], asks = [], trainOnly = state.permit.length === 1 && state.permit[0] === 0; // chosen: the sources the command names one by one (null: every source the filters let through) let wide = false, chosen = null; const picks = state.picks; const quoted = (names) => names.map((name) => t('page.get.say.quoted', { name })).join(t('page.get.say.or')); if (picks.length) { chosen = picks; asks.push(t('page.get.say.picks', { count: picks.length, ids: picks.map((o) => o.id).join(t('page.get.say.sep')) })); } else { // the fetch tool has no option for these three classifications yet: a selection of a few sources names them // one by one, a larger one is left to the agent, which reads the catalog; a selection by training stage names // its sources one by one, however many, as each row of the page carries its source's stages for (const dim of CLASSED) if (state[dim.id].length) { const gs = state[dim.id].map((k) => dim.names[k]); asks.push(t('page.get.say.dim', { dim: t(dim.key).toLowerCase(), list: quoted(gs.map((g) => (lang === 'zh' ? g[1] : g[3]))) })); } if (state.stage.length || (asks.length && sel.length <= 12)) chosen = sel; else if (asks.length) wide = true; if (trainOnly) { flags.push('--training-only'); asks.push(t('page.get.say.trainingOnly')); } else if (state.permit.length) asks.push(t('page.get.say.license', { list: quoted(state.permit.map((k) => named(D.permits[k]))) })); } const got = picks.length ? picks : sel, gotUnits = picks.length ? picks.reduce((a, o) => a + o.units, 0) : selUnits, bytes = got.reduce((a, o) => a + o.bytes, 0); // the selection by how its units are fetched: by their rows, through their upstream's index, not yet const scope = chosen || got, byRow = scope.filter((o) => o.fetch === 1), viaIndex = scope.filter((o) => o.fetch === 2), later = scope.filter((o) => o.fetch === 0); $('sel').replaceChildren(picks.length ? t('page.get.ticked') : t('page.figure.selected'), el('b', '', picks.length === 1 ? picks[0].title : srcs(got.length)), ...(whole ? [] : [t('page.get.sel.total'), el('b', '', units(gotUnits)), ...(bytes ? [t('page.get.sel.size'), el('b', '', bytesText(bytes * scaleBytes))] : [])]), t('page.figure.period'), ...(later.length ? [t('page.get.sel.later', { n: num(later.length), sources: srcs(later.length), units: units(later.reduce((a, o) => a + o.units, 0)) })] : []), t('page.get.sel.skipped')); // what the command line cannot say of the selection: its tab then says so and gives no command, which would fetch // more than the selection, or other units const why = chosen && !byRow.length && !viaIndex.length ? t('page.get.why.picked') : picks.length ? '' : wide ? t('page.get.why.classes') : state.permit.length && !trainOnly ? t('page.get.why.license') : ''; const bare = state.how === 'cmd' && !!why; $('how').setAttribute('aria-label', t('page.get.how')); $('how').replaceChildren(...[['say', t('page.get.how.say')], ['cmd', t('page.get.how.cmd')]].map(([id, name]) => { const b = el('button', '', name); b.type = 'button'; b.setAttribute('role', 'tab'); b.setAttribute('aria-selected', String(id === state.how)); b.onclick = () => { state.how = id; render(); }; return b; })); $('say').hidden = state.how !== 'say'; $('cmd').hidden = state.how !== 'cmd' || bare; $('copy').hidden = bare; $('how-note').textContent = state.how === 'say' ? t('page.get.note.say') : why || t('page.get.note.cmd'); $('copy').textContent = t('page.get.copy'); // every unit of the selection: --all turns off the tool's default profile (English only, files up to 20 MB, one // copy of each content) and keeps its benchmark criteria on; the units of a source read through its upstream's // index come by a command of their own, as --select reads only such sources (without it the tool takes their index // files). The index's main: the commit this page was made from or a later one, so every source listed is there, // and the tool prints the commit it read, which --revision takes to fetch the same units again const base = [`uv run ${HUB}/resolve/main/tools/fetch.py`], cmds = []; if (!chosen || byRow.length) cmds.push([...base, '--all', ...(chosen ? byRow.map((o) => `--source ${o.id}`) : []), ...flags, '--out ./data']); if (viaIndex.length) cmds.push([...base, ...viaIndex.map((o) => `--source ${o.id}`), '--select true', '--out ./data']); $('cmd').textContent = cmds.map((c, k) => (cmds.length > 1 ? `${k ? t('page.get.cmd.viaIndex') : t('page.get.cmd.byRow')}\n` : '') + c.join(' \\\n ')).join('\n\n'); $('say').textContent = t('page.get.say', { doc: DOC, filters: asks.length ? t(/[\x21-\x7e]$/.test(asks[asks.length - 1]) ? 'page.get.say.filtersAscii' : 'page.get.say.filters', { list: asks.join(t('page.get.say.sep')) }) : '' }); } $('copy').addEventListener('click', async () => { const node = state.how === 'say' ? $('say') : $('cmd'); try { await navigator.clipboard.writeText(node.textContent); } catch { const r = document.createRange(); r.selectNodeContents(node); const s = getSelection(); s.removeAllRanges(); s.addRange(r); } $('copy').textContent = t('page.get.copied'); setTimeout(() => { $('copy').textContent = t('page.get.copy'); }, 1400); }); for (const id of ['q1', 'q2']) $(id).addEventListener('input', (e) => { state.q = e.target.value.trim().toLowerCase(); $(id === 'q1' ? 'q2' : 'q1').value = e.target.value; state.page = 0; state.more = 60; render(); }); for (const b of $('lang').children) b.onclick = () => { lang = b.dataset.lang; try { localStorage.setItem('lang', lang); } catch { /* the choice lasts for this visit */ } renderStatic(); render(); }; let wideNow = innerWidth; addEventListener('resize', () => { if (Math.abs(innerWidth - wideNow) > 40) { wideNow = innerWidth; render(); } }); renderStatic(); render(); const stepsAll = [...document.querySelectorAll('.step')]; const go = (k) => { if (k !== stepNow) { pin = null; for (const x of document.querySelectorAll('.rows .pin, .rows.held, .rows .hot')) x.classList.remove('pin', 'held', 'hot'); for (const x of document.querySelectorAll('.rows [aria-pressed="true"]')) x.setAttribute('aria-pressed', 'false'); } stepNow = k; $('story').dataset.step = k; stepsAll.forEach((s, j) => s.classList.toggle('on', j === k)); [...$('rail').children].forEach((b, j) => (j === k ? b.setAttribute('aria-current', 'step') : b.removeAttribute('aria-current'))); if (picture) picture.show(k); }; // The step the picture shows is read from where the page is scrolled to, and from nothing else: the last card whose // top has come up past a line of the screen (two thirds down; four fifths where the cards rest at the bottom of a // narrow screen). So the words and the picture cannot part, whichever way and however fast the page is moved. const cards = stepsAll.map((s) => s.querySelector('.say')); let placing = false; const place = () => { placing = false; const line = innerHeight * (innerWidth > 900 ? 0.66 : 0.8); let k = 0; cards.forEach((c, j) => { if (c.getBoundingClientRect().top <= line) k = j; }); if (k !== stepNow) go(k); }; addEventListener('scroll', () => { if (!placing) { placing = true; requestAnimationFrame(place); } }, { passive: true }); addEventListener('resize', place); // to a step at once: its card in the middle of a wide screen, or just under the picture of a narrow one const jump = (k) => { const r = cards[k].getBoundingClientRect(), at = innerWidth > 900 ? Math.max(70, (innerHeight - r.height) / 2) : $('stage').clientHeight + 14; scrollTo({ top: Math.max(0, r.top + scrollY - at), behavior: 'instant' }); place(); }; go(0); place(); // the paper's sections come in as they are reached const seenIo = new IntersectionObserver((es) => { for (const e of es) if (e.isIntersecting) { e.target.classList.add('in'); seenIo.unobserve(e.target); } }, { rootMargin: '0px 0px -12% 0px' }); document.querySelectorAll('.reveal').forEach((n) => seenIo.observe(n)); document.body.classList.add('ready'); // for a look from a script: the language, a setting, a filter, a source, a step of the story window.__page = { lang: (l) => { lang = l; renderStatic(); render(); }, set: (k, v) => { state[k] = v; render(); }, filter: (dim, code) => { const s = state[dim]; if (code == null) s.length = 0; else { const k = DIMS.find((x) => x.id === dim).names.findIndex((g) => g[0] === code), i = s.indexOf(k); if (i < 0) s.push(k); else s.splice(i, 1); } render(); }, pick: (id) => { const o = A.find((x) => x.id === id); if (o) toggle(o); render(); }, step: jump, open: (id) => { if (picture) picture.open(A.find((o) => o.id === id) || null); }, }; } </script> </body> </html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>Training Data Foundation</title>
<meta name="description" content="Every source of the Training Data Foundation's public index of real public data for pre-training, mid-training and post-training, sorted by recognized standards, with the one command that fetches what you select.">
<link rel="icon" href="data:,">
<link rel="alternate" type="text/plain" href="llms.txt" title="For agents">
<meta name="color-scheme" content="light dark">
<link rel="preload" href="locales/en.json" as="fetch" crossorigin>
<link rel="preload" href="locales/zh.json" as="fetch" crossorigin>
<!-- the data page: a story told by scrolling over one picture of the sources, then the explorer and the command;
its data files are written at each deploy (03_data_line/steps/portal.py): sources.json from the index commit it
shows (sources_screen), and terms.json, the terms and stage rules of meta/vocabulary.json, from
catalog/terms.yaml and catalog/stages.yaml (vocabulary_files), whose glossary terms the notes show; each stage's
rules and every term are in the user manual, a page of its own, manual.html; the page's words are read from
locales/en.json and locales/zh.json through i18n.js -->
<style>
/* layout: a story told by scrolling, then the tools. The page opens on a dark stage that stays in place while the
reader scrolls: one picture of glowing points in three dimensions, a cluster a source, which regroups at every step
of the text beside it (the sources, their subjects, their resource types, their training use, label coverage, how a
unit reaches a training stage). After the story, on paper: the explorer (charts and a table that filter each
other), how to get the data, and the notes folded away. The paper, the display face and
the accent are the reference style's; the stage is dark in both themes, so its colors are fixed. */
:root {
--bg: #f6f4ef; --panel: #fffdf9; --soft: #f0ede5; --ink: #1b1915; --ink2: #4c4840; --muted: #6b655a;
--line: #e3ddd1; --line2: #cfc7b7; --accent: #24414f; --accent2: #3d6a7d; --on-accent: #ffffff; --tint: #e6edef;
--bar: #3d6a7d; --bar-off: #d9d3c6; --bar-hot: #24414f; --hot: #c8702a;
--shadow: 0 1px 2px rgba(27, 25, 21, .05), 0 8px 28px rgba(27, 25, 21, .06);
--serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
--sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
--mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
--bg: #121110; --panel: #1b1a18; --soft: #24221f; --ink: #f0ede6; --ink2: #c9c3b6; --muted: #9a9488;
--line: #2f2c28; --line2: #403c36; --accent: #a8c7d4; --accent2: #7fa9ba; --on-accent: #10181c; --tint: #1f2a2e;
--bar: #7fa9ba; --bar-off: #3a3631; --bar-hot: #d3e8f0; --hot: #f0a45c;
--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25); color-scheme: dark; } }
:root[data-theme="dark"] {
--bg: #121110; --panel: #1b1a18; --soft: #24221f; --ink: #f0ede6; --ink2: #c9c3b6; --muted: #9a9488;
--line: #2f2c28; --line2: #403c36; --accent: #a8c7d4; --accent2: #7fa9ba; --on-accent: #10181c; --tint: #1f2a2e;
--bar: #7fa9ba; --bar-off: #3a3631; --bar-hot: #d3e8f0; --hot: #f0a45c;
--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25); color-scheme: dark; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.62 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent2); }
button, input { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 1200px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; text-wrap: balance; margin: 0; }
/* the bar on top: on the stage's dark, as the page opens there */
.top { position: absolute; left: 0; right: 0; top: 0; z-index: 3; color: #e8eef1; }
.top .wrap { display: flex; align-items: center; gap: 8px 26px; min-height: 58px; flex-wrap: wrap; padding-block: 8px; max-width: none; padding-inline: max(16px, 5vw); }
.brand { display: flex; align-items: baseline; gap: 10px; color: inherit; text-decoration: none; white-space: nowrap; }
.brand b { font: 400 20px/1 var(--serif); }
.brand span { font-size: 12.5px; color: #9fb6c1; letter-spacing: .1em; text-transform: uppercase; }
.links { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-right: auto; }
.links a { color: inherit; text-decoration: none; font-size: 14.5px; opacity: .82; }
.links a:hover { opacity: 1; text-decoration: underline; }
.lang { display: flex; border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; overflow: hidden; }
.lang button { border: 0; background: none; padding: 3px 12px; font-size: 13px; color: #b9c9d1; cursor: pointer; }
.lang button[aria-pressed="true"] { background: #e8eef1; color: #0b1419; }
/* the story: the stage stays, the steps scroll over it */
.story { position: relative; background: #0b1419; color: #e8eef1; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: radial-gradient(120% 90% at 68% 46%, #12242d 0%, #0b1419 62%); }
.gl, .labels { position: absolute; inset: 0; }
.gl canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.labels { pointer-events: none; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; line-height: 1.3; color: #eef3f5; white-space: nowrap; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); opacity: 0; }
.tag i { flex: none; width: 9px; height: 9px; border-radius: 50%; }
.tag small { font-size: 12.5px; font-weight: 400; color: #b9c9d1; font-variant-numeric: tabular-nums; }
.wire { position: absolute; left: 0; top: 0; height: 1px; background: rgba(190, 208, 216, .6); transform-origin: 0 0; opacity: 0; }
@keyframes come { from { opacity: 0; } to { opacity: 1; } }
/* where the reader is in the story: a dot a step, at the right edge; a click goes there */
.rail { position: absolute; right: max(8px, 1.4vw); top: 50%; z-index: 2; display: grid; gap: 2px; transform: translateY(-50%); }
.rail button { position: relative; width: 22px; height: 22px; border: 0; padding: 0; background: none; cursor: pointer; }
.rail button::before { content: ''; position: absolute; left: 8px; top: 8px; width: 6px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .32); transition: top .3s, height .3s, background .3s; }
.rail button:hover::before, .rail button:focus-visible::before { background: rgba(255, 255, 255, .75); }
.rail button:focus-visible { outline: 1.5px solid #8fb6c6; outline-offset: -3px; border-radius: 6px; }
.rail button[aria-current='step']::before { top: 3px; height: 16px; background: #f4f7f8; }
.rail button span { position: absolute; right: 26px; top: 50%; transform: translateY(-50%); padding: 2px 8px; border-radius: 6px; background: rgba(12, 23, 29, .92); color: #e8eef1; font-size: 12.5px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .2s; }
.rail button:hover span, .rail button:focus-visible span { opacity: 1; }
.tip { position: absolute; left: 0; top: 0; z-index: 3; max-width: 300px; padding: 8px 11px; border-radius: 9px; background: rgba(244, 247, 248, .97); color: #14191d; font-size: 13px; line-height: 1.45; pointer-events: none; box-shadow: 0 6px 22px rgba(0, 0, 0, .4); }
.tip b { display: block; font-size: 14px; }
.tip span { display: block; color: #3f4a53; }
/* the source a click picked: a ring on its cluster, and a card that says what it is */
.halo { position: absolute; left: 0; top: 0; width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 1.5px solid #f4f7f8; border-radius: 50%; box-shadow: 0 0 14px rgba(244, 247, 248, .55); pointer-events: none; }
.src-card { position: fixed; right: max(16px, 5vw); bottom: 46px; z-index: 3; pointer-events: auto; width: min(340px, calc(100% - 32px)); padding: 14px 16px 12px; border-radius: 14px; background: rgba(12, 23, 29, .96); border: 1px solid rgba(255, 255, 255, .16); font-size: 13.5px; line-height: 1.5; color: #c3d0d6; animation: come .35s both; }
.src-card b { display: block; padding-right: 24px; font-size: 15px; color: #f4f7f8; }
.src-card p { margin: 4px 0 8px; overflow-wrap: anywhere; }
.src-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 1px 12px; margin: 0 0 8px; }
.src-card dt { color: #9fb6c1; }
.src-card dd { margin: 0; text-align: right; color: #e8eef1; font-variant-numeric: tabular-nums; }
.src-card .link { color: #a8c7d4; }
.src-card .shut { position: absolute; right: 8px; top: 6px; border: 0; padding: 4px 7px; background: none; color: #b9c9d1; font-size: 18px; line-height: 1; cursor: pointer; }
.stage-note { position: absolute; right: max(16px, 5vw); bottom: 14px; margin: 0; max-width: 32em; font-size: 12.5px; color: #8fa3ad; text-align: right; }