Battam commited on
Commit
8625bc8
·
verified ·
1 Parent(s): 6d166fc

portal: data page of repository commit 5b2c299894d9

Browse files

Files of catalog/portal/ (29), digest 92cf7d2e1df52c87f209e31b8f497d006a119083ed0d96d8a2483e843732df60.

Files changed (12) hide show
  1. README.md +58 -30
  2. app.js +387 -185
  3. data.js +109 -31
  4. first.js +131 -37
  5. first.json +85 -85
  6. index.html +40 -15
  7. linked.js +39 -17
  8. llms.txt +5 -5
  9. locales/en.json +61 -24
  10. locales/zh.json +56 -16
  11. portal.json +3 -3
  12. style.css +4 -2
README.md CHANGED
@@ -17,7 +17,7 @@ The data page of the Training Data Foundation, a static page into its public ind
17
  real public data for pre-training, mid-training and post-training, each file with its address, size, hashes and license, fetched with one command.
18
  #2422: the dataset card is the overview;
19
  this page is where data is picked and taken, in three parts.
20
- Its first screen is a working screen (second round, "Strata"; section The working screen): the field, a WebGL scene with every source of the index as one point, is the ground, and on it float the name, that sentence and the training stages of the stage table `catalog/stages.yaml` as a column, each with what it can use (the release's `meta/stage_figures.json`; a click on one sets the filter by stage), the filters (the domain, the form, the size, the training permit, the personal-data mark and the file type), the count of the selection with its largest sources, and the one command that takes it.
21
  The sources follow: the material sets or corpora of the selection with their fit, their details and a preview of their rows, then the domain × form map with the bars by domain and by form for one layer at a time (linked: a click on one filters the others, the list and the field).
22
  Get the data gives the selection's one command, what it writes, what the default profile of the fetch tool leaves out with the flag that takes each back, and the selection file.
23
  The Space card says the first sentence in short (`short_description`, at most 60 characters, https://huggingface.co/docs/hub/spaces-config-reference).
@@ -93,8 +93,8 @@ The index's dataset card and the domain pages of `docs/sources.md` keep the two
93
  One pair of names is used everywhere: "corpus" and "corpora", "material set" and "material sets"
94
  (in Chinese the two names that `locales/zh.json` has for them, `kind.corpus` and `kind.material_set`).
95
  #1577: one word per concept in each language, the same as in the index's docs: a source is "source" (in Chinese the
96
- word of `col.title`; never "data source"), its card the card (`cards/<source>.yaml`, never a second word for the
97
- source itself), a domain "domain" (in Chinese the word of `filter.domain`; never
98
  "category"), and the redistribution permit "redistribution" (in Chinese the word of `chip.redistribution`; never
99
  "shipping", which names the card field `license.ship`).
100
  No number and no heading counts "sources" over both layers.
@@ -186,19 +186,19 @@ shows the stages before the whole index is read.
186
 
187
  | File | Read | Fields used |
188
  |---|---|---|
189
- | `meta/catalog.parquet` | at load; then loaded whole into DuckDB-WASM as the table `catalog` | `source`, `title`, `summary`, `description`, `status`, `status_reasons`, `kind` (when published), `collection` (when published), `domain`, `form` (when published), `license` (`spdx`, `tier`, `note`, `ship`), `contamination` (`level`, `benchmark`, `scope`; level `not scanned` reads as not known), `pii` (`level`, `evidence`), `files`, `license_counts` (when published: per material set `kind`, `upstream` or `index` for the files the index wrote under `campaign_files/`, `spdx`, `training_ok`, `redistribution_ok` and `files`, counted by the projection over all its rows), `bytes`, `distinct_bytes` (when published), `unsized_rows`, `fetch_check` (when published, #1577: `level`, `rows`, `fetched`, `read_at`; #2006: named `fetch` up to `release-2026-11-09.1`, which the page reads when the commit has no `fetch_check`), `unit`, `top_types`, `needs_auth`, `data_files` (when published, #1746: the selection's SQL takes the data files from it; a commit without it names its files nowhere but in their paths, which the query does not read), `batch_files` (when published, #1769: the data files that hold each batch of a source, the page's list of a source's files and batches; #1792: with `first` and `last`, the source's first and last row in that file, the row range the page reads; without it, `data_files` with no batches), `released_in` (when published, #1928: the release tag of the release whose record of the source its rows come from; the source's page names it), `held_back` (when published, #1928: why a newer batch of the source is held back, in the words of the release notes, while it keeps its newest version that passed every check; the source's page shows it, #2674: as one sentence in the page's language, what waits and what stays published, with those words in a closed block), `upstream_kind`, `upstream_agent`, `upstream_entry` (when published, #2588: the source's declared upstream, a dataset or a catalog with its agent and entry address, the values joined by ` \| ` while it reads several; the source's page shows each upstream on a line of its own) |
190
  | `meta/attribution.parquet` | when the attribution file is made, when the commit has it (#1577) | `source`, `publisher`, `license`, `license_url`, `files` |
191
  | `meta/size_figures.json` | at load, when the commit has it | per layer (`layers`) and per source (`sources`): `distinct_bytes` (#2422: the one size the page shows), `unsized_rows`, `check` (`rows`, `compared`, `match`, `unreachable`, `gone`, `needs_auth`, `no_length`, `error`), `estimate` (`bytes`, `low`, `high`, `readings`, `rows`) |
192
  | `meta/sources.json` | at load | per source: `license_rows` (training and redistribution, rows per value), `license` (`name`, `statement`, `attribution`, `url`), `by_ext`, `size_quantiles_upper_bytes` |
193
- | `meta/coverage.json` | at load | `by_license.training_ok` (rows per value); `projections.leaves.by_leaf` (per leaf `domain`, `name`, `zh`, `material_sets`, `units`: the leaves with the fewest units under the map) |
194
  | `meta/batches.parquet` | at load | `source`, `batch`, `rows`, `status` |
195
- | `meta/vocabulary.json` | at load, when the commit has it | `domains[].code`, `name`, `zh`, `parent`; `forms[].id`, `zh`; `layers[].kind`, `name`, `zh`; `relation.about`, `zh`; `collections[].code`, `name`, `zh`, `about`, `campaigns` |
196
  | the data files the catalog names for a source (`batch_files`) | on demand | `source`, `batch`, `uri`, `range_offset`, `range_length`, `member_path`, `size_bytes`, `sha256`; only the source's row range in each file (#1792: `first` to `last` of `batch_files`, the whole file when the catalog has none), of which only the rows whose `source` (and `batch`, for the row count of a batch that `meta/batches.parquet` does not list) is the source's, since a file may hold rows of other sources |
197
  | `@huggingface/hub`: `datasetInfo` of the revision and `pathsInfo` of a source's data files at the commit | at load, on demand | the file list of the commit; the date of the last commit of each batch, the latest among the files that hold it |
198
  | `meta/preview.parquet` | the first time a row's "Preview" or a material set's detail opens; then loaded whole into DuckDB-WASM as the table `preview` | the rows of that source (`source` = its id), every column that has a value in one of them; in the detail, the first file of a unit of a material set (`extra` `source_meta.unit_group`, or a row of no collection) |
199
  | `meta/projection.json` | at load, when the commit has it | `tag`, the release tag the page's commands name and (#2422), with `date`, the release line of the first screen |
200
- | `meta/stage_figures.json` (#2006, #2518: of the commit the page reads, written by the release's projection) | at load, when the commit has it | `counted` (whether the release has counted its stage fields), `version` (of the stage table), `stages` (`id`, `name`, `zh`, `status`, `about`, `counted_by`, `counts`, `funnel`, the first screen's tiles), #2629 `no_stage` (per layer what no stage counts by reason, the band under the tiles; a release before #2629 has none), `sources` (per source the ids of the stages one of its units passes; a release before #2518 has none) |
201
- | `meta/stage_figures.json` (#2066) | #2422: as soon as the commit is known (`first.js`), and at load, when the commit has it | per stage of `stages`, in the stage table's order: `id`, `name`, `zh`, `status`, `counted_by`, `counts` and (#2629) `funnel` (each null before the release counted the stage fields), what the first screen says it can use and its funnel; `release` and `date`, the release line until the index is read |
202
  | `meta/translations.parquet` (#2066: the table of Chinese names #2065 writes with the release) | at load, when the commit has it | `en` (an English text the index shows: a collection's name, a source's title or description as the catalog holds them) and `zh` (its Chinese text) |
203
  | `meta/labels.json` (the labels of corpus units) | at load, when the commit has it | `model`; per leaf (`leaves`) `threshold`, `units` (the units at or above the threshold) and `by_class` (those units by class), the table of units by leaf; per source (`sources`) its units at or above each leaf's threshold, its detail |
204
  | `labels/<source>/*.parquet` (found in the commit's file list, no folder listed) | when the detail of a labelled corpus opens | `unit_id`, `leaf`, `score`, `class` of the first 200 rows of its first file: the labels of its first units |
@@ -247,8 +247,10 @@ Maps from code to name, and nested `children`, are read too.
247
  | `rev=<sha or branch>` | read another commit of the dataset |
248
  | `catalog=<url>` | read the catalog from this URL (parquet, or JSON: a list of rows) instead of `meta/catalog.parquet` |
249
  | `vocabulary=<url>` | read the names of domains and forms, and the requirements of the not-included categories, from this URL instead of `meta/vocabulary.json` |
 
250
  | `kind` | the layer Pick shows: `material_set` (the default) or `corpus`; #2422: a `stage` takes its own |
251
  | `domain`, `leaf`, `form`, `collection`, `train`, `redist`, `tier`, `size`, `status`, `q`, `ext`, `stage`, `pii` | the filters (`collection`: a line code of `admit_collections.tsv`, material sets only; `train` and `redist`: `yes` for every row allowed, `cond` for allowed or with conditions; `size`: the class of the deduplicated size, `lt1g`, `1g1t`, `ge1t` or `unknown`; `status`: a catalog status, such as `flagged`; `ext`: the selected file types, joined by commas; `stage`: the id of a training stage of the stage table, such as `post-training`; #2422: `pii`, the personal-data mark, `none`, `marked` or `unknown`) |
 
252
  | `pick` | the picked sources, their ids joined by commas (#1286); while any is picked, "Get the data" takes exactly them |
253
  | `sample` | how many units "Get the data" takes from each source: `1`, `3`, `10`, `30` or `all` (#1524); #2629: without it, `all` when the command takes material sets and `3` when it takes corpora |
254
  | `metric`, `sort`, `dir`, `open` | what the charts of material sets count (`sets`, the default, or `units`; corpora are counted in rows), the sort of the list (default: fit), the open source |
@@ -256,9 +258,26 @@ Maps from code to name, and nested `children`, are read too.
256
  | `lng=<en or zh>` | open the page in English or in Simplified Chinese (and keep that choice) |
257
 
258
  #2422: the filters are in the left panel of the working screen: the training stage is set by its band of the column
259
- above them (its select stays in the page, out of sight), then the search box, the domain, the form, the size, the
260
- training permit, the personal-data mark and the file type (an HTML `details` element, closed at first and opened when
261
- a type is checked, its summary saying how many are).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  The training permit and the personal-data mark are labels every source carries (what all its rows allow for training,
263
  `license_rows` of `meta/sources.json`; the `pii.level` of its card in the catalog, present or suspected, none found, or
264
  not judged yet):
@@ -298,11 +317,13 @@ Its options name each stage in the page's language (its `zh` in Chinese), a prov
298
  on hover, the selected stage's condition (#2066: in Chinese its text in the table of Chinese names, once the release has it) and the version of the table the stages were computed with.
299
  A selection by stage takes its sources by `--source`, under the default profile, and the SQL tab names them by id.
300
  #2422: the first screen is the stages of the release's `meta/stage_figures.json`, in the stage table's order, each a tile (`first.js` `drawStages`) drawn as the dataset card's stage figure: its pictogram, its name in the page's language, the mark of a provisional stage (by its status in the figures; pre-training and mid-training while the stage table says so), and what it can use, one large number and one line under it:
301
- a stage counted in bytes says its size (the size after deduplication, so the page's one size) over its corpus rows, one counted in units its units over its material sets (`stageWhat`).
302
- #2629: under them each tile has its funnel (`funnel` of the stage's figures) in the measure of its large number: what meets the stage's condition, then what each rule of `rules` removes (a rule that removes nothing left out), which ends at that number (`first.js` `funnelSteps`).
303
- The last band, "In no stage" (`strata.rest`; no button), gives for the layer shown what no stage counts (`app.js` `restWhat`, from `no_stage` of the figures, which the release counts, `artpool.stages`): its material sets or corpora as the large number, its units or corpus rows in the line under it, and the material sets or corpora by reason under them (did not meet the condition, each rule, not counted yet: in the catalog but not in the stage fields the release counted over an earlier release's files; a reason of none left out), with the units or rows by reason on hover;
304
- so the post-training tile's units and material sets plus those of the band are the units and material sets the selection counts with no filter on.
305
- Figures written before #2629 give the band the sources of the layer shown that have no stage, without units, rows or reasons.
 
 
306
  A tile is a button once the page has the stages of its commit: it sets the filter by stage to its stage (and Pick to its layer) and goes to Pick, or clears it when it holds it already;
307
  what is missing is one short line under the tiles (no stage figures, no stage fields counted, or figures without the sources' stages).
308
  Before the index is read, `first.js` draws the tiles from the figures it read on its own, and `app.js` draws them again with the clicks once it has read the index.
@@ -380,7 +401,10 @@ page's language.
380
  the `@fontsource` packages (5.3.0) on jsDelivr, each under the SIL Open Font License 1.1 (`OFL-IBM-Plex.txt`,
381
  `OFL-Big-Shoulders.txt`).
382
  - `first.js`: the first screen before the index is read: the pictograms and (#2422) the column of the training stages
383
- and the release line, from the commit's `meta/stage_figures.json`, read as soon as `commit.js` names the commit
 
 
 
384
  (`drawStages`, `drawRelease`, which `app.js` calls again once it has read the index; `stageColor`, a stage's color
385
  token, and `stageWhat`, what it can use, which the field's labels say too).
386
  It also has the words of a level's size (`sizeOf`, the deduplicated size, `sizeParts`, `sizeLine`, `checkText`) that
@@ -390,7 +414,7 @@ page's language.
390
  for DuckDB, and the size figures of the whole index and of each layer (`sizes`, from `meta/size_figures.json`);
391
  #2066: the table of Chinese names (`TRANSLATIONS`, the map `zh`), the release's stage figures (`stageFigures`) and why
392
  the page has no stages of its commit (`stagesWhy`); #2422: each source's deduplicated size (`distinct`) and the
393
- release's date (`releaseDate`).
394
  - `i18n.js`: the page's languages (i18next with its browser language detector, the words from `locales/en.json` and
395
  `locales/zh.json`), the words of `index.html` (`data-i18n` sets an element's text, `data-i18n-attr` its attributes)
396
  and the language switch; the other modules draw their text again on i18next's `languageChanged`.
@@ -432,10 +456,13 @@ page's language.
432
  The counts are material sets or their units, or the rows of corpora, never both layers; the table behind each chart
433
  has the layer's sources and its measure.
434
  The charts are drawn again for a new layer, count, language, width or theme.
435
- Under the map, a table of the leaves of the domain grid whose material sets hold the fewest units, the fewest first, in the order the funnel takes them (`03_data_line/v2/funnel_propose.py` `pick`): each leaf's name, its domain, its material sets and their units, from `projections.leaves.by_leaf` of the commit's `meta/coverage.json`, the grid's order among equals, the first five of that order, the order the upstream search also takes its leaves in after those it has not searched for a day (`app.js` `FEWEST_LEAVES`, `renderFewest`);
436
  it is not filtered, and a commit without the projection leaves it out.
437
- Under it, a table of every leaf of the grid with its units by method, in the grid's order (`app.js` `leafRows`, `renderLeaves`): agent, the units of the material sets whose domain holds the leaf, each chosen by an agent (`projections.leaves.by_leaf` of `meta/coverage.json`, as the table above), and classifier, the corpus units scored by a classifier at or above the leaf's threshold (`leaves` of the commit's `meta/labels.json`: `units`, `threshold`), then one column per class of the classifier's units (`by_class`, the classes with the most units first), the leaf's threshold, and for a leaf with classifier units the command that takes them straight from the corpora (`--kind corpus --leaf <code>`, with the units choice in force);
 
438
  a line above it names the labels' model, and a commit without `meta/labels.json` says it carries no labels yet and shows a dash for the classifier's counts.
 
 
439
  One crossfilter selection holds the filters, one clause per filter; a click on a bar or a cell picks through the
440
  chart's toggle and the page sets the clause, so the panel and the charts set the same clauses.
441
  A chart's tooltips (Observable Plot's pointer) stop the other listeners of a mouse press on the chart to pin the tip,
@@ -504,9 +531,9 @@ page's language.
504
  files, the permit classes for training and redistribution as "x / y files" and the licenses behind each, or one
505
  phrase when all its files allow both, read from the catalog column `license_counts`; without the column, as before)
506
  and, for a material set, an example unit file.
507
- A corpus whose units the commit labels (files under `labels/<source>/`) has a line "Labels" (`app.js` `labelItem`): the labels' model and its units at or above each leaf's threshold (`sources` of `meta/labels.json`), the most first;
508
- the labels of its first units, one line per `unit_id` of the first 200 rows of its first label file with each leaf's score, in bold at or above that leaf's threshold, and its class;
509
- and the command that takes its units of the leaf it holds the most of (`--kind corpus --source <id> --leaf <code>`, with the units choice in force).
510
  #2629: its line "Take it" is the command that takes the source alone: a material set whole (no `--sample`), with its
511
  units and its size beside the command; a corpus, whose whole can be petabytes, by the units choice below (the
512
  reader's, else 3 per source).
@@ -542,12 +569,12 @@ page's language.
542
  clears the choice, so the other layer takes its own default again;
543
  #1891: "all" leaves `--sample` out, so the command takes every unit of the selected sources and the default profile stays on;
544
  it never gives `fetch.py --all` (which turns off the profile's criteria other than benchmark and not compared), and the folder tree lists what the profile leaves out under every choice:
545
- #2397: the criteria `tools/fetch.py` applies by default, in its order, as the release lists them in `meta/vocabulary.json` (`profile`, from `public_fetch.CRITERIA` less `OPT_IN`, the two that #2441 applies only when asked: license and personal data), each by its words in the page's language (`profile.<criterion>` of the locales), so the page and the tool show one list; a vocabulary without that list shows none;
546
  #2422: each with the flag of `tools/fetch.py` that takes it back (the criterion's `option` in that list, from
547
  `public_fetch.RELAX`: duplicates `--keep-duplicates`, benchmark copies `--allow-benchmark`, rows not compared with
548
- the benchmark list `--allow-not-compared`, not English `--any-language`, over 20 MB `--any-size`; #2674: refused by
549
- its site when the release's fetch check read it `--allow-refused`), and #2441 under it the two flags that leave out
550
- rows by license or personal data, `--training-only` and `--no-personal-data`.
551
  The link beside the selection chips reads "Change filters" and goes to the filter panel.
552
  #1498, #1524: below it, the usage example video block (id `usage-video`, which the dataset card and the project page
553
  link to) plays the video of the page's language from `media/` of the dataset, `usage-example.zh.mp4` in Chinese and
@@ -631,10 +658,11 @@ deduplicated size, as the page shows it), and
631
  `{{ tut.fetched }}` those of them the tutorial's take uses: each whose every row the release's fetch check read and
632
  fetched (catalog column `fetch_check`, level `all` over as many rows as its column `files`), so that the take completes.
633
  #2442: `{{ parts.en.* }}` and `{{ parts.zh.* }}` are the parts of the dataset card the manual holds, in the words of
634
- each text (the tables of every stage's funnel, of personal information, of known limits and of release days, the
635
- fields used most, the line of the release's own counts and checks, and the card's addresses), computed by the
 
636
  projection's code (`artpool.index_projection.manual_parts`) from `meta/size_figures.json`, `meta/stage_figures.json`
637
- and `meta/translations.parquet` of that commit, so they say what the release's card would.
638
  `{{ out.<name> }}` is the output of a command the manual shows, run for real against that release in the deploy's
639
  temporary directory, within a time limit, and cut as the manual shows it;
640
  `03_data_line/steps/portal.py` (`manual_outputs`) holds each command and SQL file, the exit code the manual shows and
 
17
  real public data for pre-training, mid-training and post-training, each file with its address, size, hashes and license, fetched with one command.
18
  #2422: the dataset card is the overview;
19
  this page is where data is picked and taken, in three parts.
20
+ Its first screen is a working screen (second round, "Strata"; section The working screen): the field, a WebGL scene with every source of the index as one point, is the ground, and on it float the name, that sentence and the training stages of the stage table `catalog/stages.yaml` as a column, each with what it can use and its units by status (the release's `meta/stage_figures.json`; a click on one sets the filter by stage), the filters (the domain, the form, the six facets, the size, the training permit, the personal-data mark and the file type), the count of the selection with its largest sources, and the one command that takes it.
21
  The sources follow: the material sets or corpora of the selection with their fit, their details and a preview of their rows, then the domain × form map with the bars by domain and by form for one layer at a time (linked: a click on one filters the others, the list and the field).
22
  Get the data gives the selection's one command, what it writes, what the default profile of the fetch tool leaves out with the flag that takes each back, and the selection file.
23
  The Space card says the first sentence in short (`short_description`, at most 60 characters, https://huggingface.co/docs/hub/spaces-config-reference).
 
93
  One pair of names is used everywhere: "corpus" and "corpora", "material set" and "material sets"
94
  (in Chinese the two names that `locales/zh.json` has for them, `kind.corpus` and `kind.material_set`).
95
  #1577: one word per concept in each language, the same as in the index's docs: a source is "source" (in Chinese the
96
+ word of `col.title`; never "data source"), its card the card (its md and yaml cards under `cards/`, never a second
97
+ word for the source itself), a domain "domain" (in Chinese the word of `filter.domain`; never
98
  "category"), and the redistribution permit "redistribution" (in Chinese the word of `chip.redistribution`; never
99
  "shipping", which names the card field `license.ship`).
100
  No number and no heading counts "sources" over both layers.
 
186
 
187
  | File | Read | Fields used |
188
  |---|---|---|
189
+ | `meta/catalog.parquet` | at load; then loaded whole into DuckDB-WASM as the table `catalog` | `source`, `title`, `summary`, `description`, `status`, `status_reasons`, `kind` (when published), `collection` (when published), `domain`, `form` (when published), `license` (`spdx`, `tier`, `note`, `ship`), `contamination` (`level`, `benchmark`, `scope`; level `not scanned` reads as not known), `pii` (`level`, `evidence`), `files`, `license_counts` (when published: per material set `kind`, `upstream` or `index` for the files the index wrote under `campaign_files/`, `spdx`, `training_ok`, `redistribution_ok` and `files`, counted by the projection over all its rows), `bytes`, `distinct_bytes` (when published), `unsized_rows`, `fetch_check` (when published, #1577: `level`, `rows`, `fetched`, `read_at`; #2006: named `fetch` up to `release-2026-11-09.1`, which the page reads when the commit has no `fetch_check`), `unit`, `top_types`, `needs_auth`, `data_files` (when published, #1746: the selection's SQL takes the data files from it; a commit without it names its files nowhere but in their paths, which the query does not read), `batch_files` (when published, #1769: the data files that hold each batch of a source, the page's list of a source's files and batches; #1792: with `first` and `last`, the source's first and last row in that file, the row range the page reads; without it, `data_files` with no batches), `released_in` (when published, #1928: the release tag of the release whose record of the source its rows come from; the source's page names it), `held_back` (when published, #1928: why a newer batch of the source is held back, in the words of the release notes, while it keeps its newest version that passed every check; the source's page shows it, #2674: as one sentence in the page's language, what waits and what stays published, with those words in a closed block), `upstream_kind`, `upstream_agent`, `upstream_entry` (when published, #2588: the source's declared upstream, a dataset or a catalog with its agent and entry address, the values joined by ` \| ` while it reads several; the source's page shows each upstream on a line of its own), `card` (when published, #4406: the address of the source's card, its section of the card file of its upstream's protocol, `<path>#<anchor>`; the source's page links it on the Hub at the page's commit), `campaign_part` (when published: the zip that holds the files the index stores for the source, `campaign_files/<protocol>/<part>.zip`; the example file of the source's page, when it is one of them, links that part), `subject`, `industry`, `occupation`, `business_process`, `resource_type`, `file_format` (when published: the source's codes on each facet, which the filters by facet read) |
190
  | `meta/attribution.parquet` | when the attribution file is made, when the commit has it (#1577) | `source`, `publisher`, `license`, `license_url`, `files` |
191
  | `meta/size_figures.json` | at load, when the commit has it | per layer (`layers`) and per source (`sources`): `distinct_bytes` (#2422: the one size the page shows), `unsized_rows`, `check` (`rows`, `compared`, `match`, `unreachable`, `gone`, `needs_auth`, `no_length`, `error`), `estimate` (`bytes`, `low`, `high`, `readings`, `rows`) |
192
  | `meta/sources.json` | at load | per source: `license_rows` (training and redistribution, rows per value), `license` (`name`, `statement`, `attribution`, `url`), `by_ext`, `size_quantiles_upper_bytes` |
193
+ | `meta/coverage.json` | at load | `by_license.training_ok` (rows per value); `projections.leaves.by_leaf` (per leaf `domain`, `name`, `zh`, `material_sets`, `units`: the leaves with the fewest units under the map); `projections.source_kinds.by_kind` and `projections.classes.by_class` (per kind of source and per class `zh`, `sources`, `material_sets`, `units`, `corpora`, `corpus_units`: the tables by kind of source and by class) |
194
  | `meta/batches.parquet` | at load | `source`, `batch`, `rows`, `status` |
195
+ | `meta/vocabulary.json` | at load, when the commit has it | `domains[].code`, `name`, `zh`, `parent`; `forms[].id`, `zh`; `layers[].kind`, `name`, `zh`; `relation.about`, `zh`; `collections[].code`, `name`, `zh`, `about`, `campaigns`; `facets[].id`, `standard`, `version`, `codes` (`code`, `level`, `parent`, `name`: the hierarchy the filters by facet list) |
196
  | the data files the catalog names for a source (`batch_files`) | on demand | `source`, `batch`, `uri`, `range_offset`, `range_length`, `member_path`, `size_bytes`, `sha256`; only the source's row range in each file (#1792: `first` to `last` of `batch_files`, the whole file when the catalog has none), of which only the rows whose `source` (and `batch`, for the row count of a batch that `meta/batches.parquet` does not list) is the source's, since a file may hold rows of other sources |
197
  | `@huggingface/hub`: `datasetInfo` of the revision and `pathsInfo` of a source's data files at the commit | at load, on demand | the file list of the commit; the date of the last commit of each batch, the latest among the files that hold it |
198
  | `meta/preview.parquet` | the first time a row's "Preview" or a material set's detail opens; then loaded whole into DuckDB-WASM as the table `preview` | the rows of that source (`source` = its id), every column that has a value in one of them; in the detail, the first file of a unit of a material set (`extra` `source_meta.unit_group`, or a row of no collection) |
199
  | `meta/projection.json` | at load, when the commit has it | `tag`, the release tag the page's commands name and (#2422), with `date`, the release line of the first screen |
200
+ | `meta/stage_figures.json` (#2006, #2518: of the commit the page reads, written by the release's projection) | at load, when the commit has it | `counted` (whether the release has counted its stage fields), `version` (of the stage table), `stages` (`id`, `name`, `zh`, `status`, `about`, `counted_by`, `counts`, `funnel`, `statuses`, the first screen's bands), `sources` (per source the ids of the stages one of its units is counted on; a release before #2518 has none) |
201
+ | `meta/stage_figures.json` (#2066) | #2422: as soon as the commit is known (`first.js`), and at load, when the commit has it | per stage of `stages`, in the stage table's order: `id`, `name`, `zh`, `status`, `counted_by`, `counts`, `funnel` and `statuses` (each count null before the release counted the stage fields), what the first screen says it can use and its units by status; `release` and `date`, the release line until the index is read; `counted` and `counted_on`, the release tag or publish (`<tag>.p<n>`) the release line says its figures were counted on, or that they are not counted yet |
202
  | `meta/translations.parquet` (#2066: the table of Chinese names #2065 writes with the release) | at load, when the commit has it | `en` (an English text the index shows: a collection's name, a source's title or description as the catalog holds them) and `zh` (its Chinese text) |
203
  | `meta/labels.json` (the labels of corpus units) | at load, when the commit has it | `model`; per leaf (`leaves`) `threshold`, `units` (the units at or above the threshold) and `by_class` (those units by class), the table of units by leaf; per source (`sources`) its units at or above each leaf's threshold, its detail |
204
  | `labels/<source>/*.parquet` (found in the commit's file list, no folder listed) | when the detail of a labelled corpus opens | `unit_id`, `leaf`, `score`, `class` of the first 200 rows of its first file: the labels of its first units |
 
247
  | `rev=<sha or branch>` | read another commit of the dataset |
248
  | `catalog=<url>` | read the catalog from this URL (parquet, or JSON: a list of rows) instead of `meta/catalog.parquet` |
249
  | `vocabulary=<url>` | read the names of domains and forms, and the requirements of the not-included categories, from this URL instead of `meta/vocabulary.json` |
250
+ | `figures=<url>` | read the stage figures from this URL instead of `meta/stage_figures.json`, as the first screen and the filter by stage use them |
251
  | `kind` | the layer Pick shows: `material_set` (the default) or `corpus`; #2422: a `stage` takes its own |
252
  | `domain`, `leaf`, `form`, `collection`, `train`, `redist`, `tier`, `size`, `status`, `q`, `ext`, `stage`, `pii` | the filters (`collection`: a line code of `admit_collections.tsv`, material sets only; `train` and `redist`: `yes` for every row allowed, `cond` for allowed or with conditions; `size`: the class of the deduplicated size, `lt1g`, `1g1t`, `ge1t` or `unknown`; `status`: a catalog status, such as `flagged`; `ext`: the selected file types, joined by commas; `stage`: the id of a training stage of the stage table, such as `post-training`; #2422: `pii`, the personal-data mark, `none`, `marked` or `unknown`) |
253
+ | `subject`, `industry`, `occupation`, `business_process`, `resource_type`, `file_format` | the filters by facet: a code of the facet of the catalog column of that name (such as `subject=1.2`, `industry=62`, `resource_type=Software`), `multi` or `unclassified`; a code keeps the sources of that code and of every code under it in the facet's hierarchy |
254
  | `pick` | the picked sources, their ids joined by commas (#1286); while any is picked, "Get the data" takes exactly them |
255
  | `sample` | how many units "Get the data" takes from each source: `1`, `3`, `10`, `30` or `all` (#1524); #2629: without it, `all` when the command takes material sets and `3` when it takes corpora |
256
  | `metric`, `sort`, `dir`, `open` | what the charts of material sets count (`sets`, the default, or `units`; corpora are counted in rows), the sort of the list (default: fit), the open source |
 
258
  | `lng=<en or zh>` | open the page in English or in Simplified Chinese (and keep that choice) |
259
 
260
  #2422: the filters are in the left panel of the working screen: the training stage is set by its band of the column
261
+ above them (its select stays in the page, out of sight), then the search box, the domain, the form, the six facets
262
+ under the heading "By standard", the size, the training permit, the personal-data mark and the file type (an HTML
263
+ `details` element, closed at first and opened when a type is checked, its summary saying how many are).
264
+ The facets are the catalog's columns `subject`, `industry`, `occupation`, `business_process`, `resource_type` and
265
+ `file_format`, each a recognised standard (`catalog/facets.yaml` of the code repository), and each filter a select of
266
+ its standard's codes in their hierarchy, from `facets` of the commit's `meta/vocabulary.json` (`data.js` `facetsOf`):
267
+ a code is indented under its parent, named by its code and the name its standard gives it (a standard whose names are
268
+ withheld, ISIC, by its level and code, with the title another standard gives it: NACE Rev. 2.1's headings of the
269
+ sections and divisions), with the sources it keeps under the other filters, and a code that keeps none
270
+ is left out, so each list is the part of its hierarchy the selection has;
271
+ `multi` and `unclassified` come last.
272
+ Under a facet that links its codes' pages or takes titles from another standard (`code_page` and `titles` of the
273
+ facet), a line links the selected code's page at its standard's source and gives the attribution of the titles, linked
274
+ to their source (`app.js` `facetNote`).
275
+ A code keeps the sources of that code and of every code under it: each source carries its codes with every code above
276
+ them (`data.js` `facetKeys`, the page's columns `fc_<facet>`).
277
+ A facet whose column the commit's catalog lacks has no select, and the heading goes when none has;
278
+ a vocabulary without facets lists the codes the sources carry, unindented.
279
+ A selection by facet takes its sources by `--source`, under the default profile, and the SQL tab names them by id;
280
+ a chart's table in the SQL Console reads the facet's column with the codes the sources carry at or under the code.
281
  The training permit and the personal-data mark are labels every source carries (what all its rows allow for training,
282
  `license_rows` of `meta/sources.json`; the `pii.level` of its card in the catalog, present or suspected, none found, or
283
  not judged yet):
 
317
  on hover, the selected stage's condition (#2066: in Chinese its text in the table of Chinese names, once the release has it) and the version of the table the stages were computed with.
318
  A selection by stage takes its sources by `--source`, under the default profile, and the SQL tab names them by id.
319
  #2422: the first screen is the stages of the release's `meta/stage_figures.json`, in the stage table's order, each a tile (`first.js` `drawStages`) drawn as the dataset card's stage figure: its pictogram, its name in the page's language, the mark of a provisional stage (by its status in the figures; pre-training and mid-training while the stage table says so), and what it can use, one large number and one line under it:
320
+ a stage counted in bytes says its size (the size after deduplication, so the page's one size) over its corpus rows, one counted in units its units over its units by each label method its count takes (agent, classifier; `methods`, `headline` and `agent_by_layer` of the stage's figures, `first.js` `methodsLine`), joined by plus signs so that they add up to the large number, the agent's with its units of material sets and of corpus units an agent judged, where the figures give them, else over its material sets (`stageWhat`).
321
+ Under them each tile gives its units by status (`statuses` of the stage's figures, `first.js` `stageStatuses`), a corpus counting its rows as units: one line with the units its other methods place, given beside its count and not in it (post-training: the rules' placements), or, for a stage whose count takes every method it has, its counted units by each of them (rules), and one with its units not yet judged, judged below threshold, duplicate of a counted unit, overlapping a benchmark, of a size not recorded and archives of recorded members, so that the large number and the two lines add up to every unit of the catalog, as the dataset card's table of statuses does;
322
+ between the two, a stage with the classifier says what its classifier units stand on (`scoring` of the stage's figures, `first.js` `scoringLines`): the data files the classifier has scored so far of those it scores, with its model, and its precision at its leaves' thresholds on the held-out judgments with its 95% interval, so that while the labels are scored the large number grows with each release;
323
+ each number is short on the tile and whole on hover, with the stage's condition.
324
+ Figures written before the stages gave each unit a status (format `stage-figures/7` and older) give each tile its funnel (`funnel` of the stage's figures) instead, in the measure of its large number: what meets the stage's condition, then what each rule of `rules` removes (a rule that removes nothing left out), which ends at that number (`first.js` `funnelSteps`).
325
+ No band counts what no stage counts: every unit has a status on each stage.
326
+ In the field, the sources none of whose units a stage counts stand on the last plane, "In no stage" (`strata.rest`), its figure the number of them in the layer shown, or of one kind of source among every source (`app.js` `restWhat`).
327
  A tile is a button once the page has the stages of its commit: it sets the filter by stage to its stage (and Pick to its layer) and goes to Pick, or clears it when it holds it already;
328
  what is missing is one short line under the tiles (no stage figures, no stage fields counted, or figures without the sources' stages).
329
  Before the index is read, `first.js` draws the tiles from the figures it read on its own, and `app.js` draws them again with the clicks once it has read the index.
 
401
  the `@fontsource` packages (5.3.0) on jsDelivr, each under the SIL Open Font License 1.1 (`OFL-IBM-Plex.txt`,
402
  `OFL-Big-Shoulders.txt`).
403
  - `first.js`: the first screen before the index is read: the pictograms and (#2422) the column of the training stages
404
+ and the release line (the release tag, its day and the release tag or publish its figures were counted on,
405
+ `counted_on`, linked to the dataset at that tag or at `main` for a publish, or that they are not counted yet;
406
+ `countedOf`), from the commit's `meta/stage_figures.json`, read as soon as
407
+ `commit.js` names the commit
408
  (`drawStages`, `drawRelease`, which `app.js` calls again once it has read the index; `stageColor`, a stage's color
409
  token, and `stageWhat`, what it can use, which the field's labels say too).
410
  It also has the words of a level's size (`sizeOf`, the deduplicated size, `sizeParts`, `sizeLine`, `checkText`) that
 
414
  for DuckDB, and the size figures of the whole index and of each layer (`sizes`, from `meta/size_figures.json`);
415
  #2066: the table of Chinese names (`TRANSLATIONS`, the map `zh`), the release's stage figures (`stageFigures`) and why
416
  the page has no stages of its commit (`stagesWhy`); #2422: each source's deduplicated size (`distinct`) and the
417
+ release's date (`releaseDate`); the release tag the stage figures were counted on (`countedOn`).
418
  - `i18n.js`: the page's languages (i18next with its browser language detector, the words from `locales/en.json` and
419
  `locales/zh.json`), the words of `index.html` (`data-i18n` sets an element's text, `data-i18n-attr` its attributes)
420
  and the language switch; the other modules draw their text again on i18next's `languageChanged`.
 
456
  The counts are material sets or their units, or the rows of corpora, never both layers; the table behind each chart
457
  has the layer's sources and its measure.
458
  The charts are drawn again for a new layer, count, language, width or theme.
459
+ Under the map, a table of the leaves of the domain grid with the fewest units, the fewest first, in the order the funnel takes them (`03_data_line/v2/funnel_propose.py` `pick`): each leaf's name, its domain and its units labelled by any method (`leaves` of the commit's `meta/labels.json` of format `training-data-foundation-labels/3`; of an older commit, its material sets and their units, from `projections.leaves.by_leaf` of the commit's `meta/coverage.json`), the grid's order among equals, the first five of that order, the order the upstream search also takes its leaves in after those it has not searched for a day (`app.js` `FEWEST_LEAVES`, `renderFewest`);
460
  it is not filtered, and a commit without the projection leaves it out.
461
+ Under it, a table of every leaf of the grid with its units, in the grid's order (`app.js` `leafRows`, `renderLeaves`): with labels of format `training-data-foundation-labels/3`, its units labelled by any method and by each method, agent and classifier (`leaves` of the commit's `meta/labels.json`: `units`, `by_method`), one column per class (`by_class`, the classes with the most units first), the leaf's threshold, and the command that takes its labelled units from every source (`--leaf <code>`, with `--method` for the method chosen in the switch above the table, kept in the address, and the units choice in force);
462
+ of an older commit, agent, the units of the material sets whose domain holds the leaf (`projections.leaves.by_leaf` of `meta/coverage.json`), and classifier, the corpus units scored at or above the leaf's threshold, then its classes and threshold, and for a leaf with classifier units the command that takes them from the corpora (`--kind corpus --leaf <code>`), as that commit's fetch tool takes them;
463
  a line above it names the labels' model, and a commit without `meta/labels.json` says it carries no labels yet and shows a dash for the classifier's counts.
464
+ Under it, two tables of every source of the commit, whatever its status: by its kind of source (`catalog/source_kinds.tsv`) and by the class of its form (`catalog/stages.yaml`), each row in its table's order with its sources, its material sets and their units and its corpora and their units (`app.js` `renderKinds`, from `projections.source_kinds.by_kind` and `projections.classes.by_class` of the commit's `meta/coverage.json`, `index_projection.kind_coverage`);
465
+ a commit whose projection gives neither says so in one line.
466
  One crossfilter selection holds the filters, one clause per filter; a click on a bar or a cell picks through the
467
  chart's toggle and the page sets the clause, so the panel and the charts set the same clauses.
468
  A chart's tooltips (Observable Plot's pointer) stop the other listeners of a mouse press on the chart to pin the tip,
 
531
  files, the permit classes for training and redistribution as "x / y files" and the licenses behind each, or one
532
  phrase when all its files allow both, read from the catalog column `license_counts`; without the column, as before)
533
  and, for a material set, an example unit file.
534
+ A source whose units the commit labels (files under `labels/<source>/`) has a line "Labels" (`app.js` `labelItem`): the labels' model, its units by method (`by_method` of `meta/labels.json`, format /3) and its units of each leaf (`sources`), the most first;
535
+ the labels of its first units, one line per `unit_id` of the first 200 rows of its first label file with each leaf's label, a classifier's score in bold at or above that leaf's threshold or the method agent, and its class;
536
+ and the command that takes its units of the leaf it holds the most of (`--source <id> --leaf <code>`, with `--method` for the method chosen and the units choice in force; `--kind corpus` before it at a commit whose catalog has the column `kind`).
537
  #2629: its line "Take it" is the command that takes the source alone: a material set whole (no `--sample`), with its
538
  units and its size beside the command; a corpus, whose whole can be petabytes, by the units choice below (the
539
  reader's, else 3 per source).
 
569
  clears the choice, so the other layer takes its own default again;
570
  #1891: "all" leaves `--sample` out, so the command takes every unit of the selected sources and the default profile stays on;
571
  it never gives `fetch.py --all` (which turns off the profile's criteria other than benchmark and not compared), and the folder tree lists what the profile leaves out under every choice:
572
+ #2397: the criteria `tools/fetch.py` applies by default, in its order, as the release lists them in `meta/vocabulary.json` (`profile`, from `public_fetch.CRITERIA` less `OPT_IN`, the three that #2441 applies only when asked: license, personal data and refused), each by its words in the page's language (`profile.<criterion>` of the locales), so the page and the tool show one list; a vocabulary without that list shows none;
573
  #2422: each with the flag of `tools/fetch.py` that takes it back (the criterion's `option` in that list, from
574
  `public_fetch.RELAX`: duplicates `--keep-duplicates`, benchmark copies `--allow-benchmark`, rows not compared with
575
+ the benchmark list `--allow-not-compared`, not English `--any-language`, over 20 MB `--any-size`), and #2441 under it
576
+ the three flags that leave out rows by license, personal data or the fetch check's reading, `--training-only`,
577
+ `--no-personal-data` and `--no-refused`.
578
  The link beside the selection chips reads "Change filters" and goes to the filter panel.
579
  #1498, #1524: below it, the usage example video block (id `usage-video`, which the dataset card and the project page
580
  link to) plays the video of the page's language from `media/` of the dataset, `usage-example.zh.mp4` in Chinese and
 
658
  `{{ tut.fetched }}` those of them the tutorial's take uses: each whose every row the release's fetch check read and
659
  fetched (catalog column `fetch_check`, level `all` over as many rows as its column `files`), so that the take completes.
660
  #2442: `{{ parts.en.* }}` and `{{ parts.zh.* }}` are the parts of the dataset card the manual holds, in the words of
661
+ each text (the tables of every stage's funnel, of personal information, of known limits, of release days and of what is
662
+ kept out by law with what is collected instead, the fields used most, the line of the release's own counts and checks,
663
+ and the card's addresses), computed by the
664
  projection's code (`artpool.index_projection.manual_parts`) from `meta/size_figures.json`, `meta/stage_figures.json`
665
+ and `meta/translations.parquet` of that commit and the deploy's `catalog/blocked.tsv`, so they say what the release's card would.
666
  `{{ out.<name> }}` is the output of a command the manual shows, run for real against that release in the deploy's
667
  temporary directory, within a time limit, and cut as the manual shows it;
668
  `03_data_line/steps/portal.py` (`manual_outputs`) holds each command and SQL file, the exit code the manual shows and
app.js CHANGED
@@ -4,19 +4,21 @@
4
  // charts) and Get the data (the one command and the selection file). The dataset card is the overview; this page is
5
  // where data is picked and taken.
6
  // Figures first, few words; every chart keeps a short label and a table view. The charts of Pick, its filter counts and
7
- // the list of selected sources come from one crossfilter selection (linked.js). The two layers stay apart everywhere
8
- // and are never added together (#1083): material sets, grouped into collections and counted in sets and units, in the
9
- // main color; corpora, counted in rows, in gray. Pick shows one layer at a time (F.kind, material sets by default; a
10
- // training stage takes the layer it counts).
 
 
11
  import {
12
- CORPUS, DATASET_URL, fileUrl, KINDS, loadBatchDates, loadIndex, MATERIAL_SET, num, readColumns, REPO, summed, topOf,
13
- wholeFile,
14
  } from './data.js';
15
  import {
16
  clear, el, figureWithToggle, fmtAnd, fmtBytes, fmtCompact, fmtDate, fmtInt, fmtOr, fmtPct, fmtShare, fmtShort,
17
  segmented, table, tableShown, vt,
18
  } from './charts.js';
19
- import { decorate, drawRelease, drawStages, markFromIndex, RULE_KEY, sizeLine, sizeOf, sizeParts, stageColor, stageWhat } from './first.js';
20
  import { lang, onLanguage, setUpSwitch, t, tEn, translatePage } from './i18n.js';
21
  import { formIcon, icon } from './icons.js';
22
 
@@ -24,16 +26,17 @@ const CSV_MAX_ROWS = 200000;
24
  const ROW_COLUMNS = ['source', 'batch', 'uri', 'range_offset', 'range_length', 'member_path', 'size_bytes', 'sha256'];
25
  const FIRST_ROWS = 20;
26
  // the columns of a source's label files (labels/<source>/*.parquet) its detail reads, and how many of the first file's
27
- // rows (one per unit and leaf labelled)
28
- const LABEL_COLUMNS = ['unit_id', 'leaf', 'score', 'class'];
29
  const LABEL_ROWS = 200;
30
  const HEAT_FORMS = 8;
31
  const FORM_BARS = 10;
32
  // #1524: how many units Get the data takes from each source (--sample N; all: no --sample, #1891); #2629: when the
33
  // reader has not chosen (sample in the address), every unit of material sets, whose whole is small, and 3 of each
34
- // corpus, whose whole can be petabytes (DEFAULT_SAMPLE by the layer the command takes, sampleNow)
 
35
  const SAMPLES = ['1', '3', '10', '30', 'all'];
36
- const DEFAULT_SAMPLE = { [MATERIAL_SET]: 'all', [CORPUS]: '3' };
37
  const MAX_FILE = 20e6;
38
  const MAX_LISTED = 30;
39
  // the phone layout of style.css
@@ -109,7 +112,11 @@ const uncounted = (n) => (n ? t('n.uncounted', { n: fmtInt(n) }) : '');
109
  const unitsText = (n, missing = 0) => (n == null ? t('n.unitsNotCounted') : plural('n.unit', n) + uncounted(missing));
110
  const unitsNum = (n) => (n == null ? t('n.notCounted') : fmtInt(n));
111
  const unitsOfSets = (S) => { const u = summed(S.map((s) => s.readyUnits)); return unitsText(u.sum, u.missing); };
112
- const notCountedOf = (S) => summed(S.filter((s) => s.isTask).map((s) => s.readyUnits)).missing;
 
 
 
 
113
  /** #2066: a chart of plots.js, draw(); until the module is loaded a skeleton of class sk, and the reason in its place
114
  * when it could not be loaded (each figure's Table view has the same numbers). */
115
  function plotted(draw, sk = 'sk sk-block') {
@@ -132,29 +139,37 @@ const F = {};
132
  // across: the ids the filters keep in either layer (linked.js startAcross)
133
  const UI = { across: null, allForms: false, showAll: false, detail: new Map(), preview: new Set(), previewRows: new Map(), csv: null, tab: 'cmd', fitKeyOpen: false, ids: null, facets: {},
134
  tables: { dom: [], form: [], heat: [] }, charts: null };
135
- // kind: the layer the browse section shows (material_set, the default, or corpus); metric: what the charts of material
136
- // sets count (sets or units; corpora are counted in rows); pick: the ids of the picked sources, joined by commas; ext:
 
137
  // the file types selected, joined by commas; sample: how many units Get the data takes from each source (SAMPLES);
138
  // stage (#2006): the id of a training stage of the stage table (the commit's stage figures); pii (#2422): the personal-data mark (none,
139
- // marked or unknown, piiMark). The panel shows no control for collection, leaf, tier, redist and status (#2422): from
140
- // the address they still filter, each a chip that removes it
 
141
  // view (#2422, second round): the arrangement of the field (VIEWS), strata by default
142
- const KEYS = ['domain', 'leaf', 'form', 'collection', 'kind', 'train', 'redist', 'tier', 'size', 'status', 'q', 'ext', 'stage', 'pii', 'metric', 'sort', 'dir', 'open', 'pick', 'sample', 'view'];
 
 
 
 
 
143
 
144
  function readUrl() {
145
  const p = new URLSearchParams(location.search);
146
  for (const k of KEYS) F[k] = p.get(k) || '';
147
  if (F.kind !== CORPUS) F.kind = MATERIAL_SET;
148
- if (F.metric !== 'units') F.metric = 'sets';
149
  if (!F.sort) { F.sort = 'fit'; F.dir = 'desc'; }
150
  if (!SAMPLES.includes(F.sample)) F.sample = '';
151
  if (!VIEWS.includes(F.view)) F.view = VIEWS[0];
 
152
  }
153
  function writeUrl() {
154
  const p = new URLSearchParams(location.search);
155
  for (const k of KEYS) {
156
  const v = F[k];
157
- const dflt = (k === 'kind' && v === MATERIAL_SET) || (k === 'metric' && v === 'sets') || (k === 'sort' && v === 'fit') || (k === 'dir' && v === 'desc')
158
  || (k === 'view' && v === VIEWS[0]);
159
  if (v && !dflt) p.set(k, v); else p.delete(k);
160
  }
@@ -216,6 +231,52 @@ function stageTitle(st) {
216
  }
217
  const domainKeysOf = (s) => (s.domainKind === 'codes' ? s.tops : [s.domainKind === 'multi' ? MULTI : NONE]);
218
  const formKeyOf = (s) => s.form ?? NONE;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  // #2422: a source's personal-data mark, a label the page filters on and counts and never leaves a source out of a count
220
  // for: its catalog pii.level present or suspected (marked), none_known (none), else not judged yet (unknown)
221
  const PII_MARKED = ['present', 'suspected'];
@@ -290,8 +351,9 @@ function fitKey() {
290
  // answer (the ids of the selected sources) is what every part below the filters shows
291
  const sizeBucket = (b) => (b == null ? 'unknown' : b < 1e9 ? 'lt1g' : b < 1e12 ? '1g1t' : 'ge1t');
292
  /** One row of the page's DuckDB table src (linked.js): what the filters and the charts read of a source; n_units are
293
- * the units of a material set (#2065: null, which SQL's sum leaves out, while not counted yet) and n_rows the rows of a
294
- * corpus, 0 for the other kind; collection is that of a material
 
295
  * set or (#1633) of a corpus a collection lists, '' otherwise; exts its file types and ext_rows the rows of each
296
  * (data.js exts); #2006: stages the ids of the training stages one of its units passes (data.js stages); #2422: sizeb
297
  * the size class of its deduplicated size, the one size the page shows, and pii its personal-data mark (piiMark). */
@@ -303,11 +365,13 @@ function pageRow(s, cols) {
303
  // #2066: the search reads the title and description in both languages
304
  qtext: [s.title, s.description, IX.zh.get(s.title), IX.zh.get(s.description), s.id].filter(Boolean).join('\n').toLowerCase(),
305
  exts: s.exts.map(([e]) => e), ext_rows: s.exts.map(([, n]) => n), stages: s.stages,
 
 
306
  };
307
  }
308
  const selected = () => (UI.ids ? IX.sources.filter((s) => UI.ids.has(s.id)) : []);
309
- const FILTER_KEYS = ['domain', 'leaf', 'form', 'collection', 'train', 'redist', 'tier', 'size', 'status', 'q', 'ext', 'stage', 'pii'];
310
- // the clauses of the selection: the filters and the layer shown (kind, always one of the two)
311
  const SEL_KEYS = [...FILTER_KEYS, 'kind'];
312
  const activeFilters = () => FILTER_KEYS.filter((k) => F[k]);
313
  /** The filters that are on, as [label, value, key] in the page's language. */
@@ -316,6 +380,7 @@ function filterChips() {
316
  const word = (key) => t(key, { defaultValue: '' });
317
  if (F.domain) out.push([t('chip.domain'), F.leaf ? domainName(F.leaf) : domainName(F.domain), 'domain']);
318
  if (F.form) out.push([t('chip.form'), formName(F.form), 'form']);
 
319
  if (F.collection) out.push([t('chip.collection'), collectionName(F.collection), 'collection']);
320
  if (F.stage) out.push([t('chip.stage'), stageName(F.stage), 'stage']);
321
  if (F.train) out.push([t('chip.training'), word(`filter.permit.${F.train}`), 'train']);
@@ -330,15 +395,18 @@ function filterChips() {
330
  }
331
  /** #1524: the file types selected (F.ext), in the order of the address. */
332
  const extList = () => (F.ext ? F.ext.split(',').filter(Boolean) : []);
333
- /** What the charts count, in the layer shown: material sets in sets or units (F.metric), corpora in rows. */
334
- const metricNow = () => (F.kind === CORPUS ? 'rows' : F.metric);
 
335
  function metricOf(s, m = metricNow()) { return m === 'sets' ? 1 : m === 'units' ? s.readyUnits : s.rawRows; }
336
  const metricFmt = () => (v) => fmtInt(v);
337
- const metricWord = (m) => t(`metric.${m}`);
 
338
 
339
  /** #2422: the layer a training stage counts: that of the sources one of whose units passes it (a stage's condition names
340
- * one kind), else by its measures (a stage counted in units counts material sets). */
341
  function stageKind(id) {
 
342
  const s = IX.sources.find((x) => x.stages.includes(id));
343
  if (s) return s.kind;
344
  return IX.stageList.find((x) => x.id === id)?.counted_by?.includes('units') ? MATERIAL_SET : CORPUS;
@@ -377,8 +445,9 @@ function setLayer(kind) {
377
  // script reads the main branch as it is when it starts)
378
  const fetchUrl = () => fileUrl(IX.pin, 'tools/fetch.py');
379
  /** #2629: the layer a command takes: the picked sources' while there are picks (corpora when one of them is a corpus),
380
- * else the layer shown. */
381
  function takenKind() {
 
382
  const picks = IX ? picked() : [];
383
  return picks.length ? (picks.some((s) => !s.isTask) ? CORPUS : MATERIAL_SET) : F.kind;
384
  }
@@ -388,8 +457,10 @@ const sampleNow = () => F.sample || DEFAULT_SAMPLE[takenKind()];
388
  * which turns the default profile's other criteria off: "all" is a choice of how many units, and the profile stays on. */
389
  const sampleArgs = (v = sampleNow()) => (v === 'all' ? [] : [`--sample ${v}`]);
390
  /** The options of a command, one string each; exts: one --ext per file type (#1524); sample: the units choice it takes
391
- * (#2629: the one in force unless given); leaf: the leaf whose labelled corpus units it takes (--leaf). */
392
- function commandArgs({ domain, form, sources, tags, kind, exts, sample, leaf } = {}) {
 
 
393
  const a = [`--revision ${IX.pin}`];
394
  if (kind) a.push(`--kind ${kind}`);
395
  if (sources) for (const s of sources) a.push(`--source ${s}`);
@@ -397,32 +468,39 @@ function commandArgs({ domain, form, sources, tags, kind, exts, sample, leaf } =
397
  if (domain) a.push(`--domain ${domain}`);
398
  if (form) a.push(`--form ${form}`);
399
  if (leaf) a.push(`--leaf ${leaf}`);
 
400
  if (exts) for (const e of exts) a.push(`--ext ${e}`);
401
  a.push(...sampleArgs(sample), '--out ./data');
402
  return a;
403
  }
 
 
 
 
404
  // #1216: one option per line, continuation lines indented four spaces and every line but the last ending in " \", so
405
  // the text shown is the text copied and runs as it is
406
  const command = (args) => [`uv run ${fetchUrl()}`, ...args].join(' \\\n ');
407
- /** The options that take exactly S, sources of one layer, within domain and form (#1083: one command per layer).
408
- * whole: S is every source of its layer within domain and form, taken by fetch.py's --kind (#1216). Otherwise material
409
- * sets are taken through the campaign tags of their collections (--tag campaign:<name>, any of them; a collection's
410
- * material sets carry the campaign of the collection or of one of its earlier names, vocabulary
411
- * collections[].campaigns), within --domain and --form; corpora, and material sets without a collection, one --source
412
- * each. exts: the file types selected, one --ext each (#1524). */
 
 
413
  function layerArgs(S, { domain, form, whole = false, exts } = {}) {
414
- if (whole) return { args: commandArgs({ kind: S[0]?.isTask ? MATERIAL_SET : CORPUS, domain, form, exts }), listed: false };
415
  const colls = new Set(S.map((s) => s.collection));
416
- if (!S[0]?.isTask || colls.has(null)) return { args: commandArgs({ sources: S.map((s) => s.id), exts }), listed: true };
417
  const tags = IX.vocab.collections.filter((c) => colls.has(c.code)).flatMap((c) => c.campaigns);
418
  return { args: commandArgs({ tags, domain, form, exts }), listed: false };
419
  }
420
- /** The options that select exactly the page's selection (one layer). fetch.py's --domain matches a top-level code with
421
- * its leaves, a leaf only itself, and multi and unclassified only themselves, as the page's domain filter does; --form
422
- * matches one form id. So the layer's options within domain and form when only those filters and the collection are
423
- * set (and the form is a classified one; without a collection the whole layer there, --kind), else one --source per
424
- * selected source. #1524: the file types selected narrow the rows of either, one --ext each (fetch.py keeps the rows
425
- * of any of them, so a source without such rows gives none). */
426
  function selectionArgs(sel) {
427
  const exts = extList();
428
  const other = activeFilters().some((k) => !['domain', 'leaf', 'form', 'collection', 'ext'].includes(k)) || F.form === NONE;
@@ -459,9 +537,11 @@ function stageFigList() {
459
  // button that opened it. A commit whose vocabulary has no term table shows no such line. #2614: the start of the
460
  // manual has the same line ([data-terms]), drawn again with the manual's text (showView).
461
  const TERMS = ['material set', 'corpus', 'unit', 'domain'];
 
 
462
  function renderTerms() {
463
  const terms = IX?.vocab.terms;
464
- const have = TERMS.filter((k) => terms?.get(k)?.about);
465
  for (const line of document.querySelectorAll('#terms, .manual-text [data-terms]')) {
466
  line.hidden = !have.length;
467
  if (!have.length) continue;
@@ -492,7 +572,7 @@ function showTerm(button, key, name, about) {
492
  function renderStageFig() {
493
  if (!IX) return;
494
  const why = IX.stages ? [] : [stageWhy()];
495
- drawStages(stageFigList(), { pick: F.stage, onPick: IX.stages ? pickStage : null, onPoint: (g) => FIELD?.front(g), why, rest: restWhat() });
496
  }
497
  /** A stage's band: the filter by stage set to it (with its layer), or cleared when it holds it already; the field and
498
  * the panels of the screen show the result. */
@@ -515,11 +595,22 @@ function filterOptions(key) {
515
  case 'size': return words('filter.size', ['lt1g', '1g1t', 'ge1t', 'unknown']);
516
  case 'train': return words('filter.permit', ['yes', 'cond']);
517
  case 'pii': return words('filter.pii', ['none', 'marked', 'unknown']);
518
- default: return [];
519
  }
520
  }
521
- // #2422: the filters of the panel, each a select (the file types are checkboxes, fillExt), in the panel's order
522
- const SELECTS = { stage: 'f-stage', domain: 'f-domain', form: 'f-form', size: 'f-size', train: 'f-train', pii: 'f-pii' };
 
 
 
 
 
 
 
 
 
 
 
523
  const ANY = new Set(['size', 'train', 'pii']);
524
  function fillSelect(key) {
525
  if (key === 'ext') { fillExt(); return; }
@@ -531,6 +622,14 @@ function fillSelect(key) {
531
  clear(s).append(option('', text(t(ANY.has(key) ? 'filter.any' : 'filter.all'), key === 'stage' ? null : f?.total)),
532
  ...opts.map(([v, name]) => option(v, text(name, f ? f.m.get(v) || 0 : null))));
533
  s.value = F[key] || '';
 
 
 
 
 
 
 
 
534
  if (key === 'stage') {
535
  // #2006: the selected stage's condition (#2066: in Chinese its text in the table of Chinese names, once the release
536
  // has it) and the version of the stage table on hover; without stages of the commit the page reads, the filter is
@@ -565,7 +664,7 @@ function fillExt() {
565
  // #2422: the fold's summary says how many types are checked
566
  $('ext-on').textContent = on.length ? t('filter.on', { count: on.length, n: fmtInt(on.length) }) : '';
567
  }
568
- const fillFilterOptions = () => { Object.keys(SELECTS).forEach(fillSelect); fillExt(); };
569
  function fillFilterRow() {
570
  fillFilterOptions();
571
  for (const [key, id] of Object.entries(SELECTS)) {
@@ -588,12 +687,13 @@ function fillFilterRow() {
588
  * the selection. */
589
  function syncFilterRow() {
590
  for (const [key, id] of Object.entries(SELECTS)) if ($(id).value !== F[key]) $(id).value = F[key];
 
591
  fillExt();
592
  if (document.activeElement !== $('f-q')) $('f-q').value = F.q;
593
  if (F.ext) $('ext-fold').open = true;
594
  const n = activeFilters().length;
595
  $('f-clear').disabled = !n;
596
- const count = UI.ids ? plural(F.kind === CORPUS ? 'n.corpus' : 'n.materialSet', UI.ids.size) : '';
597
  $('filter-state').textContent = n ? [t('filter.on', { count: n, n: fmtInt(n) }), count].filter(Boolean).join(' · ') : t('filter.noneOn');
598
  $('f-count').textContent = count;
599
  }
@@ -712,9 +812,13 @@ function renderChartFig(k) {
712
  onclick: () => { UI.allForms = !UI.allForms; drawCharts(); } }, UI.allForms ? t('common.fewer') : t('common.all', { n: fmtInt(forms.length) }))
713
  : null;
714
  figureWithToggle($(FIGS[k]), k, title, {
715
- // the layer the chart draws, in its color, above the chart; the table holds that layer's columns only
716
- chart: () => el('div', {}, kindKey([F.kind]), el('div', { class: 'plot-wrap' }, UI.charts[k])),
717
- table: () => (F.kind === CORPUS
 
 
 
 
718
  ? table([...keyHeads, { label: t('th.corpora'), r: true }, { label: t('th.corpusRows'), r: true }],
719
  UI.tables[k].map((r) => [...keyCells(r), fmtInt(num(r.n)), fmtInt(num(r.rows))]))
720
  : table([...keyHeads, { label: t('th.materialSets'), r: true }, { label: t('th.readyUnits'), r: true }],
@@ -722,11 +826,11 @@ function renderChartFig(k) {
722
  sql: () => consoleSql(k),
723
  }, more);
724
  }
725
- // ---- the leaves whose material sets hold the fewest units, in the order the funnel takes them (03_data_line/v2/
726
- // funnel_propose.py pick): by the units of the material sets whose domain holds the leaf (projections.leaves of the
727
- // commit's meta/coverage.json, index_projection.leaf_coverage, which counts them as the funnel does), the grid's order
728
- // among equals, the first FEWEST_LEAVES of them (the upstream search takes every leaf in the same order, after those it
729
- // has not searched for a day)
730
  const FEWEST_LEAVES = 5;
731
  const leafOrder = (code) => String(code).replace(/^D/, '').split('.').map(Number);
732
  function byGrid(a, b) {
@@ -736,8 +840,12 @@ function byGrid(a, b) {
736
  }
737
  function fewestLeaves() {
738
  const byLeaf = IX?.coverage?.projections?.leaves?.by_leaf || {};
739
- return Object.entries(byLeaf).map(([leaf, v]) => ({ ...v, leaf, units: num(v.units) || 0 }))
740
- .sort((a, b) => a.units - b.units || byGrid(a.leaf, b.leaf)).slice(0, FEWEST_LEAVES);
 
 
 
 
741
  }
742
  /** A leaf's name in the page's language: the vocabulary's, else the one projections.leaves gives. */
743
  function leafName(r) {
@@ -748,71 +856,135 @@ function renderFewest() {
748
  const rows = fewestLeaves();
749
  $('fewest').hidden = !rows.length;
750
  if (!rows.length) return;
751
- clear($('fewest-body')).append(table(
752
- [t('th.leaf'), t('th.domain'), { label: t('th.materialSets'), r: true }, { label: t('th.readyUnits'), r: true }],
753
- rows.map((r) => [leafName(r), domainName(r.domain), fmtInt(num(r.material_sets) || 0), fmtInt(r.units)])));
754
- }
755
- // ---- every leaf's units by method, in the grid's order: agent, the units of the material sets whose domain holds the
756
- // leaf, each chosen by an agent (projections.leaves of the commit's meta/coverage.json, as above), and classifier, the
757
- // corpus units a classifier scored at or above the leaf's threshold (leaves of the commit's meta/labels.json: units,
758
- // threshold), then the classifier's units by class (by_class), the classes with the most units first; a row with
759
- // classifier units has the command that takes them from the corpora (--kind corpus --leaf)
 
 
 
 
 
 
 
760
  function leafRows() {
761
  const byLeaf = IX?.coverage?.projections?.leaves?.by_leaf || {};
762
  const lab = IX?.labels?.leaves || {};
763
  return [...new Set([...Object.keys(byLeaf), ...Object.keys(lab)])].sort(byGrid).map((leaf) => {
764
  const c = byLeaf[leaf] || {};
765
  const l = lab[leaf] || {};
766
- return { ...c, leaf, domain: c.domain || leaf.split('.')[0], agent: num(c.units) || 0,
767
- classifier: l.units == null ? null : num(l.units), threshold: l.threshold ?? null, byClass: l.by_class || {} };
 
 
 
 
768
  });
769
  }
 
 
 
 
 
 
 
770
  function renderLeaves() {
771
  const rows = leafRows();
772
  $('leaves').hidden = !rows.length;
773
  if (!rows.length) return;
 
 
774
  const totals = new Map();
775
  for (const r of rows) for (const [k, v] of Object.entries(r.byClass)) totals.set(k, (totals.get(k) || 0) + (num(v) || 0));
776
  const classes = [...totals].sort((a, b) => b[1] - a[1]).map(([k]) => k);
777
  const none = IX.labels ? fmtInt(0) : '\u2014';
778
- const take = (r) => (r.classifier ? copyButton(t('copy.button'), command(commandArgs({ kind: CORPUS, leaf: r.leaf, sample: F.sample || DEFAULT_SAMPLE[CORPUS] }))) : '');
779
- clear($('leaves-body')).append(
780
- el('p', { class: 'small' }, IX.labels ? t('leaves.model', { model: IX.labels.model ?? t('common.unknown') }) : t('leaves.noLabels')),
 
 
 
 
 
 
 
 
 
 
 
 
 
781
  el('div', { class: 'table-wrap' }, table(
782
  [t('th.leaf'), t('th.domain'), { label: t('th.agent'), r: true }, { label: t('th.classifier'), r: true },
783
  ...classes.map((k) => ({ label: sentence(k), r: true })), { label: t('th.threshold'), r: true }, t('th.command')],
784
  rows.map((r) => [leafName(r), domainName(r.domain), fmtInt(r.agent), r.classifier == null ? none : fmtInt(r.classifier),
785
- ...classes.map((k) => (r.byClass[k] == null ? none : fmtInt(num(r.byClass[k])))),
786
- r.threshold == null ? '' : String(r.threshold), take(r)]))));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
787
  }
788
 
789
- /** The heading of the map: what the selection holds, by the map's count, and the domains it covers. */
 
790
  function renderMapHead(sel) {
791
  const m = metricNow();
 
 
792
  for (const b of $('layer-seg').querySelectorAll('button')) b.setAttribute('aria-pressed', String(b.dataset.kind === F.kind));
793
- for (const b of $('metric-seg').querySelectorAll('button')) b.setAttribute('aria-pressed', String(b.dataset.metric === m));
794
- $('metric-wrap').hidden = F.kind === CORPUS;
 
 
 
 
795
  if (!UI.ids) return;
796
  const total = sum(sel, (s) => metricOf(s, m));
797
  const covered = new Set(sel.flatMap((s) => s.tops)).size;
798
- const amount = m === 'sets' ? plural('n.materialSet', total)
799
  : m === 'units' ? t('map.units', { count: total, n: fmtCompact(total) }) + uncounted(notCountedOf(sel))
800
- : t('map.rows', { count: total, n: fmtCompact(total) });
801
  $('map-h').textContent = !sel.length ? t('map.nothing') : covered ? t('map.head', { amount, domains: plural('n.domain', covered) }) : amount;
802
  }
803
 
804
  // ---- the queries behind the tables, for the dataset's SQL Console: over the catalog of the commit the page reads,
805
  // filtered by the filters that filter that table (linked.js filtersOf), written over the catalog's own columns; the
806
- // domain keys and the kind are those of data.js, in the catalog's words (unclassified, multi; the column kind, or the
807
- // rule it is written by when the commit's catalog has none). A query counts the layer shown only, in its own measure:
808
- // material sets and their units, or corpora and their rows. The licence filters read meta/sources.json, which is no
809
- // table, so they name their sources by id (or the ids they leave out, whichever list is shorter).
 
 
810
  const READY_SQL = 'coalesce(units < files, false)';
811
  const kindSql = () => (IX.hasKind ? 'kind' : `CASE WHEN ${READY_SQL} THEN '${MATERIAL_SET}' ELSE '${CORPUS}' END`);
812
  const DOMAIN_KEYS_SQL = "CASE WHEN domain IS NULL OR len(domain) = 0 OR list_contains(domain, 'unclassified') THEN ['unclassified'] "
813
  + "WHEN list_contains(domain, 'multi') THEN ['multi'] ELSE list_distinct([split_part(code, '.', 1) FOR code IN domain]) END";
814
  const FORM_SQL = "coalesce(nullif(form, ''), 'unclassified')";
815
- const sumsSql = () => (F.kind === CORPUS ? 'count(*) AS corpora, sum(files) AS corpus_rows' : 'count(*) AS material_sets, sum(units) AS units');
 
816
  // #2422: the size classes of the deduplicated size, the one size the page shows (catalog column distinct_bytes)
817
  const SIZE_SQL = { lt1g: 'distinct_bytes > 0 AND distinct_bytes < 1e9', '1g1t': 'distinct_bytes >= 1e9 AND distinct_bytes < 1e12',
818
  ge1t: 'distinct_bytes >= 1e12', unknown: 'coalesce(distinct_bytes, 0) <= 0' };
@@ -849,8 +1021,10 @@ function filterSql(keys) {
849
  // #2006: a source's stages are computed from the stage table (the commit's stage figures), no column of the catalog, so the
850
  // sources are named by id
851
  stage: (v) => idsSql(new Set(IX.sources.filter((s) => s.stages.includes(v)).map((s) => s.id))),
 
 
852
  };
853
- const parts = keys.filter((k) => F[k]).map((k) => `(${sqlOf[k](F[k])})`);
854
  return parts.length ? `WHERE ${parts.join('\n AND ')}` : '';
855
  }
856
 
@@ -882,8 +1056,9 @@ function sortValue(s, k) {
882
  case 'title': return titleOf(s).toLowerCase();
883
  case 'domain': return sourceDomainText(s).toLowerCase();
884
  case 'form': return formName(formKeyOf(s)).toLowerCase();
885
- // units of material sets above rows of corpora (never compared as one count): a corpus has fewer than 1e12 rows
886
- case 'units': return s.isTask ? 1e12 + s.readyUnits : s.rawRows;
 
887
  case 'size': return s.distinct ?? -1;
888
  case 'tier': return tierName(s.tier).toLowerCase();
889
  case 'fit': return fitScore(s);
@@ -902,7 +1077,7 @@ function sizeCell(s) {
902
  // #364, #1158: the same words as docs/sources.md of the index (artpool/projection_templates/text.json, size_text), in
903
  // the locale files as size.*
904
  /** The size note under the list: the size of the layer shown (meta/size_figures.json, IX.sizes; #2422: its deduplicated
905
- * size), with the estimate for its rows without a recorded size. */
906
  function sizeNote() {
907
  const g = IX.sizes?.[F.kind];
908
  if (!g) return t('size.none');
@@ -922,13 +1097,15 @@ function collectionRank(s) {
922
  const i = IX.vocab.collections.findIndex((c) => c.code === s.collection);
923
  return i < 0 ? IX.vocab.collections.length : i;
924
  }
925
- /** The list of the selection, one layer: material sets grouped by collection (a header row per collection, in the
926
- * vocabulary's order), corpora as one list, or (#1633) grouped the same way when a collection lists some of them;
927
- * the heading names the layer shown only. */
 
928
  function renderSources(sel) {
929
  if (!UI.ids) return;
930
  const dir = F.dir === 'asc' ? 1 : -1;
931
- const sets = F.kind !== CORPUS;
 
932
  const grouped = sets || sel.some((s) => s.collection);
933
  const byColl = (a, b) => (grouped ? collectionRank(a) - collectionRank(b) : 0);
934
  const list = [...sel].sort((a, b) => {
@@ -936,7 +1113,7 @@ function renderSources(sel) {
936
  const y = sortValue(b, F.sort);
937
  return byColl(a, b) || (x < y ? -1 : x > y ? 1 : 0) * dir || titleOf(a).localeCompare(titleOf(b));
938
  });
939
- $('sources-h').textContent = !sel.length ? t('sources.none')
940
  : sets ? t('sources.headSets', { sets: plural('n.materialSet', sel.length) }) : t('sources.headCorpora', { corpora: plural('n.corpus', sel.length) });
941
  const body = clear($('sources-body'));
942
  if (!sel.length) return;
@@ -961,7 +1138,7 @@ function renderSources(sel) {
961
  el('button', { type: 'button', onclick: () => {
962
  const d = on ? (F.dir === 'asc' ? 'desc' : 'asc') : (c.r || c.key === 'fit' ? 'desc' : 'asc');
963
  F.sort = c.key; F.dir = d; writeUrl(); renderSources(selected());
964
- } }, t(c.key === 'units' && !sets ? 'col.rows' : `col.${c.key}`), on ? (F.dir === 'asc' ? ' ↑' : ' ↓') : ''),
965
  c.key === 'fit' ? fitHeads() : null);
966
  }));
967
  const tbody = el('tbody');
@@ -976,7 +1153,7 @@ function renderSources(sel) {
976
  tbody.append(el('tr', { class: 'group-row' }, el('th', { colspan: String(COLS.length), scope: 'colgroup' },
977
  sets && group ? el('button', { type: 'button', class: 'group-btn', 'aria-pressed': String(cur), title: t(cur ? 'coll.showing' : 'coll.open'),
978
  onclick: () => setFilter({ collection: cur ? '' : group }) }, cur ? icon('check', { size: 16 }) : null, name) : name,
979
- el('span', { class: 'small' }, plural(sets ? 'n.materialSet' : 'n.corpus', inColl.get(group))))));
980
  }
981
  const open = F.open === s.id;
982
  const toggle = () => openSource(open ? '' : s.id);
@@ -999,7 +1176,12 @@ function renderSources(sel) {
999
  el('td', { 'data-label': label(t('col.domain')), class: 'cat-cell' }, sourceDomainText(s)),
1000
  oneForm(s) ? el('td', { class: 'form-cell form-same' })
1001
  : el('td', { 'data-label': label(t('col.form')), class: 'form-cell' }, formIcon(formKeyOf(s), { size: 16 }), formName(formKeyOf(s))),
1002
- el('td', { class: 'r num', 'data-label': label(s.isTask ? t('sources.unitsLabel') : t('sources.rowsLabel')) }, s.isTask
 
 
 
 
 
1003
  ? (s.readyUnits == null ? t('n.notCounted') : [fmtInt(s.readyUnits), el('span', { class: 'unit-word' }, t('sources.unitWord', { count: s.readyUnits }))])
1004
  : el('span', { class: 'muted' }, fmtCompact(s.rawRows), el('span', { class: 'unit-word' }, t('sources.corpusWord', { count: s.rawRows })))),
1005
  el('td', { class: 'r num size-cell', 'data-label': label(t('col.size')), title: s.size ? sizeLine(s.size, false) : null }, sizeCell(s)),
@@ -1015,7 +1197,7 @@ function renderSources(sel) {
1015
  const wide = !matchMedia(PHONE).matches;
1016
  body.append(el('details', { class: 'list-key-fold', open: wide || UI.fitKeyOpen, ontoggle: (e) => { if (!wide) UI.fitKeyOpen = e.currentTarget.open; } },
1017
  el('summary', {}, t('sources.aboutFit')),
1018
- el('div', { class: 'list-key' }, kindKey([F.kind]), el('span', { class: 'small' }, t('sources.fitKey')), FIT.map((x) => el('span', { class: 'fit-name' }, icon(x.icon, { size: 14 }), fitLabel(x.k))), fitKey())));
1019
  body.append(el('table', { class: 'src-table' }, el('caption', { class: 'visually-hidden' }, kindName(F.kind)), el('thead', {}, head), tbody));
1020
  body.append(el('div', { class: 'small size-note' }, el('p', {}, sizeNote()), sizeHow()));
1021
  if (list.length > FIRST_ROWS) {
@@ -1117,10 +1299,12 @@ function fromWords(addresses, upstream, publishers) {
1117
  if (!site) return [];
1118
  return publishers > 1 ? [`${t('detail.publishers', { count: publishers, n: fmtInt(publishers) })} `, site] : [site];
1119
  }
1120
- function upstream(uri) {
 
 
1121
  if (!uri) return null;
1122
  if (/^https?:\/\//.test(uri)) return uri;
1123
- if (uri.startsWith('campaign_files/')) return fileUrl(IX.sha, uri);
1124
  const s3 = uri.match(/^s3:\/\/([^/]+)\/(.*)$/);
1125
  if (s3) return `https://${s3[1]}.s3.amazonaws.com/${s3[2]}`;
1126
  return null;
@@ -1167,14 +1351,18 @@ function shareBar(parts, total) {
1167
  function item(iconName, label, ...value) {
1168
  return el('div', { class: 'd-item' }, el('dt', {}, icon(iconName, { size: 18 }), label), el('dd', {}, ...value));
1169
  }
1170
- /** The labels of corpus s: the labels' model and its units at or above each leaf's threshold (meta/labels.json
1171
- * sources), the most first; the labels of its first units (got: the first rows of its first label file, 'loading' until
1172
- * read, {error} when they could not be), one line per unit with each leaf's score, in bold at or above that leaf's
1173
- * threshold, and its class; and the command that takes its units of the leaf it holds the most of. */
 
 
1174
  function labelItem(s, got) {
1175
  const leaves = IX.labels?.leaves || {};
1176
  const held = Object.entries(s.labelled || {}).map(([leaf, n]) => [leaf, num(n) || 0]).sort((a, b) => b[1] - a[1]);
 
1177
  const out = [el('span', { class: 'small' }, t('detail.labelModel', { model: IX.labels?.model ?? t('common.unknown') })),
 
1178
  el('span', { class: 'chips' }, held.map(([leaf, n]) => el('span', { class: 'chip' }, `${leafName({ leaf })} ${fmtInt(n)}`)))];
1179
  if (got === 'loading') out.push('\u2026');
1180
  else if (got?.error) out.push(el('span', { class: 'problem-text' }, got.error));
@@ -1186,18 +1374,19 @@ function labelItem(s, got) {
1186
  }
1187
  const label = (r) => {
1188
  const bar = leaves[r.leaf]?.threshold;
1189
- const text = `${r.leaf} ${num(r.score).toFixed(2)}`;
 
1190
  return el('span', { class: 'chip', title: leafName({ leaf: r.leaf }) },
1191
- bar != null && num(r.score) >= num(bar) ? el('b', {}, text) : text, r.class ? ` \u00b7 ${r.class}` : '');
1192
  };
1193
  const shown = [...units].slice(0, FIRST_ROWS);
1194
  out.push(el('div', { class: 'table-wrap sample' }, table([t('th.unit'), t('th.labels')],
1195
  shown.map(([u, ls]) => [el('span', { class: 'mono', title: String(u) }, shortUri(String(u))),
1196
- el('span', { class: 'chips' }, [...ls].sort((a, b) => num(b.score) - num(a.score)).map(label))]),
1197
- t('detail.labelsFirst', { n: fmtInt(shown.length) }))));
1198
  }
1199
  if (held.length) {
1200
- const cmd = command(commandArgs({ kind: CORPUS, sources: [s.id], leaf: held[0][0], sample: F.sample || DEFAULT_SAMPLE[CORPUS] }));
1201
  out.push(el('span', { class: 'small' }, t('detail.takeLeaf', { leaf: leafName({ leaf: held[0][0] }) })),
1202
  el('code', { class: 'cmd-inline' }, cmd), copyButton(t('copy.button'), cmd));
1203
  }
@@ -1215,7 +1404,9 @@ function detail(s) {
1215
  const ownRows = (rows) => rows.filter((r) => r.source === s.id);
1216
  if (!st.sample && s.files.length) {
1217
  st.sample = 'loading';
1218
- const cols = s.isTask ? [...ROW_COLUMNS, 'extra'] : ROW_COLUMNS;
 
 
1219
  const unitFile = s.files[0];
1220
  readColumns(fileUrl(IX.sha, unitFile.path), cols, rowsOf(unitFile, FIRST_ROWS))
1221
  .then((r) => { st.sample = ownRows(r.rows); st.file = unitFile.path; redraw(); }, (e) => { st.sample = { error: e.message }; redraw(); });
@@ -1254,7 +1445,8 @@ function detail(s) {
1254
  const ups = upstreamsOfRows(metas);
1255
  const names = publisherNames(metas);
1256
  const allRead = rows.length >= s.rows;
1257
- const counted = s.isTask ? t('n.unitsFiles', { units: unitsText(s.readyUnits), files: plural('n.file', s.rows) }) : plural('n.corpusRow', s.rawRows);
 
1258
  // #2066: in the page's language (descriptionOf); the sentence admission writes (ADMIT_WHAT) is recognized in English
1259
  const own = s.description && !ADMIT_WHAT.test(s.description) ? descriptionOf(s) : '';
1260
  const text = own
@@ -1262,16 +1454,21 @@ function detail(s) {
1262
  : s.publishers ? t('detail.countsFrom', { what: counted, publishers: plural('n.publisher', s.publishers) })
1263
  : t('detail.counts', { what: counted }));
1264
  dl.append(item('doc', t('detail.what'), text.length > 160 ? el('details', {}, el('summary', {}, firstSentence(text)), el('p', {}, text)) : text));
1265
- // 2 a material set's units and files, what each row of a corpus points to (#2065: a corpus is counted in rows)
 
1266
  const kindCount = (k) => {
1267
  const n = num(s.info.unit[k]);
1268
  return t(UNIT_KIND[k] ? `unitCount.${UNIT_KIND[k]}` : 'unitCount.code', { count: n, n: fmtCompact(n), kind: k });
1269
  };
1270
- const unitWhat = s.isTask
1271
- ? [el('span', { class: 'chips' }, el('span', { class: 'chip' }, unitsText(s.readyUnits)), el('span', { class: 'chip' }, plural('n.file', s.rows)))]
1272
- : [el('span', {}, sentence(fmtOr(s.kinds.map((k) => (UNIT_KIND[k] ? t(`unitKind.${UNIT_KIND[k]}`) : k))))),
1273
- el('span', { class: 'chips' }, s.kinds.map((k) => el('span', { class: 'chip' }, kindCount(k))))];
1274
- dl.append(item('rows', t(s.isTask ? 'detail.files' : 'detail.oneUnit'), ...unitWhat));
 
 
 
 
1275
  // 3 where it comes from (#1197: in words): the number of its publishers (#1256: the catalog's) and the main site of
1276
  // its upstreams, else of the addresses of its rows
1277
  const from = ups.length ? fromWords(ups, true, s.publishers) : fromWords(rows.map((r) => r.uri), false, s.publishers);
@@ -1279,12 +1476,15 @@ function detail(s) {
1279
  // #2588: the upstream it declares, one dataset or one catalog with its agent and entry address (each of them while
1280
  // it still reads several)
1281
  if (s.upstream) dl.append(item('pin', t('detail.upstream'), upstreamLines(s.upstream)));
 
 
1282
  // 4 self-contained; #1216: the fit chip's answer (fit.alone), with the files of the source a material set of a
1283
  // collection comes with (a license and a readme leave a unit usable alone): its rows read without a unit
1284
  const comps = [...new Set(rows.filter((r, i) => !isUnit(metas[i])).map((r) => r.uri.split('/').pop()))];
1285
  const compChips = () => el('span', { class: 'chips' }, (comps.length ? comps : ['LICENSE', 'README.md']).map((c) => el('span', { class: 'chip mono-chip' }, c)));
1286
  const ofCollection = !!(info.campaign || info.extended_by);
1287
- dl.append(item('layers', t('detail.alone'), s.isTask
 
1288
  ? (fit.alone !== 'yes' ? [el('span', {}, t('detail.withCompanions')), compChips()]
1289
  : ofCollection ? [el('span', {}, t('detail.alsoWith')), compChips()] : t('detail.yes'))
1290
  : fit.alone === 'yes' ? t('detail.eachFile') : t('detail.container')));
@@ -1316,11 +1516,12 @@ function detail(s) {
1316
  const permit = (field) => PERMIT_ORDER.map((k) => {
1317
  const names = behind(field, k);
1318
  return { k, value: num(lr[field]?.[k]?.rows) || 0, color: PERMIT_COLOR[k], label: permitLabel(k, names),
1319
- note: t(`detail.shareOf${s.isTask ? 'Set' : 'Corpus'}${names.length ? '' : 'Only'}`, { licences: names.join(', ') }) };
1320
  });
1321
  // #1197: one line when every row allows both, the two bars when its rows differ
1322
  const allAllowed = (field) => permit(field).every((x) => (x.k === 'yes' ? x.value > 0 : !x.value));
1323
- // #1266: a material set's licence by kind of file, as the projection counted it (license_counts): per kind its
 
1324
  // files, the permit classes for training and for redistribution as "x / y files" with the licences behind each, or
1325
  // one phrase when all its files allow both
1326
  const spdxOf = (xs) => [...new Set(xs.map((x) => x.spdx).filter(Boolean))].sort();
@@ -1342,7 +1543,7 @@ function detail(s) {
1342
  return el('span', { class: 'lic-kind' }, head, classes('training_ok', t('detail.training')), classes('redistribution_ok', t('detail.shipping')));
1343
  };
1344
  dl.append(item('training', t('detail.licence'), el('span', { class: 'lic' }, el('b', {}, tierName(s.tier)), el('span', { class: 'small' }, lic.name || s.spdx || '')),
1345
- s.isTask && s.licenceCounts ? el('span', { class: 'lic-kinds' }, FILE_KINDS.map(kindLine))
1346
  : allAllowed('training_ok') && allAllowed('redistribution_ok') ? el('span', { class: 'small' }, t('detail.allAllowed'))
1347
  : el('span', { class: 'lic-bars' },
1348
  el('span', { class: 'mini-title' }, t('detail.training')), shareBar(permit('training_ok'), s.rows),
@@ -1354,11 +1555,13 @@ function detail(s) {
1354
  ? el('span', { class: 'chips' }, s.stages.map((id) => el('span', { class: 'chip' }, stageName(id))))
1355
  : t('detail.stagesNone'), el('span', { class: 'small' }, t('stage.version', { v: IX.stages.version }))));
1356
  }
1357
- // its labels, for a corpus whose units the commit labels (labelItem)
1358
- if (s.labelFiles.length) dl.append(item('layers', t('detail.labels'), ...labelItem(s, st.labels)));
 
1359
  // 7 size and units
1360
  const q = info.size_quantiles_upper_bytes || {};
1361
- const amounts = s.isTask ? `${unitsText(s.readyUnits)} · ${plural('n.file', s.rows)}` : plural('n.corpusRow', s.rawRows);
 
1362
  // #1158: the source's figures of meta/size_figures.json; #2422: its size first, the deduplicated one
1363
  dl.append(item('size', t('detail.size'), el('span', { class: 'lic' }, el('b', {}, s.size ? sizeOf(s.size) : t('size.none')),
1364
  el('span', { class: 'small' }, amounts), s.size ? el('span', { class: 'small size-parts' }, sizeParts(s.size, false).join(' \u00b7 ')) : null),
@@ -1383,15 +1586,15 @@ function detail(s) {
1383
  if (pv === 'loading') dl.append(item('link', t('detail.example'), '…'));
1384
  else if (pv.error) dl.append(item('link', t('detail.example'), el('span', { class: 'problem-text' }, pv.error)));
1385
  else if (r) {
1386
- const href = upstream(r.uri);
1387
  const name = r.member_path || r.uri.split('/').pop() || r.uri;
1388
  dl.append(item('link', t('detail.example'), el('span', { class: 'example' },
1389
  href ? el('a', { href, rel: 'noopener', class: 'mono' }, name) : el('span', { class: 'mono' }, name),
1390
  r.size_bytes != null ? el('span', { class: 'small' }, ` · ${fmtBytes(num(r.size_bytes))}`) : null)));
1391
  }
1392
  // 9 the command that takes this source: #2629: a material set whole, with its units and its size beside it; a corpus,
1393
- // whose whole can be petabytes, by the units choice (the reader's, else 3 per source)
1394
- const cmd = command(commandArgs({ sources: [s.id], sample: s.isTask ? 'all' : F.sample || DEFAULT_SAMPLE[CORPUS] }));
1395
  dl.append(item('run', t('detail.take'), el('code', { class: 'cmd-inline' }, cmd), copyButton(t('copy.button'), cmd),
1396
  s.isTask ? el('span', { class: 'small' }, s.size ? t('detail.takeWhole', { units: unitsText(s.readyUnits), size: sizeOf(s.size) })
1397
  : t('detail.takeWholeNoSize', { units: unitsText(s.readyUnits) })) : null));
@@ -1462,8 +1665,11 @@ function selectionSql(sel) {
1462
  const chips = filterChips();
1463
  const exts = extList();
1464
  const where = [`source IN (${ids})`, ...(exts.length ? [`ext IN (${exts.map(sqlStr).join(', ')})`] : [])];
1465
- // the selection is one layer: its sources in that layer's measure
1466
- const head = F.kind === CORPUS
 
 
 
1467
  ? t('sql.headCorpora', { sha: IX.sha.slice(0, 7), corpora: plural('n.corpus', sel.length), rows: plural('n.corpusRow', sum(sel, (s) => s.rawRows)) })
1468
  : t('sql.headSets', { sha: IX.sha.slice(0, 7), sets: plural('n.materialSet', sel.length), units: unitsOfSets(sel) });
1469
  return [
@@ -1533,7 +1739,7 @@ function folderTree(sel) {
1533
  ...(IX.vocab.profile.length ? [el('p', { class: 'chart-title profile-title' }, t('tree.leftOut')),
1534
  el('ul', { class: 'profile' }, IX.vocab.profile.map(({ criterion, option }) => el('li', {}, el('span', {}, t(`profile.${criterion}`)), el('code', {}, option)))),
1535
  el('p', { class: 'small tree-note' }, t('tree.flagNote'))] : []),
1536
- el('p', { class: 'small tree-note' }, t('tree.labelNote'), ' ', el('code', {}, '--training-only'), ' ', el('code', {}, '--no-personal-data')),
1537
  el('p', { class: 'small agent-links' }, icon('robot', { size: 16 }),
1538
  el('a', { href: t('url.forAgents') }, t('agents.readme')), ' · ', el('a', { href: 'llms.txt' }, 'llms.txt')));
1539
  }
@@ -1546,14 +1752,15 @@ function download(name, text, type) {
1546
  // command beside it names too; tools/fetch.py --selection reads it, so the same file gives the same files later) and
1547
  // the attribution file (per source its title, licence and attribution statement from meta/sources.json; #1577: and
1548
  // its files by publisher, licence and licence URL from meta/attribution.parquet, each file's own, else its source's;
1549
- // in English, the language of the dataset)
 
1550
  const selectionName = () => `training-data-foundation-selection-${IX.sha.slice(0, 7)}.json`;
1551
  const ATTRIBUTION = 'meta/attribution.parquet';
1552
  const ATTRIBUTION_COLUMNS = ['source', 'publisher', 'license', 'license_url', 'files'];
1553
  function selectionFile(sel, picks) {
1554
  return `${JSON.stringify({
1555
  format: 'training-data-foundation-selection/1', dataset: REPO, revision: IX.pin,
1556
- filters: picks ? {} : Object.fromEntries([...activeFilters(), 'kind'].map((k) => [k, F[k]])), sources: sel.map((s) => s.id).sort(),
1557
  }, null, 1)}\n`;
1558
  }
1559
  async function attributionFile(sel) {
@@ -1608,8 +1815,8 @@ function keepCard(sel, picks = false) {
1608
  el('p', { class: 'small' }, el('code', {}, selectionName()), ' ', t('keep.selectionNote', { sources: plural(picks ? 'n.picked' : layerCount(), sel.length), sha: IX.sha.slice(0, 7) }))),
1609
  codeCard('run', t('keep.again'), selectionCommand(picks), 2));
1610
  }
1611
- /** The key of the count word of the layer shown: n.materialSet or n.corpus. */
1612
- const layerCount = () => (F.kind === CORPUS ? 'n.corpus' : 'n.materialSet');
1613
  function codeCard(iconName, title, code, n) {
1614
  return el('div', { class: 'code-card' },
1615
  el('div', { class: 'code-head' }, el('span', { class: 'code-ico' }, icon(iconName, { size: 20 })),
@@ -1650,7 +1857,7 @@ function takeHeading(sources) {
1650
  function chooseSample(v) {
1651
  F.sample = v === DEFAULT_SAMPLE[takenKind()] ? '' : v;
1652
  writeUrl();
1653
- vt(() => { renderGet(selected()); renderSources(selected()); });
1654
  }
1655
  function unitsChoice() {
1656
  return el('div', { class: 'units-row' }, segmented(t('get.units'), SAMPLES.map((v) => [v, v === 'all' ? t('get.unitsAll') : v]), sampleNow(), chooseSample));
@@ -1674,28 +1881,30 @@ function renderPicks(picks) {
1674
  body.append(...commandSteps(commandArgs({ sources: picks.map((s) => s.id) }), picks));
1675
  body.append(keepCard(picks, true));
1676
  }
1677
- /** Get the data: the selection is one layer, so one command takes it (#1083); the other layer is one switch away.
1678
- * Picked sources, when there are any, take its place (renderPicks). */
 
1679
  function renderGet(sel) {
1680
  if (!UI.ids) return;
1681
  const picks = picked();
1682
  renderDock(sel, picks);
1683
  if (picks.length) { renderPicks(picks); return; }
 
1684
  const ready = sum(sel, (s) => s.readyUnits);
1685
  const raw = sum(sel, (s) => s.rawRows);
1686
  const other = F.kind === CORPUS ? MATERIAL_SET : CORPUS;
1687
  $('get-h').textContent = !sel.length ? t('get.nothing') : takeHeading(sel.length === 1 ? null : plural(layerCount(), sel.length));
1688
  const body = clear($('get-body'));
1689
- const switchOther = el('button', { type: 'button', class: 'link', onclick: () => setLayer(other) }, t('get.otherLayer', { name: kindName(other) }));
1690
- if (!sel.length) { body.append(el('p', { class: 'small' }, switchOther)); return; }
1691
  const chips = filterChips();
1692
  const tabs = segmented('', [['cmd', t('get.command')], ['sql', 'SQL'], ['csv', 'CSV']], UI.tab, (v) => { UI.tab = v; vt(() => renderGet(selected())); });
 
 
1693
  const pickRow = el('div', { class: 'pick-row' },
1694
- el('span', { class: 'fact-line' }, icon('sources', { size: 18 }), el('b', {}, fmtInt(sel.length)), t(F.kind === CORPUS ? 'get.corpusWord' : 'get.setWord', { count: sel.length })),
1695
- F.kind === CORPUS
1696
- ? el('span', { class: 'fact-line muted' }, icon('rows', { size: 18 }), el('b', {}, fmtCompact(raw)), t('cat.lead.raw', { count: raw }))
1697
- : el('span', { class: 'fact-line' }, icon('check', { size: 18 }), el('b', {}, fmtInt(ready)), t('cat.lead.ready', { count: ready }) + uncounted(notCountedOf(sel))),
1698
- el('span', { class: 'chips' }, el('span', { class: 'chip' }, kindName(F.kind)), ...chips.map(([k, v]) => el('span', { class: 'chip', title: k }, v))),
1699
  el('a', { class: 'small', href: '#filters' }, t('get.change')), switchOther, tabs);
1700
  body.append(pickRow);
1701
  if (UI.tab === 'cmd') {
@@ -1715,7 +1924,7 @@ function renderGet(sel) {
1715
  const say = (text) => { csvState.textContent = text; UI.csv = { key, text }; };
1716
  try {
1717
  const csv = await buildCsv(sel, (d, n) => say(t('csv.progress', { count: n, done: fmtInt(d), n: fmtInt(n) })));
1718
- download(`${REPO.split('/')[1]}-${IX.sha.slice(0, 7)}-${sel.length === 1 ? sel[0].id : `${sel.length}-${F.kind === CORPUS ? 'corpora' : 'material-sets'}`}.csv`, csv, 'text/csv');
1719
  say(plural('n.pointerRow', csv.split('\n').length - 2));
1720
  } catch (e) { say(e.message); }
1721
  btn.disabled = false;
@@ -1742,9 +1951,6 @@ const stillMotion = () => matchMedia('(prefers-reduced-motion: reduce)').matches
1742
  /** The stage group of a source among the stages ids (the stage table's order): its first stage, else the last group,
1743
  * in no stage. */
1744
  const groupOf = (s, ids) => { const g = ids.findIndex((id) => s.stages.includes(id)); return g < 0 ? ids.length : g; };
1745
- // #2629: why something is in no stage (artpool.stages.NO_STAGE, the keys of no_stage of the stage figures), each by the
1746
- // key of its words; a reason the page does not know is said by its name
1747
- const WHY_KEY = { condition: 'condition', ...RULE_KEY, 'not counted': 'notCounted' };
1748
  // the color of a source's dot in the list: the picked stage's while the source feeds it, else its first stage's
1749
  const groupColor = (s, ids) => stageColor(F.stage && s.stages.includes(F.stage) ? F.stage : ids[groupOf(s, ids)]);
1750
  /** The points of the field: one per source and stage it feeds (a corpus that feeds two stages stands on both planes
@@ -1784,28 +1990,13 @@ function fieldLevels() {
1784
  return picked >= 0 && p.g !== picked ? HALF : 1;
1785
  });
1786
  }
1787
- /** #1083: what no stage counts, said per layer and never as one number: that of the layer shown. #2629: from the
1788
- * release's figures (no_stage of meta/stage_figures.json, data.js noStage): its sources as the figure, its units or
1789
- * corpus rows in the line under it, and its sources by reason as the steps (the condition, each rule, not counted yet;
1790
- * a reason of none left out), its units or rows by reason on hover; so post-training's figure plus these is what the
1791
- * selection of every material set counts. Figures written before #2629 give the sources of the layer shown in no
1792
- * stage, without reasons. */
1793
  function restWhat() {
1794
- const sets = F.kind !== CORPUS;
1795
- const head = { name: t('strata.rest'), title: t('strata.restTitle') };
1796
- const sourcesWord = (n) => t(sets ? 'get.setWord' : 'get.corpusWord', { count: n });
1797
- const reasons = Object.entries(IX.stageFigures?.noStage?.[F.kind] || {});
1798
- if (!reasons.length || reasons.some(([, c]) => Object.values(c).some((v) => v == null))) {
1799
- const here = IX.sources.filter((s) => !s.stages.length && s.kind === F.kind).length;
1800
- return { ...head, num: fmtInt(here), word: sourcesWord(here), line: '', steps: [] };
1801
- }
1802
- const [many, amount] = sets ? ['material_sets', 'units'] : ['corpora', 'rows'];
1803
- const fmt = sets ? fmtInt : fmtCompact;
1804
- const said = (m, f) => reasons.filter(([, c]) => c[m]).map(([why, c]) => t(`strata.why.${WHY_KEY[why] || 'other'}`, { count: c[m], n: f(c[m]), why }));
1805
- const n = sum(reasons, ([, c]) => c[many]);
1806
- const left = sum(reasons, ([, c]) => c[amount]);
1807
- return { ...head, title: `${head.title}\n${t(sets ? 'strata.whyUnits' : 'strata.whyRows', { list: said(amount, fmt).join(t('size.listSep')) })}`,
1808
- num: fmtInt(n), word: sourcesWord(n), line: t(sets ? 'strata.restUnits' : 'strata.restRows', { count: left, n: fmt(left) }), steps: said(many, fmtInt) };
1809
  }
1810
  /** The labels of the field in the page's language: per stage group its figure and name at its plane and its name at
1811
  * its lane, the domains' names, and the marks of the size axis. */
@@ -1870,7 +2061,7 @@ async function startField() {
1870
  FIELD = await mod.createField(host, {
1871
  points: fieldPts, colors: [...ids.map(stageColor), '--none'], cells: doms.length, view: F.view,
1872
  room: fieldRoom,
1873
- tip: (i) => { const s = at(i); return [titleOf(s), [sourceDomainText(s), kindOne(s.kind), s.size ? sizeOf(s.size) : null].filter(Boolean).join(' · ')]; },
1874
  onHover: (i) => { const id = i < 0 ? null : at(i).id; for (const b of $('sel-list').querySelectorAll('.src')) b.classList.toggle('hot', b.dataset.id === id); },
1875
  onPick: (i) => focusSource(at(i)),
1876
  onTouch: () => $('top').classList.add('touched'),
@@ -1904,18 +2095,20 @@ function countTo(node, to) {
1904
  };
1905
  requestAnimationFrame(step);
1906
  }
1907
- /** The right panel: how many sources of the layer shown the selection holds, with their units or rows and the domains
1908
- * they cover; its largest sources, each with its stage group's dot, its domain, its units and its size (a bar on a
1909
- * logarithmic scale); and the light of the field's points. */
1910
  function renderWork(sel) {
1911
  if (!UI.ids) return;
1912
- const sets = F.kind !== CORPUS;
 
1913
  countTo($('sel-n'), sel.length);
1914
- $('sel-word').textContent = t(sets ? 'get.setWord' : 'get.corpusWord', { count: sel.length });
1915
  const ready = sum(sel, (s) => s.readyUnits);
1916
  const raw = sum(sel, (s) => s.rawRows);
1917
  const covered = new Set(sel.flatMap((s) => s.tops)).size;
1918
- const meta = [sets ? [fmtInt(ready), t('cat.lead.ready', { count: ready }) + uncounted(notCountedOf(sel))] : [fmtCompact(raw), t('cat.lead.raw', { count: raw })],
 
1919
  [fmtInt(covered), t('strata.domains', { count: covered })]];
1920
  clear($('sel-meta')).append(...meta.map(([n, word]) => el('span', {}, el('b', {}, n), ' ', word)));
1921
  const ids = stageFigList().map((s) => s.id);
@@ -1927,7 +2120,7 @@ function renderWork(sel) {
1927
  onclick: () => focusSource(s), onpointerenter: () => FIELD?.hover(pointOf(s.id)), onpointerleave: () => FIELD?.hover(-1) },
1928
  el('span', { class: 'dot', 'aria-hidden': 'true' }),
1929
  el('span', { style: 'min-width: 0' }, el('span', { class: 't' }, titleOf(s)),
1930
- el('span', { class: 's' }, [sourceDomainText(s), s.isTask ? unitsText(s.readyUnits) : plural('n.corpusRow', s.rawRows)].join(' · '))),
1931
  el('span', { class: 'sz' }, s.size ? sizeOf(s.size) : ''),
1932
  el('span', { class: 'barw', 'aria-hidden': 'true' }, el('u', { style: `width: ${Math.max(2, (lg(s) / most) * 100).toFixed(0)}%` }))))));
1933
  if (!sel.length) list.append(el('li', {}, el('p', { class: 'src-none' }, t('sources.none'))));
@@ -1948,9 +2141,12 @@ function renderCard() {
1948
  clear(box);
1949
  if (!s) return;
1950
  const stages = s.stages.length ? s.stages.map(stageName).join(t('size.listSep')) : t('strata.rest');
1951
- const rows = [[t('col.domain'), sourceDomainText(s)], [t('strata.layer'), kindOne(s.kind)], [t('col.form'), formName(formKeyOf(s))],
1952
- s.isTask ? [t('col.units'), unitsNum(s.readyUnits)] : [t('col.rows'), fmtCompact(s.rawRows)],
1953
- [t('col.size'), s.size ? sizeOf(s.size) : t('common.unknown')], [t('col.tier'), tierName(s.tier)], [t('filter.stage'), stages]];
 
 
 
1954
  const isPicked = pickIds().includes(s.id);
1955
  box.append(el('div', { class: 'card-s' },
1956
  el('button', { type: 'button', class: 'x', 'aria-label': t('strata.close'), title: t('strata.close'), onclick: () => openSource('') }, '×'),
@@ -2039,12 +2235,12 @@ function renderHeader() {
2039
  markFromIndex();
2040
  renderStageFig();
2041
  renderTerms();
2042
- drawRelease(IX.pin, IX.releaseDate);
2043
  $('foot-pin').textContent = t('foot.index', { sha: IX.sha.slice(0, 7), date: fmtDate(IX.date) });
2044
- if (IX.overrides.catalog || IX.overrides.vocabulary) {
2045
  const chip = $('preview-chip');
2046
  clear(chip).append(el('span', { class: 'dot other', 'aria-hidden': 'true' }), t('hero.preview'));
2047
- chip.title = [IX.overrides.catalog, IX.overrides.vocabulary].filter(Boolean).join(' ');
2048
  chip.hidden = false;
2049
  }
2050
  }
@@ -2148,6 +2344,7 @@ function renderLanguage() {
2148
  renderHeader();
2149
  renderFewest();
2150
  renderLeaves();
 
2151
  fillFilterOptions();
2152
  drawDockSample();
2153
  FIELD?.setLabels(fieldLabels());
@@ -2231,6 +2428,10 @@ async function main() {
2231
  // without stages every source is in one stage group, so the field starts by domain unless the address names an
2232
  // arrangement
2233
  if (!IX.stages && !new URLSearchParams(location.search).get('view')) F.view = 'domains';
 
 
 
 
2234
  if (F.stage && stageKind(F.stage) !== F.kind) {
2235
  F.kind = stageKind(F.stage);
2236
  if (F.kind === CORPUS) F.collection = '';
@@ -2244,6 +2445,7 @@ async function main() {
2244
  renderMapHead([]);
2245
  renderFewest();
2246
  renderLeaves();
 
2247
  for (const b of $('layer-seg').querySelectorAll('button')) b.addEventListener('click', () => setLayer(b.dataset.kind));
2248
  for (const b of $('metric-seg').querySelectorAll('button')) {
2249
  b.addEventListener('click', () => { F.metric = b.dataset.metric; writeUrl(); drawCharts(); renderMapHead(selected()); });
 
4
  // charts) and Get the data (the one command and the selection file). The dataset card is the overview; this page is
5
  // where data is picked and taken.
6
  // Figures first, few words; every chart keeps a short label and a table view. The charts of Pick, its filter counts and
7
+ // the list of selected sources come from one crossfilter selection (linked.js). An index commit of one kind of source
8
+ // (data.js oneKind: its catalog has no column kind, or its labels are labels by method) shows every source in one list,
9
+ // counted in units and rows, and takes task material by label (--leaf, --method). On an older commit the two layers
10
+ // stay apart everywhere and are never added together (#1083): material sets, grouped into collections and counted in
11
+ // sets and units, in the main color; corpora, counted in rows, in gray. Pick then shows one layer at a time (F.kind,
12
+ // material sets by default; a training stage takes the layer it counts).
13
  import {
14
+ CORPUS, DATASET_URL, FACET_FORMAL, FACET_IDS, fileUrl, KINDS, LABEL_METHODS, loadBatchDates, loadIndex, MATERIAL_SET, num,
15
+ readColumns, REPO, SOURCE, summed, topOf, wholeFile,
16
  } from './data.js';
17
  import {
18
  clear, el, figureWithToggle, fmtAnd, fmtBytes, fmtCompact, fmtDate, fmtInt, fmtOr, fmtPct, fmtShare, fmtShort,
19
  segmented, table, tableShown, vt,
20
  } from './charts.js';
21
+ import { decorate, drawRelease, drawStages, markFromIndex, sizeLine, sizeOf, sizeParts, stageColor, stageWhat } from './first.js';
22
  import { lang, onLanguage, setUpSwitch, t, tEn, translatePage } from './i18n.js';
23
  import { formIcon, icon } from './icons.js';
24
 
 
26
  const ROW_COLUMNS = ['source', 'batch', 'uri', 'range_offset', 'range_length', 'member_path', 'size_bytes', 'sha256'];
27
  const FIRST_ROWS = 20;
28
  // the columns of a source's label files (labels/<source>/*.parquet) its detail reads, and how many of the first file's
29
+ // rows (one per unit, leaf and method labelled; a file of meta/labels.json format /1 has no method)
30
+ const LABEL_COLUMNS = ['unit_id', 'leaf', 'method', 'score', 'class'];
31
  const LABEL_ROWS = 200;
32
  const HEAT_FORMS = 8;
33
  const FORM_BARS = 10;
34
  // #1524: how many units Get the data takes from each source (--sample N; all: no --sample, #1891); #2629: when the
35
  // reader has not chosen (sample in the address), every unit of material sets, whose whole is small, and 3 of each
36
+ // corpus, whose whole can be petabytes (DEFAULT_SAMPLE by the layer the command takes, sampleNow); of one kind, 3 of
37
+ // each source, as any of them can be a whole upstream
38
  const SAMPLES = ['1', '3', '10', '30', 'all'];
39
+ const DEFAULT_SAMPLE = { [MATERIAL_SET]: 'all', [CORPUS]: '3', [SOURCE]: '3' };
40
  const MAX_FILE = 20e6;
41
  const MAX_LISTED = 30;
42
  // the phone layout of style.css
 
112
  const unitsText = (n, missing = 0) => (n == null ? t('n.unitsNotCounted') : plural('n.unit', n) + uncounted(missing));
113
  const unitsNum = (n) => (n == null ? t('n.notCounted') : fmtInt(n));
114
  const unitsOfSets = (S) => { const u = summed(S.map((s) => s.readyUnits)); return unitsText(u.sum, u.missing); };
115
+ // an index commit of one kind of source (data.js oneKind), where every source is counted in units and rows
116
+ const oneKind = () => !!IX?.oneKind;
117
+ const notCountedOf = (S) => summed(S.filter((s) => s.isTask || oneKind()).map((s) => s.readyUnits)).missing;
118
+ /** Of one kind, a source's units and rows in words. */
119
+ const unitsRowsText = (s) => t('n.unitsFiles', { units: unitsText(s.units), files: plural('n.rowsCompact', s.rows) });
120
  /** #2066: a chart of plots.js, draw(); until the module is loaded a skeleton of class sk, and the reason in its place
121
  * when it could not be loaded (each figure's Table view has the same numbers). */
122
  function plotted(draw, sk = 'sk sk-block') {
 
139
  // across: the ids the filters keep in either layer (linked.js startAcross)
140
  const UI = { across: null, allForms: false, showAll: false, detail: new Map(), preview: new Set(), previewRows: new Map(), csv: null, tab: 'cmd', fitKeyOpen: false, ids: null, facets: {},
141
  tables: { dom: [], form: [], heat: [] }, charts: null };
142
+ // kind: the layer the browse section shows (material_set, the default, or corpus; of one kind, SOURCE, never in the
143
+ // address); metric: what the charts count (sets or units of material sets, corpora in rows; of one kind, sources, units
144
+ // or rows); pick: the ids of the picked sources, joined by commas; ext:
145
  // the file types selected, joined by commas; sample: how many units Get the data takes from each source (SAMPLES);
146
  // stage (#2006): the id of a training stage of the stage table (the commit's stage figures); pii (#2422): the personal-data mark (none,
147
+ // marked or unknown, piiMark); method: the label method the commands that take a leaf's units by label take (one of
148
+ // LABEL_METHODS, '' for every one; with labels by method). The panel shows no control for collection, leaf, tier,
149
+ // redist and status (#2422): from the address they still filter, each a chip that removes it
150
  // view (#2422, second round): the arrangement of the field (VIEWS), strata by default
151
+ // subject, industry, occupation, business_process, resource_type, file_format: a code of that facet (FACET_IDS), which
152
+ // keeps the sources of that code and of the codes under it in the facet's hierarchy
153
+ const KEYS = ['domain', 'leaf', 'form', 'collection', 'kind', 'train', 'redist', 'tier', 'size', 'status', 'q', 'ext', 'stage', 'pii', ...FACET_IDS,
154
+ 'metric', 'sort', 'dir', 'open', 'pick', 'sample', 'view', 'method'];
155
+ // what the charts can count: sets (material sets, or of one kind sources), units and (of one kind) rows
156
+ const METRICS = ['sets', 'units', 'rows'];
157
 
158
  function readUrl() {
159
  const p = new URLSearchParams(location.search);
160
  for (const k of KEYS) F[k] = p.get(k) || '';
161
  if (F.kind !== CORPUS) F.kind = MATERIAL_SET;
162
+ if (!METRICS.includes(F.metric)) F.metric = 'sets';
163
  if (!F.sort) { F.sort = 'fit'; F.dir = 'desc'; }
164
  if (!SAMPLES.includes(F.sample)) F.sample = '';
165
  if (!VIEWS.includes(F.view)) F.view = VIEWS[0];
166
+ if (!LABEL_METHODS.includes(F.method)) F.method = '';
167
  }
168
  function writeUrl() {
169
  const p = new URLSearchParams(location.search);
170
  for (const k of KEYS) {
171
  const v = F[k];
172
+ const dflt = (k === 'kind' && (v === MATERIAL_SET || v === SOURCE)) || (k === 'metric' && v === 'sets') || (k === 'sort' && v === 'fit') || (k === 'dir' && v === 'desc')
173
  || (k === 'view' && v === VIEWS[0]);
174
  if (v && !dflt) p.set(k, v); else p.delete(k);
175
  }
 
231
  }
232
  const domainKeysOf = (s) => (s.domainKind === 'codes' ? s.tops : [s.domainKind === 'multi' ? MULTI : NONE]);
233
  const formKeyOf = (s) => s.form ?? NONE;
234
+ // ---- the facets (catalog/facets.yaml): a facet's name in the page's language, with its standard and version on hover
235
+ // (meta/vocabulary.json facets), and a code's name: the code with the name its standard gives it where the code does
236
+ // not already spell it, else (a standard whose names are withheld) its level and code, with the title another standard
237
+ // gives it where the facet takes titles from one
238
+ const facetName = (fid) => t(`facet.${fid}`);
239
+ function facetTitle(fid) {
240
+ const f = IX.vocab.facets.get(fid);
241
+ return f ? `${f.standard}, ${f.version}` : '';
242
+ }
243
+ function facetCodeName(fid, code) {
244
+ if (code === 'multi') return t('facet.multi');
245
+ if (code === 'unclassified') return t('name.notClassified');
246
+ const x = IX.vocab.facets.get(fid)?.codes.get(code);
247
+ if (!x) return code;
248
+ if (!x.name) return [x.level, code, x.title].filter(Boolean).join(' ');
249
+ return code === x.name || code.endsWith(`/${x.name}`) ? code : `${code} ${x.name}`;
250
+ }
251
+ /** The line under a facet's filter, for a facet that links its codes' pages or takes its titles from another
252
+ * standard: a link to the selected code's page at the standard's source, and the attribution of the titles, linked to
253
+ * their source; hidden for the other facets. */
254
+ function facetNote(label, fid) {
255
+ const fac = IX?.vocab.facets.get(fid);
256
+ let note = label.querySelector('.facet-note');
257
+ if (!fac?.titles && !fac?.codePage) {
258
+ if (note) note.hidden = true;
259
+ return;
260
+ }
261
+ if (!note) label.append(note = el('span', { class: 'facet-note small muted' }));
262
+ const code = F[fid];
263
+ const page = fac.codePage && fac.codes.has(code)
264
+ ? el('a', { href: fac.codePage.replace('{code}', encodeURIComponent(code)), target: '_blank', rel: 'noopener' }, t('facet.codePage', { code }))
265
+ : null;
266
+ const credit = fac.titles ? el('a', { href: fac.titles.source, target: '_blank', rel: 'noopener' }, fac.titles.attribution) : null;
267
+ clear(note).append(...[page, credit].filter(Boolean).flatMap((a, i) => (i ? [' \u00b7 ', a] : [a])));
268
+ note.hidden = false;
269
+ }
270
+ /** The codes of a facet the sources carry that are code or under it in the facet's hierarchy: the codes a filter by
271
+ * code keeps the sources of, which a query names. */
272
+ const facetCodesUnder = (fid, code) => [...new Set(IX.sources.filter((s) => s.facetKeys[fid]?.includes(code)).flatMap((s) => s.facets[fid]
273
+ .filter((c) => c === code || withUpOf(fid, c).includes(code))))].sort();
274
+ function withUpOf(fid, code) {
275
+ const out = [];
276
+ const codes = IX.vocab.facets.get(fid)?.codes;
277
+ for (let x = codes?.get(code)?.parent; x != null && !out.includes(x); x = codes.get(x)?.parent) out.push(x);
278
+ return out;
279
+ }
280
  // #2422: a source's personal-data mark, a label the page filters on and counts and never leaves a source out of a count
281
  // for: its catalog pii.level present or suspected (marked), none_known (none), else not judged yet (unknown)
282
  const PII_MARKED = ['present', 'suspected'];
 
351
  // answer (the ids of the selected sources) is what every part below the filters shows
352
  const sizeBucket = (b) => (b == null ? 'unknown' : b < 1e9 ? 'lt1g' : b < 1e12 ? '1g1t' : 'ge1t');
353
  /** One row of the page's DuckDB table src (linked.js): what the filters and the charts read of a source; n_units are
354
+ * the units of a material set, of one kind of every source (#2065: null, which SQL's sum leaves out, while not counted
355
+ * yet) and n_rows the rows of a corpus, of one kind of every source (0 for the other kind of two layers); kind is its
356
+ * layer (of one kind SOURCE); collection is that of a material
357
  * set or (#1633) of a corpus a collection lists, '' otherwise; exts its file types and ext_rows the rows of each
358
  * (data.js exts); #2006: stages the ids of the training stages one of its units passes (data.js stages); #2422: sizeb
359
  * the size class of its deduplicated size, the one size the page shows, and pii its personal-data mark (piiMark). */
 
365
  // #2066: the search reads the title and description in both languages
366
  qtext: [s.title, s.description, IX.zh.get(s.title), IX.zh.get(s.description), s.id].filter(Boolean).join('\n').toLowerCase(),
367
  exts: s.exts.map(([e]) => e), ext_rows: s.exts.map(([, n]) => n), stages: s.stages,
368
+ // its codes on each facet with the codes above them (data.js facetKeys), [] for a catalog without the facet
369
+ ...Object.fromEntries(FACET_IDS.map((f) => [`fc_${f}`, s.facetKeys[f] || []])),
370
  };
371
  }
372
  const selected = () => (UI.ids ? IX.sources.filter((s) => UI.ids.has(s.id)) : []);
373
+ const FILTER_KEYS = ['domain', 'leaf', 'form', 'collection', 'train', 'redist', 'tier', 'size', 'status', 'q', 'ext', 'stage', 'pii', ...FACET_IDS];
374
+ // the clauses of the selection: the filters and the layer shown (kind: one of the two layers, or of one kind SOURCE)
375
  const SEL_KEYS = [...FILTER_KEYS, 'kind'];
376
  const activeFilters = () => FILTER_KEYS.filter((k) => F[k]);
377
  /** The filters that are on, as [label, value, key] in the page's language. */
 
380
  const word = (key) => t(key, { defaultValue: '' });
381
  if (F.domain) out.push([t('chip.domain'), F.leaf ? domainName(F.leaf) : domainName(F.domain), 'domain']);
382
  if (F.form) out.push([t('chip.form'), formName(F.form), 'form']);
383
+ for (const f of FACET_IDS) if (F[f]) out.push([facetName(f), facetCodeName(f, F[f]), f]);
384
  if (F.collection) out.push([t('chip.collection'), collectionName(F.collection), 'collection']);
385
  if (F.stage) out.push([t('chip.stage'), stageName(F.stage), 'stage']);
386
  if (F.train) out.push([t('chip.training'), word(`filter.permit.${F.train}`), 'train']);
 
395
  }
396
  /** #1524: the file types selected (F.ext), in the order of the address. */
397
  const extList = () => (F.ext ? F.ext.split(',').filter(Boolean) : []);
398
+ /** What the charts count: of one kind, sources (sets), units or rows (F.metric); else in the layer shown, material sets
399
+ * in sets or units (F.metric), corpora in rows. */
400
+ const metricNow = () => (oneKind() ? F.metric : F.kind === CORPUS ? 'rows' : F.metric === 'rows' ? 'sets' : F.metric);
401
  function metricOf(s, m = metricNow()) { return m === 'sets' ? 1 : m === 'units' ? s.readyUnits : s.rawRows; }
402
  const metricFmt = () => (v) => fmtInt(v);
403
+ // of one kind, sets counts sources and rows the rows of every source (metric.sources, metric.allRows)
404
+ const metricWord = (m) => t(oneKind() && m === 'sets' ? 'metric.sources' : oneKind() && m === 'rows' ? 'metric.allRows' : `metric.${m}`);
405
 
406
  /** #2422: the layer a training stage counts: that of the sources one of whose units passes it (a stage's condition names
407
+ * one kind), else by its measures (a stage counted in units counts material sets); of one kind, the one kind. */
408
  function stageKind(id) {
409
+ if (oneKind()) return SOURCE;
410
  const s = IX.sources.find((x) => x.stages.includes(id));
411
  if (s) return s.kind;
412
  return IX.stageList.find((x) => x.id === id)?.counted_by?.includes('units') ? MATERIAL_SET : CORPUS;
 
445
  // script reads the main branch as it is when it starts)
446
  const fetchUrl = () => fileUrl(IX.pin, 'tools/fetch.py');
447
  /** #2629: the layer a command takes: the picked sources' while there are picks (corpora when one of them is a corpus),
448
+ * else the layer shown; of one kind, the one kind. */
449
  function takenKind() {
450
+ if (oneKind()) return SOURCE;
451
  const picks = IX ? picked() : [];
452
  return picks.length ? (picks.some((s) => !s.isTask) ? CORPUS : MATERIAL_SET) : F.kind;
453
  }
 
457
  * which turns the default profile's other criteria off: "all" is a choice of how many units, and the profile stays on. */
458
  const sampleArgs = (v = sampleNow()) => (v === 'all' ? [] : [`--sample ${v}`]);
459
  /** The options of a command, one string each; exts: one --ext per file type (#1524); sample: the units choice it takes
460
+ * (#2629: the one in force unless given); kind: --kind, only on a commit of two layers (on a commit of one kind the
461
+ * page takes task material by label, and fetch.py keeps --kind only for a passage); leaf: the leaf whose labelled units it takes (--leaf; on a commit of two layers with kind corpus);
462
+ * methods: the label methods it takes them by (--method each, with labels by method). */
463
+ function commandArgs({ domain, form, sources, tags, kind, exts, sample, leaf, methods } = {}) {
464
  const a = [`--revision ${IX.pin}`];
465
  if (kind) a.push(`--kind ${kind}`);
466
  if (sources) for (const s of sources) a.push(`--source ${s}`);
 
468
  if (domain) a.push(`--domain ${domain}`);
469
  if (form) a.push(`--form ${form}`);
470
  if (leaf) a.push(`--leaf ${leaf}`);
471
+ if (methods) for (const m of methods) a.push(`--method ${m}`);
472
  if (exts) for (const e of exts) a.push(`--ext ${e}`);
473
  a.push(...sampleArgs(sample), '--out ./data');
474
  return a;
475
  }
476
+ /** The options that take the units labelled for leaf, of the sources given or of every source: --leaf, and with labels
477
+ * by method the method the page names (F.method, --method), on a commit of two layers --kind corpus. */
478
+ const leafArgs = (leaf, sources) => commandArgs({ leaf, sources, kind: oneKind() ? null : CORPUS,
479
+ methods: IX.labelsByMethod && F.method ? [F.method] : null, sample: F.sample || DEFAULT_SAMPLE[oneKind() ? SOURCE : CORPUS] });
480
  // #1216: one option per line, continuation lines indented four spaces and every line but the last ending in " \", so
481
  // the text shown is the text copied and runs as it is
482
  const command = (args) => [`uv run ${fetchUrl()}`, ...args].join(' \\\n ');
483
+ /** The options that take exactly S within domain and form: of one kind, the sources of the selection; else sources of
484
+ * one layer (#1083: one command per layer).
485
+ * whole: S is every source (of its layer) within domain and form, taken by fetch.py's --domain and --form (of two layers
486
+ * with its --kind, #1216). Otherwise, of two layers, material sets are taken through the campaign tags of their
487
+ * collections (--tag campaign:<name>, any of them; a collection's material sets carry the campaign of the collection or
488
+ * of one of its earlier names, vocabulary collections[].campaigns), within --domain and --form; corpora, material sets
489
+ * without a collection and every source of one kind, one --source each. exts: the file types selected, one --ext each
490
+ * (#1524). */
491
  function layerArgs(S, { domain, form, whole = false, exts } = {}) {
492
+ if (whole) return { args: commandArgs({ kind: oneKind() ? null : S[0]?.isTask ? MATERIAL_SET : CORPUS, domain, form, exts }), listed: false };
493
  const colls = new Set(S.map((s) => s.collection));
494
+ if (oneKind() || !S[0]?.isTask || colls.has(null)) return { args: commandArgs({ sources: S.map((s) => s.id), exts }), listed: true };
495
  const tags = IX.vocab.collections.filter((c) => colls.has(c.code)).flatMap((c) => c.campaigns);
496
  return { args: commandArgs({ tags, domain, form, exts }), listed: false };
497
  }
498
+ /** The options that select exactly the page's selection (of two layers, one layer). fetch.py's --domain matches a
499
+ * top-level code with its leaves, a leaf only itself, and multi and unclassified only themselves, as the page's domain
500
+ * filter does; --form matches one form id. So the options within domain and form when only those filters and the
501
+ * collection are set (and the form is a classified one; without a collection every source there, of two layers the
502
+ * whole layer with --kind), else one --source per selected source. #1524: the file types selected narrow the rows of
503
+ * either, one --ext each (fetch.py keeps the rows of any of them, so a source without such rows gives none). */
504
  function selectionArgs(sel) {
505
  const exts = extList();
506
  const other = activeFilters().some((k) => !['domain', 'leaf', 'form', 'collection', 'ext'].includes(k)) || F.form === NONE;
 
537
  // button that opened it. A commit whose vocabulary has no term table shows no such line. #2614: the start of the
538
  // manual has the same line ([data-terms]), drawn again with the manual's text (showView).
539
  const TERMS = ['material set', 'corpus', 'unit', 'domain'];
540
+ // of one kind: the words of one kind of source and its labels, those the term table has
541
+ const TERMS_ONE = ['source', 'unit', 'row', 'label', 'domain'];
542
  function renderTerms() {
543
  const terms = IX?.vocab.terms;
544
+ const have = (oneKind() ? TERMS_ONE : TERMS).filter((k) => terms?.get(k)?.about);
545
  for (const line of document.querySelectorAll('#terms, .manual-text [data-terms]')) {
546
  line.hidden = !have.length;
547
  if (!have.length) continue;
 
572
  function renderStageFig() {
573
  if (!IX) return;
574
  const why = IX.stages ? [] : [stageWhy()];
575
+ drawStages(stageFigList(), { pick: F.stage, onPick: IX.stages ? pickStage : null, onPoint: (g) => FIELD?.front(g), why });
576
  }
577
  /** A stage's band: the filter by stage set to it (with its layer), or cleared when it holds it already; the field and
578
  * the panels of the screen show the result. */
 
595
  case 'size': return words('filter.size', ['lt1g', '1g1t', 'ge1t', 'unknown']);
596
  case 'train': return words('filter.permit', ['yes', 'cond']);
597
  case 'pii': return words('filter.pii', ['none', 'marked', 'unknown']);
598
+ default: return FACET_IDS.includes(key) ? facetOptions(key) : [];
599
  }
600
  }
601
+ /** A facet's options: its codes in its standard's hierarchy (meta/vocabulary.json facets; data.js facetsOf), each
602
+ * indented by its depth, then multi and unclassified; without the facet in the vocabulary, the codes the sources carry,
603
+ * in order. fillSelect leaves out a code that keeps no source, so the list is the part of the hierarchy the selection
604
+ * has. */
605
+ function facetOptions(fid) {
606
+ const fac = IX.vocab.facets.get(fid);
607
+ const tree = fac ? fac.tree : [...new Set(IX.sources.flatMap((s) => s.facets[fid] || []))].filter((c) => !FACET_FORMAL.includes(c)).sort().map((c) => [c, 0]);
608
+ return [...tree, ...FACET_FORMAL.map((c) => [c, 0])].map(([c, depth]) => [c, '\u2002\u2002'.repeat(depth) + facetCodeName(fid, c)]);
609
+ }
610
+ // #2422: the filters of the panel, each a select (the file types are checkboxes, fillExt), in the panel's order; a
611
+ // facet's select is shown while the catalog has the facet's column
612
+ const SELECTS = { stage: 'f-stage', domain: 'f-domain', form: 'f-form', ...Object.fromEntries(FACET_IDS.map((f) => [f, `f-${f}`])),
613
+ size: 'f-size', train: 'f-train', pii: 'f-pii' };
614
  const ANY = new Set(['size', 'train', 'pii']);
615
  function fillSelect(key) {
616
  if (key === 'ext') { fillExt(); return; }
 
622
  clear(s).append(option('', text(t(ANY.has(key) ? 'filter.any' : 'filter.all'), key === 'stage' ? null : f?.total)),
623
  ...opts.map(([v, name]) => option(v, text(name, f ? f.m.get(v) || 0 : null))));
624
  s.value = F[key] || '';
625
+ if (FACET_IDS.includes(key)) {
626
+ // the facet's name in the page's language, its standard and version on hover, and its note (facetNote)
627
+ const label = s.closest('label');
628
+ label.hidden = !IX.facetIds.includes(key);
629
+ label.querySelector('span').textContent = facetName(key);
630
+ label.title = facetTitle(key);
631
+ facetNote(label, key);
632
+ }
633
  if (key === 'stage') {
634
  // #2006: the selected stage's condition (#2066: in Chinese its text in the table of Chinese names, once the release
635
  // has it) and the version of the stage table on hover; without stages of the commit the page reads, the filter is
 
664
  // #2422: the fold's summary says how many types are checked
665
  $('ext-on').textContent = on.length ? t('filter.on', { count: on.length, n: fmtInt(on.length) }) : '';
666
  }
667
+ const fillFilterOptions = () => { Object.keys(SELECTS).forEach(fillSelect); fillExt(); $('facet-title').hidden = !IX.facetIds.length; };
668
  function fillFilterRow() {
669
  fillFilterOptions();
670
  for (const [key, id] of Object.entries(SELECTS)) {
 
687
  * the selection. */
688
  function syncFilterRow() {
689
  for (const [key, id] of Object.entries(SELECTS)) if ($(id).value !== F[key]) $(id).value = F[key];
690
+ for (const f of FACET_IDS) facetNote($(SELECTS[f]).closest('label'), f);
691
  fillExt();
692
  if (document.activeElement !== $('f-q')) $('f-q').value = F.q;
693
  if (F.ext) $('ext-fold').open = true;
694
  const n = activeFilters().length;
695
  $('f-clear').disabled = !n;
696
+ const count = UI.ids ? plural(layerCount(), UI.ids.size) : '';
697
  $('filter-state').textContent = n ? [t('filter.on', { count: n, n: fmtInt(n) }), count].filter(Boolean).join(' · ') : t('filter.noneOn');
698
  $('f-count').textContent = count;
699
  }
 
812
  onclick: () => { UI.allForms = !UI.allForms; drawCharts(); } }, UI.allForms ? t('common.fewer') : t('common.all', { n: fmtInt(forms.length) }))
813
  : null;
814
  figureWithToggle($(FIGS[k]), k, title, {
815
+ // the layer the chart draws, in its color, above the chart (none of one kind); the table holds that layer's
816
+ // columns only, of one kind the sources, their units and their rows
817
+ chart: () => el('div', {}, oneKind() ? null : kindKey([F.kind]), el('div', { class: 'plot-wrap' }, UI.charts[k])),
818
+ table: () => (oneKind()
819
+ ? table([...keyHeads, { label: t('th.sources'), r: true }, { label: t('th.readyUnits'), r: true }, { label: t('th.rows'), r: true }],
820
+ UI.tables[k].map((r) => [...keyCells(r), fmtInt(num(r.n)), fmtInt(num(r.units)), fmtInt(num(r.rows))]))
821
+ : F.kind === CORPUS
822
  ? table([...keyHeads, { label: t('th.corpora'), r: true }, { label: t('th.corpusRows'), r: true }],
823
  UI.tables[k].map((r) => [...keyCells(r), fmtInt(num(r.n)), fmtInt(num(r.rows))]))
824
  : table([...keyHeads, { label: t('th.materialSets'), r: true }, { label: t('th.readyUnits'), r: true }],
 
826
  sql: () => consoleSql(k),
827
  }, more);
828
  }
829
+ // ---- the leaves of the domain grid with the fewest units, the fewest first, the grid's order among equals, the first
830
+ // FEWEST_LEAVES of them: with labels by method, by the units labelled for the leaf by any method (leaves of the commit's
831
+ // meta/labels.json: units), every leaf of projections.leaves of the commit's meta/coverage.json counted; else, in the
832
+ // order the funnel took them (03_data_line/v2/funnel_propose.py pick), by the units of the material sets whose domain
833
+ // holds the leaf (projections.leaves, index_projection.leaf_coverage)
834
  const FEWEST_LEAVES = 5;
835
  const leafOrder = (code) => String(code).replace(/^D/, '').split('.').map(Number);
836
  function byGrid(a, b) {
 
840
  }
841
  function fewestLeaves() {
842
  const byLeaf = IX?.coverage?.projections?.leaves?.by_leaf || {};
843
+ const lab = IX?.labelsByMethod ? IX.labels.leaves || {} : null;
844
+ const rows = lab
845
+ ? [...new Set([...Object.keys(byLeaf), ...Object.keys(lab)])].map((leaf) => ({ ...byLeaf[leaf], leaf,
846
+ domain: byLeaf[leaf]?.domain || leaf.split('.')[0], units: num(lab[leaf]?.units) || 0 }))
847
+ : Object.entries(byLeaf).map(([leaf, v]) => ({ ...v, leaf, units: num(v.units) || 0 }));
848
+ return rows.sort((a, b) => a.units - b.units || byGrid(a.leaf, b.leaf)).slice(0, FEWEST_LEAVES);
849
  }
850
  /** A leaf's name in the page's language: the vocabulary's, else the one projections.leaves gives. */
851
  function leafName(r) {
 
856
  const rows = fewestLeaves();
857
  $('fewest').hidden = !rows.length;
858
  if (!rows.length) return;
859
+ $('fewest-text').textContent = t(IX.labelsByMethod ? 'fewest.text' : 'fewest.textSets');
860
+ clear($('fewest-body')).append(IX.labelsByMethod
861
+ ? table([t('th.leaf'), t('th.domain'), { label: t('th.readyUnits'), r: true }],
862
+ rows.map((r) => [leafName(r), domainName(r.domain), fmtInt(r.units)]))
863
+ : table([t('th.leaf'), t('th.domain'), { label: t('th.materialSets'), r: true }, { label: t('th.readyUnits'), r: true }],
864
+ rows.map((r) => [leafName(r), domainName(r.domain), fmtInt(num(r.material_sets) || 0), fmtInt(r.units)])));
865
+ }
866
+ // ---- every leaf's units, in the grid's order. With labels by method (meta/labels.json format /3): each leaf of its
867
+ // leaves (and of projections.leaves of the commit's meta/coverage.json) with its units labelled by any method (units),
868
+ // those of each method (by_method: agent, classifier), the classifier's threshold (null for a leaf without one) and its
869
+ // units by class (by_class), the classes with the most units first; a row with units of the method the page names
870
+ // (F.method, every method when none) has the command that takes them, of every source (--leaf, and --method for the
871
+ // method named). Else by method as format /1 has them: agent, the units of the material sets whose domain holds the
872
+ // leaf, each chosen by an agent (projections.leaves, as above), and classifier, the corpus units a classifier scored
873
+ // at or above the leaf's threshold (leaves of meta/labels.json: units, threshold), then the classifier's units by
874
+ // class; a row with classifier units has the command that takes them from the corpora (--kind corpus --leaf)
875
  function leafRows() {
876
  const byLeaf = IX?.coverage?.projections?.leaves?.by_leaf || {};
877
  const lab = IX?.labels?.leaves || {};
878
  return [...new Set([...Object.keys(byLeaf), ...Object.keys(lab)])].sort(byGrid).map((leaf) => {
879
  const c = byLeaf[leaf] || {};
880
  const l = lab[leaf] || {};
881
+ const base = { ...c, leaf, domain: c.domain || leaf.split('.')[0], threshold: l.threshold ?? null, byClass: l.by_class || {} };
882
+ if (IX.labelsByMethod) {
883
+ return { ...base, units: num(l.units) || 0,
884
+ byMethod: Object.fromEntries(LABEL_METHODS.map((m) => [m, num(l.by_method?.[m]) || 0])) };
885
+ }
886
+ return { ...base, agent: num(c.units) || 0, classifier: l.units == null ? null : num(l.units) };
887
  });
888
  }
889
+ /** The label method the commands that take a leaf's units take (F.method, kept in the address; '' every method): the
890
+ * leaves' commands and those of the sources' details follow it. */
891
+ function chooseMethod(v) {
892
+ F.method = v;
893
+ writeUrl();
894
+ vt(() => { renderLeaves(); renderSources(selected()); });
895
+ }
896
  function renderLeaves() {
897
  const rows = leafRows();
898
  $('leaves').hidden = !rows.length;
899
  if (!rows.length) return;
900
+ const byMethod = IX.labelsByMethod;
901
+ $('leaves-text').textContent = t(byMethod ? 'leaves.text' : 'leaves.textClassifier');
902
  const totals = new Map();
903
  for (const r of rows) for (const [k, v] of Object.entries(r.byClass)) totals.set(k, (totals.get(k) || 0) + (num(v) || 0));
904
  const classes = [...totals].sort((a, b) => b[1] - a[1]).map(([k]) => k);
905
  const none = IX.labels ? fmtInt(0) : '\u2014';
906
+ const classCells = (r) => classes.map((k) => (r.byClass[k] == null ? none : fmtInt(num(r.byClass[k]))));
907
+ const bar = (r) => (r.threshold == null ? '' : String(r.threshold));
908
+ const head = el('p', { class: 'small' }, IX.labels ? t('leaves.model', { model: IX.labels.model ?? t('common.unknown') }) : t('leaves.noLabels'));
909
+ if (byMethod) {
910
+ // a row's command while the leaf has units of the method named (of any method when none is)
911
+ const take = (r) => ((F.method ? r.byMethod[F.method] : r.units) ? copyButton(t('copy.button'), command(leafArgs(r.leaf))) : '');
912
+ const methods = segmented(t('leaves.method'), [['', t('leaves.methodAll')], ...LABEL_METHODS.map((m) => [m, t(`method.${m}`)])], F.method, chooseMethod);
913
+ clear($('leaves-body')).append(head, methods, el('div', { class: 'table-wrap' }, table(
914
+ [t('th.leaf'), t('th.domain'), { label: t('th.readyUnits'), r: true }, ...LABEL_METHODS.map((m) => ({ label: t(`method.${m}`), r: true })),
915
+ ...classes.map((k) => ({ label: sentence(k), r: true })), { label: t('th.threshold'), r: true }, t('th.command')],
916
+ rows.map((r) => [leafName(r), domainName(r.domain), fmtInt(r.units), ...LABEL_METHODS.map((m) => fmtInt(r.byMethod[m])),
917
+ ...classCells(r), bar(r), take(r)]))));
918
+ return;
919
+ }
920
+ const take = (r) => (r.classifier ? copyButton(t('copy.button'), command(leafArgs(r.leaf))) : '');
921
+ clear($('leaves-body')).append(head,
922
  el('div', { class: 'table-wrap' }, table(
923
  [t('th.leaf'), t('th.domain'), { label: t('th.agent'), r: true }, { label: t('th.classifier'), r: true },
924
  ...classes.map((k) => ({ label: sentence(k), r: true })), { label: t('th.threshold'), r: true }, t('th.command')],
925
  rows.map((r) => [leafName(r), domainName(r.domain), fmtInt(r.agent), r.classifier == null ? none : fmtInt(r.classifier),
926
+ ...classCells(r), bar(r), take(r)]))));
927
+ }
928
+ // ---- every source of the commit by its kind of source and by the class of its form (projections.source_kinds and
929
+ // projections.classes of the commit's meta/coverage.json, index_projection.kind_coverage), each in its table's order:
930
+ // its sources, its material sets with their units and its corpora with theirs; a commit whose projection gives none
931
+ // says so in one line
932
+ function kindTable(by, head) {
933
+ return el('div', { class: 'table-wrap' }, table(
934
+ [head, { label: t('th.sources'), r: true }, { label: t('th.materialSets'), r: true }, { label: t('th.readyUnits'), r: true },
935
+ { label: t('th.corpora'), r: true }, { label: t('th.corpusUnits'), r: true }],
936
+ Object.entries(by).map(([k, v]) => [(inChinese() && v.zh) || sentence(k), fmtInt(num(v.sources) || 0),
937
+ fmtInt(num(v.material_sets) || 0), fmtInt(num(v.units) || 0), fmtInt(num(v.corpora) || 0),
938
+ fmtInt(num(v.corpus_units) || 0)])));
939
+ }
940
+ function renderKinds() {
941
+ const proj = IX?.coverage?.projections || {};
942
+ const kinds = proj.source_kinds?.by_kind;
943
+ const classes = proj.classes?.by_class;
944
+ $('kinds').hidden = !IX;
945
+ if (!IX) return;
946
+ clear($('kinds-body')).append(...(kinds && classes
947
+ ? [kindTable(kinds, t('th.kind')), kindTable(classes, t('th.class'))]
948
+ : [el('p', { class: 'small' }, t('kinds.none'))]));
949
  }
950
 
951
+ /** The heading of the map: what the selection holds, by the map's count, and the domains it covers. Of one kind the
952
+ * layer switch is hidden and the count offers rows too. */
953
  function renderMapHead(sel) {
954
  const m = metricNow();
955
+ const one = oneKind();
956
+ $('layer-seg').hidden = one;
957
  for (const b of $('layer-seg').querySelectorAll('button')) b.setAttribute('aria-pressed', String(b.dataset.kind === F.kind));
958
+ for (const b of $('metric-seg').querySelectorAll('button')) {
959
+ b.setAttribute('aria-pressed', String(b.dataset.metric === m));
960
+ b.hidden = b.dataset.metric === 'rows' && !one;
961
+ b.textContent = metricWord(b.dataset.metric);
962
+ }
963
+ $('metric-wrap').hidden = !one && F.kind === CORPUS;
964
  if (!UI.ids) return;
965
  const total = sum(sel, (s) => metricOf(s, m));
966
  const covered = new Set(sel.flatMap((s) => s.tops)).size;
967
+ const amount = m === 'sets' ? plural(layerCount(), total)
968
  : m === 'units' ? t('map.units', { count: total, n: fmtCompact(total) }) + uncounted(notCountedOf(sel))
969
+ : t(one ? 'map.allRows' : 'map.rows', { count: total, n: fmtCompact(total) });
970
  $('map-h').textContent = !sel.length ? t('map.nothing') : covered ? t('map.head', { amount, domains: plural('n.domain', covered) }) : amount;
971
  }
972
 
973
  // ---- the queries behind the tables, for the dataset's SQL Console: over the catalog of the commit the page reads,
974
  // filtered by the filters that filter that table (linked.js filtersOf), written over the catalog's own columns; the
975
+ // domain keys are those of data.js, in the catalog's words (unclassified, multi). Of one kind, a query counts every
976
+ // source, its units (column units) and its rows (column files), and filters on no kind. Of two layers, a query counts
977
+ // the layer shown only, in its own measure: material sets and their units, or corpora and their rows, the layer read
978
+ // from the column kind, or the rule it is written by when the commit's catalog has none. The licence filters read
979
+ // meta/sources.json, which is no table, so they name their sources by id (or the ids they leave out, whichever list is
980
+ // shorter).
981
  const READY_SQL = 'coalesce(units < files, false)';
982
  const kindSql = () => (IX.hasKind ? 'kind' : `CASE WHEN ${READY_SQL} THEN '${MATERIAL_SET}' ELSE '${CORPUS}' END`);
983
  const DOMAIN_KEYS_SQL = "CASE WHEN domain IS NULL OR len(domain) = 0 OR list_contains(domain, 'unclassified') THEN ['unclassified'] "
984
  + "WHEN list_contains(domain, 'multi') THEN ['multi'] ELSE list_distinct([split_part(code, '.', 1) FOR code IN domain]) END";
985
  const FORM_SQL = "coalesce(nullif(form, ''), 'unclassified')";
986
+ const sumsSql = () => (oneKind() ? 'count(*) AS sources, sum(units) AS units, sum(files) AS rows'
987
+ : F.kind === CORPUS ? 'count(*) AS corpora, sum(files) AS corpus_rows' : 'count(*) AS material_sets, sum(units) AS units');
988
  // #2422: the size classes of the deduplicated size, the one size the page shows (catalog column distinct_bytes)
989
  const SIZE_SQL = { lt1g: 'distinct_bytes > 0 AND distinct_bytes < 1e9', '1g1t': 'distinct_bytes >= 1e9 AND distinct_bytes < 1e12',
990
  ge1t: 'distinct_bytes >= 1e12', unknown: 'coalesce(distinct_bytes, 0) <= 0' };
 
1021
  // #2006: a source's stages are computed from the stage table (the commit's stage figures), no column of the catalog, so the
1022
  // sources are named by id
1023
  stage: (v) => idsSql(new Set(IX.sources.filter((s) => s.stages.includes(v)).map((s) => s.id))),
1024
+ // a facet's catalog column, by the codes the sources carry at or under the code chosen
1025
+ ...Object.fromEntries(FACET_IDS.map((f) => [f, (v) => `list_has_any(${f}, [${facetCodesUnder(f, v).map(sqlStr).join(', ')}]::VARCHAR[])`])),
1026
  };
1027
+ const parts = keys.filter((k) => F[k] && !(k === 'kind' && oneKind())).map((k) => `(${sqlOf[k](F[k])})`);
1028
  return parts.length ? `WHERE ${parts.join('\n AND ')}` : '';
1029
  }
1030
 
 
1056
  case 'title': return titleOf(s).toLowerCase();
1057
  case 'domain': return sourceDomainText(s).toLowerCase();
1058
  case 'form': return formName(formKeyOf(s)).toLowerCase();
1059
+ // units of material sets above rows of corpora (never compared as one count): a corpus has fewer than 1e12 rows; of
1060
+ // one kind, every source by its units (one not counted yet last)
1061
+ case 'units': return oneKind() ? s.units ?? -1 : s.isTask ? 1e12 + s.readyUnits : s.rawRows;
1062
  case 'size': return s.distinct ?? -1;
1063
  case 'tier': return tierName(s.tier).toLowerCase();
1064
  case 'fit': return fitScore(s);
 
1077
  // #364, #1158: the same words as docs/sources.md of the index (artpool/projection_templates/text.json, size_text), in
1078
  // the locale files as size.*
1079
  /** The size note under the list: the size of the layer shown (meta/size_figures.json, IX.sizes; #2422: its deduplicated
1080
+ * size; of one kind, that of the whole index), with the estimate for its rows without a recorded size. */
1081
  function sizeNote() {
1082
  const g = IX.sizes?.[F.kind];
1083
  if (!g) return t('size.none');
 
1097
  const i = IX.vocab.collections.findIndex((c) => c.code === s.collection);
1098
  return i < 0 ? IX.vocab.collections.length : i;
1099
  }
1100
+ /** The list of the selection: of one kind every source in one list, grouped by collection when a collection lists some
1101
+ * of them, each with its units and its rows; of two layers one layer: material sets grouped by collection (a header row
1102
+ * per collection, in the vocabulary's order), corpora as one list, or (#1633) grouped the same way when a collection
1103
+ * lists some of them; the heading names the layer shown only. */
1104
  function renderSources(sel) {
1105
  if (!UI.ids) return;
1106
  const dir = F.dir === 'asc' ? 1 : -1;
1107
+ const one = oneKind();
1108
+ const sets = !one && F.kind !== CORPUS;
1109
  const grouped = sets || sel.some((s) => s.collection);
1110
  const byColl = (a, b) => (grouped ? collectionRank(a) - collectionRank(b) : 0);
1111
  const list = [...sel].sort((a, b) => {
 
1113
  const y = sortValue(b, F.sort);
1114
  return byColl(a, b) || (x < y ? -1 : x > y ? 1 : 0) * dir || titleOf(a).localeCompare(titleOf(b));
1115
  });
1116
+ $('sources-h').textContent = !sel.length ? t('sources.none') : one ? plural('n.source', sel.length)
1117
  : sets ? t('sources.headSets', { sets: plural('n.materialSet', sel.length) }) : t('sources.headCorpora', { corpora: plural('n.corpus', sel.length) });
1118
  const body = clear($('sources-body'));
1119
  if (!sel.length) return;
 
1138
  el('button', { type: 'button', onclick: () => {
1139
  const d = on ? (F.dir === 'asc' ? 'desc' : 'asc') : (c.r || c.key === 'fit' ? 'desc' : 'asc');
1140
  F.sort = c.key; F.dir = d; writeUrl(); renderSources(selected());
1141
+ } }, t(c.key === 'units' && !sets && !one ? 'col.rows' : `col.${c.key}`), on ? (F.dir === 'asc' ? ' ↑' : ' ↓') : ''),
1142
  c.key === 'fit' ? fitHeads() : null);
1143
  }));
1144
  const tbody = el('tbody');
 
1153
  tbody.append(el('tr', { class: 'group-row' }, el('th', { colspan: String(COLS.length), scope: 'colgroup' },
1154
  sets && group ? el('button', { type: 'button', class: 'group-btn', 'aria-pressed': String(cur), title: t(cur ? 'coll.showing' : 'coll.open'),
1155
  onclick: () => setFilter({ collection: cur ? '' : group }) }, cur ? icon('check', { size: 16 }) : null, name) : name,
1156
+ el('span', { class: 'small' }, plural(one ? 'n.source' : sets ? 'n.materialSet' : 'n.corpus', inColl.get(group))))));
1157
  }
1158
  const open = F.open === s.id;
1159
  const toggle = () => openSource(open ? '' : s.id);
 
1176
  el('td', { 'data-label': label(t('col.domain')), class: 'cat-cell' }, sourceDomainText(s)),
1177
  oneForm(s) ? el('td', { class: 'form-cell form-same' })
1178
  : el('td', { 'data-label': label(t('col.form')), class: 'form-cell' }, formIcon(formKeyOf(s), { size: 16 }), formName(formKeyOf(s))),
1179
+ // the count of a source: of one kind its units with its rows under them, of two layers a material set's units or a
1180
+ // corpus's rows
1181
+ one ? el('td', { class: 'r num', 'data-label': label(t('sources.unitsLabel')) },
1182
+ s.units == null ? t('n.notCounted') : [fmtInt(s.units), el('span', { class: 'unit-word' }, t('sources.unitWord', { count: s.units }))],
1183
+ el('span', { class: 'size-sub' }, plural('n.rowsCompact', s.rows)))
1184
+ : el('td', { class: 'r num', 'data-label': label(s.isTask ? t('sources.unitsLabel') : t('sources.rowsLabel')) }, s.isTask
1185
  ? (s.readyUnits == null ? t('n.notCounted') : [fmtInt(s.readyUnits), el('span', { class: 'unit-word' }, t('sources.unitWord', { count: s.readyUnits }))])
1186
  : el('span', { class: 'muted' }, fmtCompact(s.rawRows), el('span', { class: 'unit-word' }, t('sources.corpusWord', { count: s.rawRows })))),
1187
  el('td', { class: 'r num size-cell', 'data-label': label(t('col.size')), title: s.size ? sizeLine(s.size, false) : null }, sizeCell(s)),
 
1197
  const wide = !matchMedia(PHONE).matches;
1198
  body.append(el('details', { class: 'list-key-fold', open: wide || UI.fitKeyOpen, ontoggle: (e) => { if (!wide) UI.fitKeyOpen = e.currentTarget.open; } },
1199
  el('summary', {}, t('sources.aboutFit')),
1200
+ el('div', { class: 'list-key' }, one ? null : kindKey([F.kind]), el('span', { class: 'small' }, t('sources.fitKey')), FIT.map((x) => el('span', { class: 'fit-name' }, icon(x.icon, { size: 14 }), fitLabel(x.k))), fitKey())));
1201
  body.append(el('table', { class: 'src-table' }, el('caption', { class: 'visually-hidden' }, kindName(F.kind)), el('thead', {}, head), tbody));
1202
  body.append(el('div', { class: 'small size-note' }, el('p', {}, sizeNote()), sizeHow()));
1203
  if (list.length > FIRST_ROWS) {
 
1299
  if (!site) return [];
1300
  return publishers > 1 ? [`${t('detail.publishers', { count: publishers, n: fmtInt(publishers) })} `, site] : [site];
1301
  }
1302
+ // a file the index stores (campaign_files/...) is a member of its source's campaign part where the catalog names one
1303
+ // (part), which the link downloads; else the file at its path
1304
+ function upstream(uri, part) {
1305
  if (!uri) return null;
1306
  if (/^https?:\/\//.test(uri)) return uri;
1307
+ if (uri.startsWith('campaign_files/')) return fileUrl(IX.sha, part || uri);
1308
  const s3 = uri.match(/^s3:\/\/([^/]+)\/(.*)$/);
1309
  if (s3) return `https://${s3[1]}.s3.amazonaws.com/${s3[2]}`;
1310
  return null;
 
1351
  function item(iconName, label, ...value) {
1352
  return el('div', { class: 'd-item' }, el('dt', {}, icon(iconName, { size: 18 }), label), el('dd', {}, ...value));
1353
  }
1354
+ /** The labels of source s: the labels' model; with labels by method its units by method (meta/labels.json by_method)
1355
+ * and its units of each leaf by any method (sources), else its units at or above each leaf's threshold (sources), the
1356
+ * most first; the labels of its first units (got: the first rows of its first label file, 'loading' until read, {error}
1357
+ * when they could not be), one line per unit with each leaf's label: a classifier's score, in bold at or above that
1358
+ * leaf's threshold, or the method of a label without a score (agent), and its class; and the command that
1359
+ * takes its units of the leaf it holds the most of (leafArgs: by the method the page names). */
1360
  function labelItem(s, got) {
1361
  const leaves = IX.labels?.leaves || {};
1362
  const held = Object.entries(s.labelled || {}).map(([leaf, n]) => [leaf, num(n) || 0]).sort((a, b) => b[1] - a[1]);
1363
+ const methods = LABEL_METHODS.filter((m) => num(s.byMethod?.[m]));
1364
  const out = [el('span', { class: 'small' }, t('detail.labelModel', { model: IX.labels?.model ?? t('common.unknown') })),
1365
+ methods.length ? el('span', { class: 'chips' }, methods.map((m) => el('span', { class: 'chip' }, `${t(`method.${m}`)} ${fmtInt(num(s.byMethod[m]))}`))) : null,
1366
  el('span', { class: 'chips' }, held.map(([leaf, n]) => el('span', { class: 'chip' }, `${leafName({ leaf })} ${fmtInt(n)}`)))];
1367
  if (got === 'loading') out.push('\u2026');
1368
  else if (got?.error) out.push(el('span', { class: 'problem-text' }, got.error));
 
1374
  }
1375
  const label = (r) => {
1376
  const bar = leaves[r.leaf]?.threshold;
1377
+ const scored = r.score != null;
1378
+ const text = scored ? `${r.leaf} ${num(r.score).toFixed(2)}` : `${r.leaf} ${t(`method.${r.method}`, { defaultValue: String(r.method ?? '') })}`;
1379
  return el('span', { class: 'chip', title: leafName({ leaf: r.leaf }) },
1380
+ scored && bar != null && num(r.score) >= num(bar) ? el('b', {}, text) : text, r.class ? ` \u00b7 ${r.class}` : '');
1381
  };
1382
  const shown = [...units].slice(0, FIRST_ROWS);
1383
  out.push(el('div', { class: 'table-wrap sample' }, table([t('th.unit'), t('th.labels')],
1384
  shown.map(([u, ls]) => [el('span', { class: 'mono', title: String(u) }, shortUri(String(u))),
1385
+ el('span', { class: 'chips' }, [...ls].sort((a, b) => (num(b.score) ?? Infinity) - (num(a.score) ?? Infinity)).map(label))]),
1386
+ t(IX.labelsByMethod ? 'detail.labelsFirstMethod' : 'detail.labelsFirst', { n: fmtInt(shown.length) }))));
1387
  }
1388
  if (held.length) {
1389
+ const cmd = command(leafArgs(held[0][0], [s.id]));
1390
  out.push(el('span', { class: 'small' }, t('detail.takeLeaf', { leaf: leafName({ leaf: held[0][0] }) })),
1391
  el('code', { class: 'cmd-inline' }, cmd), copyButton(t('copy.button'), cmd));
1392
  }
 
1404
  const ownRows = (rows) => rows.filter((r) => r.source === s.id);
1405
  if (!st.sample && s.files.length) {
1406
  st.sample = 'loading';
1407
+ // the column extra (the row's source_meta: its upstream, its publishers) of a material set's rows, and of one kind of
1408
+ // any source's rows that have it
1409
+ const cols = s.isTask || oneKind() ? [...ROW_COLUMNS, 'extra'] : ROW_COLUMNS;
1410
  const unitFile = s.files[0];
1411
  readColumns(fileUrl(IX.sha, unitFile.path), cols, rowsOf(unitFile, FIRST_ROWS))
1412
  .then((r) => { st.sample = ownRows(r.rows); st.file = unitFile.path; redraw(); }, (e) => { st.sample = { error: e.message }; redraw(); });
 
1445
  const ups = upstreamsOfRows(metas);
1446
  const names = publisherNames(metas);
1447
  const allRead = rows.length >= s.rows;
1448
+ const counted = oneKind() ? unitsRowsText(s)
1449
+ : s.isTask ? t('n.unitsFiles', { units: unitsText(s.readyUnits), files: plural('n.file', s.rows) }) : plural('n.corpusRow', s.rawRows);
1450
  // #2066: in the page's language (descriptionOf); the sentence admission writes (ADMIT_WHAT) is recognized in English
1451
  const own = s.description && !ADMIT_WHAT.test(s.description) ? descriptionOf(s) : '';
1452
  const text = own
 
1454
  : s.publishers ? t('detail.countsFrom', { what: counted, publishers: plural('n.publisher', s.publishers) })
1455
  : t('detail.counts', { what: counted }));
1456
  dl.append(item('doc', t('detail.what'), text.length > 160 ? el('details', {}, el('summary', {}, firstSentence(text)), el('p', {}, text)) : text));
1457
+ // 2 a material set's units and files, what each row of a corpus points to (#2065: a corpus is counted in rows); of one
1458
+ // kind, a source's units and rows, and what each row points to where its registration says
1459
  const kindCount = (k) => {
1460
  const n = num(s.info.unit[k]);
1461
  return t(UNIT_KIND[k] ? `unitCount.${UNIT_KIND[k]}` : 'unitCount.code', { count: n, n: fmtCompact(n), kind: k });
1462
  };
1463
+ const rowsPoint = () => [el('span', {}, sentence(fmtOr(s.kinds.map((k) => (UNIT_KIND[k] ? t(`unitKind.${UNIT_KIND[k]}`) : k))))),
1464
+ el('span', { class: 'chips' }, s.kinds.map((k) => el('span', { class: 'chip' }, kindCount(k))))];
1465
+ const unitWhat = oneKind()
1466
+ ? [el('span', { class: 'chips' }, el('span', { class: 'chip' }, unitsText(s.units)), el('span', { class: 'chip' }, plural('n.rowsCompact', s.rows))),
1467
+ ...(s.kinds.length ? rowsPoint() : [])]
1468
+ : s.isTask
1469
+ ? [el('span', { class: 'chips' }, el('span', { class: 'chip' }, unitsText(s.readyUnits)), el('span', { class: 'chip' }, plural('n.file', s.rows)))]
1470
+ : rowsPoint();
1471
+ dl.append(item('rows', t(oneKind() ? 'detail.unitsRows' : s.isTask ? 'detail.files' : 'detail.oneUnit'), ...unitWhat));
1472
  // 3 where it comes from (#1197: in words): the number of its publishers (#1256: the catalog's) and the main site of
1473
  // its upstreams, else of the addresses of its rows
1474
  const from = ups.length ? fromWords(ups, true, s.publishers) : fromWords(rows.map((r) => r.uri), false, s.publishers);
 
1476
  // #2588: the upstream it declares, one dataset or one catalog with its agent and entry address (each of them while
1477
  // it still reads several)
1478
  if (s.upstream) dl.append(item('pin', t('detail.upstream'), upstreamLines(s.upstream)));
1479
+ // #4406: its card, its section of its protocol's card file (catalog column card), on the Hub at the page's commit
1480
+ if (s.card) dl.append(item('doc', t('detail.card'), el('a', { href: `${DATASET_URL}/blob/${IX.sha}/${s.card}`, rel: 'noopener', class: 'mono' }, s.card)));
1481
  // 4 self-contained; #1216: the fit chip's answer (fit.alone), with the files of the source a material set of a
1482
  // collection comes with (a license and a readme leave a unit usable alone): its rows read without a unit
1483
  const comps = [...new Set(rows.filter((r, i) => !isUnit(metas[i])).map((r) => r.uri.split('/').pop()))];
1484
  const compChips = () => el('span', { class: 'chips' }, (comps.length ? comps : ['LICENSE', 'README.md']).map((c) => el('span', { class: 'chip mono-chip' }, c)));
1485
  const ofCollection = !!(info.campaign || info.extended_by);
1486
+ // of one kind, a source of a collection is answered as a material set is
1487
+ dl.append(item('layers', t('detail.alone'), s.isTask || (oneKind() && ofCollection)
1488
  ? (fit.alone !== 'yes' ? [el('span', {}, t('detail.withCompanions')), compChips()]
1489
  : ofCollection ? [el('span', {}, t('detail.alsoWith')), compChips()] : t('detail.yes'))
1490
  : fit.alone === 'yes' ? t('detail.eachFile') : t('detail.container')));
 
1516
  const permit = (field) => PERMIT_ORDER.map((k) => {
1517
  const names = behind(field, k);
1518
  return { k, value: num(lr[field]?.[k]?.rows) || 0, color: PERMIT_COLOR[k], label: permitLabel(k, names),
1519
+ note: t(`detail.shareOf${oneKind() ? 'Source' : s.isTask ? 'Set' : 'Corpus'}${names.length ? '' : 'Only'}`, { licences: names.join(', ') }) };
1520
  });
1521
  // #1197: one line when every row allows both, the two bars when its rows differ
1522
  const allAllowed = (field) => permit(field).every((x) => (x.k === 'yes' ? x.value > 0 : !x.value));
1523
+ // #1266: a material set's licence by kind of file, as the projection counted it (license_counts), and of one kind any
1524
+ // source's that has license_counts: per kind its
1525
  // files, the permit classes for training and for redistribution as "x / y files" with the licences behind each, or
1526
  // one phrase when all its files allow both
1527
  const spdxOf = (xs) => [...new Set(xs.map((x) => x.spdx).filter(Boolean))].sort();
 
1543
  return el('span', { class: 'lic-kind' }, head, classes('training_ok', t('detail.training')), classes('redistribution_ok', t('detail.shipping')));
1544
  };
1545
  dl.append(item('training', t('detail.licence'), el('span', { class: 'lic' }, el('b', {}, tierName(s.tier)), el('span', { class: 'small' }, lic.name || s.spdx || '')),
1546
+ (s.isTask || oneKind()) && s.licenceCounts ? el('span', { class: 'lic-kinds' }, FILE_KINDS.map(kindLine))
1547
  : allAllowed('training_ok') && allAllowed('redistribution_ok') ? el('span', { class: 'small' }, t('detail.allAllowed'))
1548
  : el('span', { class: 'lic-bars' },
1549
  el('span', { class: 'mini-title' }, t('detail.training')), shareBar(permit('training_ok'), s.rows),
 
1555
  ? el('span', { class: 'chips' }, s.stages.map((id) => el('span', { class: 'chip' }, stageName(id))))
1556
  : t('detail.stagesNone'), el('span', { class: 'small' }, t('stage.version', { v: IX.stages.version }))));
1557
  }
1558
+ // its labels, for a source whose units the commit labels (labelItem): one with label files, or with labels by method
1559
+ // one meta/labels.json counts units of by method
1560
+ if (s.labelFiles.length || s.byMethod) dl.append(item('layers', t('detail.labels'), ...labelItem(s, st.labels)));
1561
  // 7 size and units
1562
  const q = info.size_quantiles_upper_bytes || {};
1563
+ const amounts = oneKind() ? `${unitsText(s.units)} · ${plural('n.rowsCompact', s.rows)}`
1564
+ : s.isTask ? `${unitsText(s.readyUnits)} · ${plural('n.file', s.rows)}` : plural('n.corpusRow', s.rawRows);
1565
  // #1158: the source's figures of meta/size_figures.json; #2422: its size first, the deduplicated one
1566
  dl.append(item('size', t('detail.size'), el('span', { class: 'lic' }, el('b', {}, s.size ? sizeOf(s.size) : t('size.none')),
1567
  el('span', { class: 'small' }, amounts), s.size ? el('span', { class: 'small size-parts' }, sizeParts(s.size, false).join(' \u00b7 ')) : null),
 
1586
  if (pv === 'loading') dl.append(item('link', t('detail.example'), '…'));
1587
  else if (pv.error) dl.append(item('link', t('detail.example'), el('span', { class: 'problem-text' }, pv.error)));
1588
  else if (r) {
1589
+ const href = upstream(r.uri, s.campaignPart);
1590
  const name = r.member_path || r.uri.split('/').pop() || r.uri;
1591
  dl.append(item('link', t('detail.example'), el('span', { class: 'example' },
1592
  href ? el('a', { href, rel: 'noopener', class: 'mono' }, name) : el('span', { class: 'mono' }, name),
1593
  r.size_bytes != null ? el('span', { class: 'small' }, ` · ${fmtBytes(num(r.size_bytes))}`) : null)));
1594
  }
1595
  // 9 the command that takes this source: #2629: a material set whole, with its units and its size beside it; a corpus,
1596
+ // whose whole can be petabytes, and of one kind every source, by the units choice (the reader's, else 3 per source)
1597
+ const cmd = command(commandArgs({ sources: [s.id], sample: s.isTask ? 'all' : F.sample || DEFAULT_SAMPLE[oneKind() ? SOURCE : CORPUS] }));
1598
  dl.append(item('run', t('detail.take'), el('code', { class: 'cmd-inline' }, cmd), copyButton(t('copy.button'), cmd),
1599
  s.isTask ? el('span', { class: 'small' }, s.size ? t('detail.takeWhole', { units: unitsText(s.readyUnits), size: sizeOf(s.size) })
1600
  : t('detail.takeWholeNoSize', { units: unitsText(s.readyUnits) })) : null));
 
1665
  const chips = filterChips();
1666
  const exts = extList();
1667
  const where = [`source IN (${ids})`, ...(exts.length ? [`ext IN (${exts.map(sqlStr).join(', ')})`] : [])];
1668
+ // the selection's sources in their measure: of one kind their units and rows, else one layer's in that layer's
1669
+ const head = oneKind()
1670
+ ? t('sql.headSources', { sha: IX.sha.slice(0, 7), sources: plural('n.source', sel.length), units: unitsOfSets(sel),
1671
+ rows: plural('n.rowsCompact', sum(sel, (s) => s.rawRows)) })
1672
+ : F.kind === CORPUS
1673
  ? t('sql.headCorpora', { sha: IX.sha.slice(0, 7), corpora: plural('n.corpus', sel.length), rows: plural('n.corpusRow', sum(sel, (s) => s.rawRows)) })
1674
  : t('sql.headSets', { sha: IX.sha.slice(0, 7), sets: plural('n.materialSet', sel.length), units: unitsOfSets(sel) });
1675
  return [
 
1739
  ...(IX.vocab.profile.length ? [el('p', { class: 'chart-title profile-title' }, t('tree.leftOut')),
1740
  el('ul', { class: 'profile' }, IX.vocab.profile.map(({ criterion, option }) => el('li', {}, el('span', {}, t(`profile.${criterion}`)), el('code', {}, option)))),
1741
  el('p', { class: 'small tree-note' }, t('tree.flagNote'))] : []),
1742
+ el('p', { class: 'small tree-note' }, t('tree.labelNote'), ' ', el('code', {}, '--training-only'), ' ', el('code', {}, '--no-personal-data'), ' ', el('code', {}, '--no-refused')),
1743
  el('p', { class: 'small agent-links' }, icon('robot', { size: 16 }),
1744
  el('a', { href: t('url.forAgents') }, t('agents.readme')), ' · ', el('a', { href: 'llms.txt' }, 'llms.txt')));
1745
  }
 
1752
  // command beside it names too; tools/fetch.py --selection reads it, so the same file gives the same files later) and
1753
  // the attribution file (per source its title, licence and attribution statement from meta/sources.json; #1577: and
1754
  // its files by publisher, licence and licence URL from meta/attribution.parquet, each file's own, else its source's;
1755
+ // in English, the language of the dataset). Its filters record the page's filters, and of two layers the layer shown
1756
+ // (kind); of one kind no kind, which the catalog and fetch.py of such a commit do not have
1757
  const selectionName = () => `training-data-foundation-selection-${IX.sha.slice(0, 7)}.json`;
1758
  const ATTRIBUTION = 'meta/attribution.parquet';
1759
  const ATTRIBUTION_COLUMNS = ['source', 'publisher', 'license', 'license_url', 'files'];
1760
  function selectionFile(sel, picks) {
1761
  return `${JSON.stringify({
1762
  format: 'training-data-foundation-selection/1', dataset: REPO, revision: IX.pin,
1763
+ filters: picks ? {} : Object.fromEntries([...activeFilters(), ...(oneKind() ? [] : ['kind'])].map((k) => [k, F[k]])), sources: sel.map((s) => s.id).sort(),
1764
  }, null, 1)}\n`;
1765
  }
1766
  async function attributionFile(sel) {
 
1815
  el('p', { class: 'small' }, el('code', {}, selectionName()), ' ', t('keep.selectionNote', { sources: plural(picks ? 'n.picked' : layerCount(), sel.length), sha: IX.sha.slice(0, 7) }))),
1816
  codeCard('run', t('keep.again'), selectionCommand(picks), 2));
1817
  }
1818
+ /** The key of the count word of the layer shown: n.materialSet or n.corpus; of one kind n.source. */
1819
+ const layerCount = () => (oneKind() ? 'n.source' : F.kind === CORPUS ? 'n.corpus' : 'n.materialSet');
1820
  function codeCard(iconName, title, code, n) {
1821
  return el('div', { class: 'code-card' },
1822
  el('div', { class: 'code-head' }, el('span', { class: 'code-ico' }, icon(iconName, { size: 20 })),
 
1857
  function chooseSample(v) {
1858
  F.sample = v === DEFAULT_SAMPLE[takenKind()] ? '' : v;
1859
  writeUrl();
1860
+ vt(() => { renderGet(selected()); renderSources(selected()); renderLeaves(); });
1861
  }
1862
  function unitsChoice() {
1863
  return el('div', { class: 'units-row' }, segmented(t('get.units'), SAMPLES.map((v) => [v, v === 'all' ? t('get.unitsAll') : v]), sampleNow(), chooseSample));
 
1881
  body.append(...commandSteps(commandArgs({ sources: picks.map((s) => s.id) }), picks));
1882
  body.append(keepCard(picks, true));
1883
  }
1884
+ /** Get the data: of one kind, one command takes the selection's sources; of two layers the selection is one layer, so
1885
+ * one command takes it (#1083), and the other layer is one switch away. Picked sources, when there are any, take its
1886
+ * place (renderPicks). */
1887
  function renderGet(sel) {
1888
  if (!UI.ids) return;
1889
  const picks = picked();
1890
  renderDock(sel, picks);
1891
  if (picks.length) { renderPicks(picks); return; }
1892
+ const one = oneKind();
1893
  const ready = sum(sel, (s) => s.readyUnits);
1894
  const raw = sum(sel, (s) => s.rawRows);
1895
  const other = F.kind === CORPUS ? MATERIAL_SET : CORPUS;
1896
  $('get-h').textContent = !sel.length ? t('get.nothing') : takeHeading(sel.length === 1 ? null : plural(layerCount(), sel.length));
1897
  const body = clear($('get-body'));
1898
+ const switchOther = one ? null : el('button', { type: 'button', class: 'link', onclick: () => setLayer(other) }, t('get.otherLayer', { name: kindName(other) }));
1899
+ if (!sel.length) { if (switchOther) body.append(el('p', { class: 'small' }, switchOther)); return; }
1900
  const chips = filterChips();
1901
  const tabs = segmented('', [['cmd', t('get.command')], ['sql', 'SQL'], ['csv', 'CSV']], UI.tab, (v) => { UI.tab = v; vt(() => renderGet(selected())); });
1902
+ const unitsLine = el('span', { class: 'fact-line' }, icon('check', { size: 18 }), el('b', {}, fmtInt(ready)), t('cat.lead.ready', { count: ready }) + uncounted(notCountedOf(sel)));
1903
+ const rowsLine = el('span', { class: 'fact-line muted' }, icon('rows', { size: 18 }), el('b', {}, fmtCompact(raw)), t(one ? 'cat.lead.rows' : 'cat.lead.raw', { count: raw }));
1904
  const pickRow = el('div', { class: 'pick-row' },
1905
+ el('span', { class: 'fact-line' }, icon('sources', { size: 18 }), el('b', {}, fmtInt(sel.length)), t(one ? 'get.sourceWord' : F.kind === CORPUS ? 'get.corpusWord' : 'get.setWord', { count: sel.length })),
1906
+ ...(one ? [unitsLine, rowsLine] : [F.kind === CORPUS ? rowsLine : unitsLine]),
1907
+ el('span', { class: 'chips' }, one ? null : el('span', { class: 'chip' }, kindName(F.kind)), ...chips.map(([k, v]) => el('span', { class: 'chip', title: k }, v))),
 
 
1908
  el('a', { class: 'small', href: '#filters' }, t('get.change')), switchOther, tabs);
1909
  body.append(pickRow);
1910
  if (UI.tab === 'cmd') {
 
1924
  const say = (text) => { csvState.textContent = text; UI.csv = { key, text }; };
1925
  try {
1926
  const csv = await buildCsv(sel, (d, n) => say(t('csv.progress', { count: n, done: fmtInt(d), n: fmtInt(n) })));
1927
+ download(`${REPO.split('/')[1]}-${IX.sha.slice(0, 7)}-${sel.length === 1 ? sel[0].id : `${sel.length}-${oneKind() ? 'sources' : F.kind === CORPUS ? 'corpora' : 'material-sets'}`}.csv`, csv, 'text/csv');
1928
  say(plural('n.pointerRow', csv.split('\n').length - 2));
1929
  } catch (e) { say(e.message); }
1930
  btn.disabled = false;
 
1951
  /** The stage group of a source among the stages ids (the stage table's order): its first stage, else the last group,
1952
  * in no stage. */
1953
  const groupOf = (s, ids) => { const g = ids.findIndex((id) => s.stages.includes(id)); return g < 0 ? ids.length : g; };
 
 
 
1954
  // the color of a source's dot in the list: the picked stage's while the source feeds it, else its first stage's
1955
  const groupColor = (s, ids) => stageColor(F.stage && s.stages.includes(F.stage) ? F.stage : ids[groupOf(s, ids)]);
1956
  /** The points of the field: one per source and stage it feeds (a corpus that feeds two stages stands on both planes
 
1990
  return picked >= 0 && p.g !== picked ? HALF : 1;
1991
  });
1992
  }
1993
+ /** #1083: the field's last group, the sources none of whose units a stage counts, those of the layer shown (of one kind,
1994
+ * every source) and never two layers as one number: their number as its figure. Each stage's band says its units of
1995
+ * every status. */
 
 
 
1996
  function restWhat() {
1997
+ const here = IX.sources.filter((s) => !s.stages.length && s.kind === F.kind).length;
1998
+ const word = oneKind() ? 'get.sourceWord' : F.kind !== CORPUS ? 'get.setWord' : 'get.corpusWord';
1999
+ return { num: fmtInt(here), word: t(word, { count: here }) };
 
 
 
 
 
 
 
 
 
 
 
 
2000
  }
2001
  /** The labels of the field in the page's language: per stage group its figure and name at its plane and its name at
2002
  * its lane, the domains' names, and the marks of the size axis. */
 
2061
  FIELD = await mod.createField(host, {
2062
  points: fieldPts, colors: [...ids.map(stageColor), '--none'], cells: doms.length, view: F.view,
2063
  room: fieldRoom,
2064
+ tip: (i) => { const s = at(i); return [titleOf(s), [sourceDomainText(s), oneKind() ? null : kindOne(s.kind), s.size ? sizeOf(s.size) : null].filter(Boolean).join(' · ')]; },
2065
  onHover: (i) => { const id = i < 0 ? null : at(i).id; for (const b of $('sel-list').querySelectorAll('.src')) b.classList.toggle('hot', b.dataset.id === id); },
2066
  onPick: (i) => focusSource(at(i)),
2067
  onTouch: () => $('top').classList.add('touched'),
 
2095
  };
2096
  requestAnimationFrame(step);
2097
  }
2098
+ /** The right panel: how many sources (of two layers, of the layer shown) the selection holds, with their units and rows
2099
+ * (of two layers, its layer's measure) and the domains they cover; its largest sources, each with its stage group's
2100
+ * dot, its domain, its units and its size (a bar on a logarithmic scale); and the light of the field's points. */
2101
  function renderWork(sel) {
2102
  if (!UI.ids) return;
2103
+ const one = oneKind();
2104
+ const sets = !one && F.kind !== CORPUS;
2105
  countTo($('sel-n'), sel.length);
2106
+ $('sel-word').textContent = t(one ? 'get.sourceWord' : sets ? 'get.setWord' : 'get.corpusWord', { count: sel.length });
2107
  const ready = sum(sel, (s) => s.readyUnits);
2108
  const raw = sum(sel, (s) => s.rawRows);
2109
  const covered = new Set(sel.flatMap((s) => s.tops)).size;
2110
+ const units = [fmtInt(ready), t('cat.lead.ready', { count: ready }) + uncounted(notCountedOf(sel))];
2111
+ const meta = [...(one ? [units, [fmtCompact(raw), t('cat.lead.rows', { count: raw })]] : [sets ? units : [fmtCompact(raw), t('cat.lead.raw', { count: raw })]]),
2112
  [fmtInt(covered), t('strata.domains', { count: covered })]];
2113
  clear($('sel-meta')).append(...meta.map(([n, word]) => el('span', {}, el('b', {}, n), ' ', word)));
2114
  const ids = stageFigList().map((s) => s.id);
 
2120
  onclick: () => focusSource(s), onpointerenter: () => FIELD?.hover(pointOf(s.id)), onpointerleave: () => FIELD?.hover(-1) },
2121
  el('span', { class: 'dot', 'aria-hidden': 'true' }),
2122
  el('span', { style: 'min-width: 0' }, el('span', { class: 't' }, titleOf(s)),
2123
+ el('span', { class: 's' }, [sourceDomainText(s), oneKind() ? unitsRowsText(s) : s.isTask ? unitsText(s.readyUnits) : plural('n.corpusRow', s.rawRows)].join(' · '))),
2124
  el('span', { class: 'sz' }, s.size ? sizeOf(s.size) : ''),
2125
  el('span', { class: 'barw', 'aria-hidden': 'true' }, el('u', { style: `width: ${Math.max(2, (lg(s) / most) * 100).toFixed(0)}%` }))))));
2126
  if (!sel.length) list.append(el('li', {}, el('p', { class: 'src-none' }, t('sources.none'))));
 
2141
  clear(box);
2142
  if (!s) return;
2143
  const stages = s.stages.length ? s.stages.map(stageName).join(t('size.listSep')) : t('strata.rest');
2144
+ // its domain, its layer (of two layers), its form, its units and rows (of one kind) or its layer's measure, its size,
2145
+ // its license and its stages
2146
+ const rows = [[t('col.domain'), sourceDomainText(s)], oneKind() ? null : [t('strata.layer'), kindOne(s.kind)], [t('col.form'), formName(formKeyOf(s))],
2147
+ ...(oneKind() ? [[t('col.units'), unitsNum(s.units)], [t('col.rows'), fmtCompact(s.rows)]]
2148
+ : [s.isTask ? [t('col.units'), unitsNum(s.readyUnits)] : [t('col.rows'), fmtCompact(s.rawRows)]]),
2149
+ [t('col.size'), s.size ? sizeOf(s.size) : t('common.unknown')], [t('col.tier'), tierName(s.tier)], [t('filter.stage'), stages]].filter(Boolean);
2150
  const isPicked = pickIds().includes(s.id);
2151
  box.append(el('div', { class: 'card-s' },
2152
  el('button', { type: 'button', class: 'x', 'aria-label': t('strata.close'), title: t('strata.close'), onclick: () => openSource('') }, '×'),
 
2235
  markFromIndex();
2236
  renderStageFig();
2237
  renderTerms();
2238
+ drawRelease(IX.pin, IX.releaseDate, IX.countedOn);
2239
  $('foot-pin').textContent = t('foot.index', { sha: IX.sha.slice(0, 7), date: fmtDate(IX.date) });
2240
+ if (IX.overrides.catalog || IX.overrides.vocabulary || IX.overrides.figures) {
2241
  const chip = $('preview-chip');
2242
  clear(chip).append(el('span', { class: 'dot other', 'aria-hidden': 'true' }), t('hero.preview'));
2243
+ chip.title = [IX.overrides.catalog, IX.overrides.vocabulary, IX.overrides.figures].filter(Boolean).join(' ');
2244
  chip.hidden = false;
2245
  }
2246
  }
 
2344
  renderHeader();
2345
  renderFewest();
2346
  renderLeaves();
2347
+ renderKinds();
2348
  fillFilterOptions();
2349
  drawDockSample();
2350
  FIELD?.setLabels(fieldLabels());
 
2428
  // without stages every source is in one stage group, so the field starts by domain unless the address names an
2429
  // arrangement
2430
  if (!IX.stages && !new URLSearchParams(location.search).get('view')) F.view = 'domains';
2431
+ // of one kind every source is of the kind SOURCE, which the clause kind then keeps whole, and the field's legend has
2432
+ // no other layer; without labels by method the page takes no label method
2433
+ if (IX.oneKind) { F.kind = SOURCE; $('legend-half').hidden = true; }
2434
+ if (!IX.labelsByMethod) F.method = '';
2435
  if (F.stage && stageKind(F.stage) !== F.kind) {
2436
  F.kind = stageKind(F.stage);
2437
  if (F.kind === CORPUS) F.collection = '';
 
2445
  renderMapHead([]);
2446
  renderFewest();
2447
  renderLeaves();
2448
+ renderKinds();
2449
  for (const b of $('layer-seg').querySelectorAll('button')) b.addEventListener('click', () => setLayer(b.dataset.kind));
2450
  for (const b of $('metric-seg').querySelectorAll('button')) {
2451
  b.addEventListener('click', () => { F.metric = b.dataset.metric; writeUrl(); drawCharts(); renderMapHead(selected()); });
data.js CHANGED
@@ -3,6 +3,7 @@ import { asyncBufferFromUrl, parquetMetadataAsync, parquetReadObjects } from 'ht
3
  import { compressors } from 'https://cdn.jsdelivr.net/npm/hyparquet-compressors@1.1.2/+esm';
4
  import { downloadFile, pathsInfo } from 'https://cdn.jsdelivr.net/npm/@huggingface/hub@2.17.10/+esm';
5
  import { HF, loadRevision as askRevision, REPO } from './commit.js';
 
6
  import { t } from './i18n.js';
7
 
8
  export { HF, REPO };
@@ -11,18 +12,26 @@ export const DATASET_URL = `${HF}/datasets/${REPO}`;
11
  export const fileUrl = (sha, path) => `${DATASET_URL}/resolve/${sha}/${path}`;
12
  export const num = (v) => (v == null ? null : typeof v === 'bigint' ? Number(v) : Number(v));
13
 
14
- // the two layers, the values of the catalog column kind (#952, #1083): a material set (task material) and a corpus
 
15
  export const MATERIAL_SET = 'material_set';
16
  export const CORPUS = 'corpus';
17
  export const KINDS = [MATERIAL_SET, CORPUS];
 
 
 
 
18
  // #2065, #2066: the one table of Chinese names the release writes: per English text the index shows (a collection's
19
  // name, a source's title, description or summary, as the catalog holds them) its Chinese text (columns en and zh)
20
  const TRANSLATIONS = 'meta/translations.parquet';
21
  // #2066: the projection's counts per training stage (artpool.stages FIGURES), with (#2065) each stage's funnel
22
  const STAGE_FIGURES = 'meta/stage_figures.json';
23
- // the labels of corpus units: the record of the labelling (its model, and per leaf its threshold, the units at or above
24
- // it and those by class; per source the units at or above each leaf's threshold), and each labelled source's files
25
- // labels/<source>/*.parquet (one row per unit and leaf labelled: unit_id, leaf, score, class)
 
 
 
26
  const LABELS = 'meta/labels.json';
27
  const LABEL_FILE = /^labels\/([^/]+)\/[^/]+\.parquet$/;
28
 
@@ -36,7 +45,7 @@ export async function wholeFile(sha, path) {
36
  return blob;
37
  }
38
 
39
- /** A file named by its URL in the page address (catalog=, vocabulary=), which may lie outside the dataset. */
40
  async function urlFile(url) {
41
  const r = await fetch(url);
42
  if (!r.ok) throw new Error(`${url}: HTTP ${r.status}`);
@@ -144,7 +153,7 @@ function vocabSection(node) {
144
  // lines of admit_collections.tsv, in their order; campaigns: the collection and its earlier names, the campaign tags
145
  // of its material sets). terms: Map of the term table by its English term. #2397: profile [{criterion, option}], the
146
  // criteria tools/fetch.py's default profile applies, in its order, each with the option that takes back what it
147
- // leaves out (what Get the data shows the profile leaves out).
148
  export function parseVocabulary(j) {
149
  const form = vocabSection(pick(j, ['form', 'forms']));
150
  for (const [id, name] of form.names) if (!name) form.names.set(id, id.replace(/[-_]+/g, ' '));
@@ -157,17 +166,56 @@ export function parseVocabulary(j) {
157
  // means), by the English term
158
  const terms = new Map((Array.isArray(j?.terms) ? j.terms : []).filter((x) => x?.term).map((x) => [String(x.term), x]));
159
  const profile = (Array.isArray(j?.profile) ? j.profile : []).map((p) => ({ criterion: String(p.criterion), option: String(p.option) }));
160
- return { domain: vocabSection(pick(j, ['domain', 'domains'])), form, layers, relation: j?.relation || null, collections, terms, profile };
 
161
  }
162
 
163
- /** #2066: meta/stage_figures.json -> {rules, stages: Map id -> stage, noStage}: the rules every stage's material passes,
164
- * in their order, and per stage, in the stage table's order, its names, status and measures (counted_by) and its counts
165
- * by them (counts, each null before the release counted the stage fields), which (#2422) the first screen's figure says;
166
- * #2629: noStage, what no stage counts of each layer by reason ({kind: {reason: {measure: value}}}, null for figures
167
- * written before it); null for a commit without the file. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  function parseStageFigures(j) {
169
  if (!j) return null;
170
- return { rules: j.rules || [], stages: new Map((j.stages || []).map((s) => [s.id, s])), noStage: j.no_stage || null };
171
  }
172
 
173
  export const topOf = (code) => String(code).split('.')[0];
@@ -248,8 +296,8 @@ function filesOf(r) {
248
  return [...by].map(([path, x]) => ({ path, ...x, batches: x.batches.sort() })).sort((a, b) => a.path.localeCompare(b.path));
249
  }
250
 
251
- /** Everything the page shows, from one commit. params: URLSearchParams (rev, catalog, vocabulary); onNote(key, values):
252
- * a note for the reader, as a key of the locale files. */
253
  export async function loadIndex(params, onNote) {
254
  const rev = await loadRevision(params.get('rev'));
255
  const at = (p) => wholeFile(rev.sha, p);
@@ -257,6 +305,8 @@ export async function loadIndex(params, onNote) {
257
  const has = (p) => rev.files.includes(p);
258
  const vocabUrl = params.get('vocabulary');
259
  const vocabFile = vocabUrl ? () => urlFile(vocabUrl) : has('meta/vocabulary.json') ? () => at('meta/vocabulary.json') : null;
 
 
260
 
261
  const [cat, sourcesJson, coverage, batches, vocabJson, figures, record, translations, stageFigures, labels] =
262
  await Promise.all([
@@ -273,7 +323,7 @@ export async function loadIndex(params, onNote) {
273
  // #2066: the Chinese names of collections and sources (#2065); #2422: what each training stage can use, the
274
  // first screen's figure; #2518: and, in the same file, the stages of each source
275
  has(TRANSLATIONS) ? readParquet(at(TRANSLATIONS)) : [],
276
- has(STAGE_FIGURES) ? jsonOf(at(STAGE_FIGURES)) : null,
277
  has(LABELS) ? jsonOf(at(LABELS)) : null,
278
  ]);
279
  // the files of each labelled source at the commit, from its file list, so that no folder is listed
@@ -300,8 +350,14 @@ export async function loadIndex(params, onNote) {
300
  if (!batchesBy.has(b.source)) batchesBy.set(b.source, []);
301
  batchesBy.get(b.source).push(b);
302
  }
303
- // the catalog column kind (#952); an index commit before it has none, and the page computes the kind below
 
 
304
  const hasKind = cat.rows.some((r) => r.kind != null && r.kind !== '');
 
 
 
 
305
 
306
  const sources = cat.rows.map((r) => {
307
  const info = srcInfo.get(r.source) || {};
@@ -312,14 +368,17 @@ export async function loadIndex(params, onNote) {
312
  const form = r.form == null || r.form === '' || r.form === 'unclassified' ? null : String(r.form);
313
  // The kind is the catalog column kind: material_set (task-ready) or corpus (raw). An index commit without it gets
314
  // the rule the index writes it by (#1633): a source that holds rows of a collection (sources.json campaign or
315
- // extended_by) or has fewer units than rows is a material set, every other one a corpus.
 
316
  // A unit is one unit_id (a test case, one workbook, one package); files are counted apart. The catalog columns
317
- // units (the distinct units of a material set) and files (its rows; a corpus is counted in rows) are read as they
318
- // are; #2065: a material set whose catalog row has no count of its units has none here (readyUnits null, not
319
- // counted yet), as the figures count it (meta/size_figures.json units_not_counted), never its rows.
 
 
320
  const roles = info.unit || {};
321
  const has = (k) => r[k] != null && r[k] !== '' && Number.isFinite(num(r[k]));
322
- const isTask = hasKind ? r.kind === MATERIAL_SET : !!(info.campaign || info.extended_by) || (has('units') && num(r.units) < rows);
323
  const units = has('units') ? num(r.units) : null;
324
  const lr = info.license_rows?.redistribution_ok || {};
325
  const shipRows = (num(lr.yes?.rows) || 0) + (num(lr.conditional?.rows) || 0);
@@ -328,13 +387,13 @@ export async function loadIndex(params, onNote) {
328
  // release with fetch_check is published
329
  const fc = r.fetch_check || r.fetch;
330
  return {
331
- kind: isTask ? MATERIAL_SET : CORPUS,
332
  isTask,
333
  // the collection of a material set (#1083): a line of admit_collections.tsv; of a corpus (#1633), the collection
334
  // that lists it under corpora in catalog/domains.yaml, else none
335
  collection: r.collection ? String(r.collection) : null,
336
- readyUnits: isTask ? units : 0,
337
- rawRows: isTask ? 0 : rows,
338
  fromCatalog: has('units'),
339
  // what one row of a corpus points at (sources.json unit: file, archive member, ...); a collection's entry counts
340
  // its rows as files (#1633: no roles)
@@ -379,6 +438,12 @@ export async function loadIndex(params, onNote) {
379
  // it is held back, as the release notes give it (catalog column held_back); null for a catalog without them
380
  releasedIn: r.released_in || null,
381
  heldBack: r.held_back || null,
 
 
 
 
 
 
382
  // #2588: the source's declared upstream (catalog columns upstream_kind, upstream_agent and upstream_entry): a
383
  // dataset or a catalog, its agent and its entry address, the values joined by ' | ' while the source reads
384
  // several upstreams; null for a catalog without them
@@ -393,14 +458,20 @@ export async function loadIndex(params, onNote) {
393
  // #2006: the ids of the training stages one of its units passes (#2518: sources of the commit's stage figures),
394
  // [] without stages
395
  stages: stagesOk?.sources?.[r.source] || [],
 
 
 
 
396
  info,
397
  cov: cov[r.source] || null,
398
  batches: batchesBy.get(r.source) || [],
399
  files: filesOf(r),
400
- // its label files (labels/<source>/*.parquet) and its units at or above each leaf's threshold (meta/labels.json
401
- // sources), none for a source the commit carries no labels of
 
402
  labelFiles: (labelFiles.get(r.source) || []).sort(),
403
  labelled: labels?.sources?.[r.source] || null,
 
404
  };
405
  });
406
 
@@ -411,12 +482,16 @@ export async function loadIndex(params, onNote) {
411
  pin: record?.tag || rev.sha,
412
  date: rev.date,
413
  releaseDate: record?.date || rev.date,
414
- overrides: { catalog: params.get('catalog'), vocabulary: params.get('vocabulary') },
415
  hasVocabulary: Boolean(vocabJson),
 
416
  // #1577: who published each file of a material set and under which license, read when the attribution list is
417
  // made; a commit before it has none
418
  hasAttribution: has('meta/attribution.parquet'),
419
  hasKind,
 
 
 
420
  // #2006: the stage table the stages were computed with (version, and each stage with its names, status, about and
421
  // counts), null when the commit has no stage of its sources; #2066: stagesWhy, why it has none (noFigures,
422
  // notCounted or noSources); stageList, the stages of the release's figures, whose status (#2422) the first
@@ -426,17 +501,20 @@ export async function loadIndex(params, onNote) {
426
  stagesWhy,
427
  stageList: stageFigures?.stages || [],
428
  stageFigures: parseStageFigures(stageFigures),
 
 
 
429
  // #2066: the Chinese text of each English text the release shows (TRANSLATIONS, #2065): English -> Chinese, empty
430
  // for a commit without the table
431
  zh: new Map(translations.map((r) => [r.en, r.zh])),
432
  vocab,
433
  sources,
434
  // #1158: the size figures of the whole index and of each layer (meta/size_figures.json, read as they are; #2422:
435
- // the page says their deduplicated size), null for a commit without them
436
- sizes: figures ? { index: figures.index, ...figures.layers } : null,
437
  catalogFile: cat.file,
438
  coverage,
439
- // the labels of corpus units (LABELS: model, leaves, sources), null for a commit without them
440
  labels,
441
  };
442
  }
 
3
  import { compressors } from 'https://cdn.jsdelivr.net/npm/hyparquet-compressors@1.1.2/+esm';
4
  import { downloadFile, pathsInfo } from 'https://cdn.jsdelivr.net/npm/@huggingface/hub@2.17.10/+esm';
5
  import { HF, loadRevision as askRevision, REPO } from './commit.js';
6
+ import { countedOf } from './first.js';
7
  import { t } from './i18n.js';
8
 
9
  export { HF, REPO };
 
12
  export const fileUrl = (sha, path) => `${DATASET_URL}/resolve/${sha}/${path}`;
13
  export const num = (v) => (v == null ? null : typeof v === 'bigint' ? Number(v) : Number(v));
14
 
15
+ // the two layers of an index commit whose catalog has the column kind (#952, #1083): a material set (task material) and
16
+ // a corpus; SOURCE, the one kind of every source of a commit without that column or with labels by method (oneKind)
17
  export const MATERIAL_SET = 'material_set';
18
  export const CORPUS = 'corpus';
19
  export const KINDS = [MATERIAL_SET, CORPUS];
20
+ export const SOURCE = 'source';
21
+ // the label methods of meta/labels.json format /3, in its order (agent, classifier)
22
+ export const LABEL_METHODS = ['agent', 'classifier'];
23
+ const LABELS_BY_METHOD = 'training-data-foundation-labels/3';
24
  // #2065, #2066: the one table of Chinese names the release writes: per English text the index shows (a collection's
25
  // name, a source's title, description or summary, as the catalog holds them) its Chinese text (columns en and zh)
26
  const TRANSLATIONS = 'meta/translations.parquet';
27
  // #2066: the projection's counts per training stage (artpool.stages FIGURES), with (#2065) each stage's funnel
28
  const STAGE_FIGURES = 'meta/stage_figures.json';
29
+ // the labels of units: the record of the labelling (format /3: its methods and model, per leaf its threshold, null for a
30
+ // leaf without a classifier threshold, its units by any method, by method and by class; per source its units of each
31
+ // leaf and its units by method; formats /1 and /2: the classifier's labels of corpus units only, per leaf its
32
+ // threshold, the units at or above it and those by class, per source the units at or above each leaf's threshold), and
33
+ // each labelled source's files labels/<source>/*.parquet (one row per unit, leaf and method: unit_id, leaf, method,
34
+ // score, class, status, threshold; a file of format /1 or /2 has no method)
35
  const LABELS = 'meta/labels.json';
36
  const LABEL_FILE = /^labels\/([^/]+)\/[^/]+\.parquet$/;
37
 
 
45
  return blob;
46
  }
47
 
48
+ /** A file named by its URL in the page address (catalog=, vocabulary=, figures=), which may lie outside the dataset. */
49
  async function urlFile(url) {
50
  const r = await fetch(url);
51
  if (!r.ok) throw new Error(`${url}: HTTP ${r.status}`);
 
153
  // lines of admit_collections.tsv, in their order; campaigns: the collection and its earlier names, the campaign tags
154
  // of its material sets). terms: Map of the term table by its English term. #2397: profile [{criterion, option}], the
155
  // criteria tools/fetch.py's default profile applies, in its order, each with the option that takes back what it
156
+ // leaves out (what Get the data shows the profile leaves out). facets: the facets of the catalog (facetsOf).
157
  export function parseVocabulary(j) {
158
  const form = vocabSection(pick(j, ['form', 'forms']));
159
  for (const [id, name] of form.names) if (!name) form.names.set(id, id.replace(/[-_]+/g, ' '));
 
166
  // means), by the English term
167
  const terms = new Map((Array.isArray(j?.terms) ? j.terms : []).filter((x) => x?.term).map((x) => [String(x.term), x]));
168
  const profile = (Array.isArray(j?.profile) ? j.profile : []).map((p) => ({ criterion: String(p.criterion), option: String(p.option) }));
169
+ return { domain: vocabSection(pick(j, ['domain', 'domains'])), form, layers, relation: j?.relation || null, collections, terms, profile,
170
+ facets: facetsOf(j?.facets) };
171
  }
172
 
173
+ // the facets of the catalog (catalog/facets.yaml of the code repository), in the order of their catalog columns; the
174
+ // values multi and unclassified are every facet's, as the domain's
175
+ export const FACET_IDS = ['subject', 'industry', 'occupation', 'business_process', 'resource_type', 'file_format'];
176
+ export const FACET_FORMAL = ['multi', 'unclassified'];
177
+ /** meta/vocabulary.json facets [{id, name, zh, standard, version, levels, titles?, code_page?, codes: [{code, level,
178
+ * parent, name, title?}]}] -> Map id -> {name, zh, standard, version, titles, codePage, codes: Map code -> {level,
179
+ * parent, name, title}, tree: [[code, depth]]}: titles is the standard a facet's codes take their titles from where
180
+ * its own names are withheld (with its attribution), codePage the address of a code's page with {code} in it, each
181
+ * '' or null without; tree is the standard's hierarchy, each code after its parent and before its next sibling,
182
+ * siblings in the vocabulary's order; an empty Map for a vocabulary without facets. */
183
+ function facetsOf(list) {
184
+ const out = new Map();
185
+ for (const f of Array.isArray(list) ? list : []) {
186
+ const codes = new Map((f.codes || []).map((c) => [String(c.code), { level: c.level || '', parent: c.parent == null ? null : String(c.parent), name: c.name || '', title: c.title || '' }]));
187
+ const kids = new Map();
188
+ for (const [c, x] of codes) {
189
+ const up = x.parent != null && codes.has(x.parent) ? x.parent : null;
190
+ if (!kids.has(up)) kids.set(up, []);
191
+ kids.get(up).push(c);
192
+ }
193
+ const tree = [];
194
+ const walk = (up, depth) => { for (const c of kids.get(up) || []) { tree.push([c, depth]); walk(c, depth + 1); } };
195
+ walk(null, 0);
196
+ out.set(String(f.id), { name: f.name || String(f.id), zh: f.zh || '', standard: f.standard || '', version: f.version || '',
197
+ titles: f.titles || null, codePage: f.code_page || '', codes, tree });
198
+ }
199
+ return out;
200
+ }
201
+ /** A source's codes on a facet with every code above them in the facet's hierarchy (fac, facetsOf; without it the codes
202
+ * alone), so that a filter by a code keeps the sources of the codes under it. */
203
+ function withAncestors(codes, fac) {
204
+ const out = new Set();
205
+ for (const c of codes) {
206
+ for (let x = c; x != null && !out.has(x); x = fac?.codes.get(x)?.parent ?? null) out.add(x);
207
+ }
208
+ return [...out];
209
+ }
210
+
211
+ /** #2066: meta/stage_figures.json -> {rules, stages: Map id -> stage}: the rules every stage's material passes, in
212
+ * their order, and per stage, in the stage table's order, its names, status and measures (counted_by), its counts by
213
+ * them (counts, each null before the release counted the stage fields), which (#2422) the first screen's figure says,
214
+ * and (stage-figures/8) its units by status (statuses, its counted ones by method); null for a commit without the
215
+ * file. */
216
  function parseStageFigures(j) {
217
  if (!j) return null;
218
+ return { rules: j.rules || [], stages: new Map((j.stages || []).map((s) => [s.id, s])) };
219
  }
220
 
221
  export const topOf = (code) => String(code).split('.')[0];
 
296
  return [...by].map(([path, x]) => ({ path, ...x, batches: x.batches.sort() })).sort((a, b) => a.path.localeCompare(b.path));
297
  }
298
 
299
+ /** Everything the page shows, from one commit. params: URLSearchParams (rev, catalog, vocabulary, figures); onNote(key,
300
+ * values): a note for the reader, as a key of the locale files. */
301
  export async function loadIndex(params, onNote) {
302
  const rev = await loadRevision(params.get('rev'));
303
  const at = (p) => wholeFile(rev.sha, p);
 
305
  const has = (p) => rev.files.includes(p);
306
  const vocabUrl = params.get('vocabulary');
307
  const vocabFile = vocabUrl ? () => urlFile(vocabUrl) : has('meta/vocabulary.json') ? () => at('meta/vocabulary.json') : null;
308
+ const figuresUrl = params.get('figures');
309
+ const figuresFile = figuresUrl ? () => urlFile(figuresUrl) : has(STAGE_FIGURES) ? () => at(STAGE_FIGURES) : null;
310
 
311
  const [cat, sourcesJson, coverage, batches, vocabJson, figures, record, translations, stageFigures, labels] =
312
  await Promise.all([
 
323
  // #2066: the Chinese names of collections and sources (#2065); #2422: what each training stage can use, the
324
  // first screen's figure; #2518: and, in the same file, the stages of each source
325
  has(TRANSLATIONS) ? readParquet(at(TRANSLATIONS)) : [],
326
+ figuresFile ? jsonOf(figuresFile()) : null,
327
  has(LABELS) ? jsonOf(at(LABELS)) : null,
328
  ]);
329
  // the files of each labelled source at the commit, from its file list, so that no folder is listed
 
350
  if (!batchesBy.has(b.source)) batchesBy.set(b.source, []);
351
  batchesBy.get(b.source).push(b);
352
  }
353
+ // the catalog column kind (#952); an index commit before it has none, and the page computes the kind below. The page
354
+ // shows one kind of source (oneKind) when the catalog has no such column or the labels are labels by method (format
355
+ // /2): every source is then of the kind SOURCE, counted in units and rows, and task material is taken by label
356
  const hasKind = cat.rows.some((r) => r.kind != null && r.kind !== '');
357
+ const labelsByMethod = labels?.format === LABELS_BY_METHOD;
358
+ const oneKind = !hasKind || labelsByMethod;
359
+ // the facets the catalog has columns of (a commit before them has none, and the page shows no filter by facet)
360
+ const facetIds = FACET_IDS.filter((f) => cat.rows.some((r) => r[f] != null));
361
 
362
  const sources = cat.rows.map((r) => {
363
  const info = srcInfo.get(r.source) || {};
 
368
  const form = r.form == null || r.form === '' || r.form === 'unclassified' ? null : String(r.form);
369
  // The kind is the catalog column kind: material_set (task-ready) or corpus (raw). An index commit without it gets
370
  // the rule the index writes it by (#1633): a source that holds rows of a collection (sources.json campaign or
371
+ // extended_by) or has fewer units than rows is a material set, every other one a corpus; it is used only where the
372
+ // page shows two layers (oneKind false).
373
  // A unit is one unit_id (a test case, one workbook, one package); files are counted apart. The catalog columns
374
+ // units (the distinct units of a source) and files (its rows) are read as they are; #2065: a source whose catalog
375
+ // row has no count of its units has none here (units and, of one kind or a material set, readyUnits null, not
376
+ // counted yet), as the figures count it (meta/size_figures.json units_not_counted), never its rows. Of one kind,
377
+ // every source is counted in units (readyUnits) and rows (rawRows); of two layers, a material set in units and a
378
+ // corpus in rows.
379
  const roles = info.unit || {};
380
  const has = (k) => r[k] != null && r[k] !== '' && Number.isFinite(num(r[k]));
381
+ const isTask = !oneKind && (hasKind ? r.kind === MATERIAL_SET : !!(info.campaign || info.extended_by) || (has('units') && num(r.units) < rows));
382
  const units = has('units') ? num(r.units) : null;
383
  const lr = info.license_rows?.redistribution_ok || {};
384
  const shipRows = (num(lr.yes?.rows) || 0) + (num(lr.conditional?.rows) || 0);
 
387
  // release with fetch_check is published
388
  const fc = r.fetch_check || r.fetch;
389
  return {
390
+ kind: oneKind ? SOURCE : isTask ? MATERIAL_SET : CORPUS,
391
  isTask,
392
  // the collection of a material set (#1083): a line of admit_collections.tsv; of a corpus (#1633), the collection
393
  // that lists it under corpora in catalog/domains.yaml, else none
394
  collection: r.collection ? String(r.collection) : null,
395
+ readyUnits: oneKind || isTask ? units : 0,
396
+ rawRows: oneKind || !isTask ? rows : 0,
397
  fromCatalog: has('units'),
398
  // what one row of a corpus points at (sources.json unit: file, archive member, ...); a collection's entry counts
399
  // its rows as files (#1633: no roles)
 
438
  // it is held back, as the release notes give it (catalog column held_back); null for a catalog without them
439
  releasedIn: r.released_in || null,
440
  heldBack: r.held_back || null,
441
+ // #4406: the address of its card, its section of the card file of its upstream's protocol (catalog column card,
442
+ // path#anchor); null for a catalog without it
443
+ card: r.card || null,
444
+ // the zip that holds the files the index stores for it, campaign_files/<protocol>/<part>.zip (catalog column
445
+ // campaign_part); null for a catalog without it, whose files lie at their paths
446
+ campaignPart: r.campaign_part || null,
447
  // #2588: the source's declared upstream (catalog columns upstream_kind, upstream_agent and upstream_entry): a
448
  // dataset or a catalog, its agent and its entry address, the values joined by ' | ' while the source reads
449
  // several upstreams; null for a catalog without them
 
458
  // #2006: the ids of the training stages one of its units passes (#2518: sources of the commit's stage figures),
459
  // [] without stages
460
  stages: stagesOk?.sources?.[r.source] || [],
461
+ // its codes on each facet the catalog has (catalog columns of FACET_IDS), and the same with every code above
462
+ // them in the facet's hierarchy, which the filters by facet read
463
+ facets: Object.fromEntries(facetIds.map((f) => [f, listOf(r[f]).map(String)])),
464
+ facetKeys: Object.fromEntries(facetIds.map((f) => [f, withAncestors(listOf(r[f]).map(String), vocab.facets.get(f))])),
465
  info,
466
  cov: cov[r.source] || null,
467
  batches: batchesBy.get(r.source) || [],
468
  files: filesOf(r),
469
+ // its label files (labels/<source>/*.parquet), its units of each leaf (meta/labels.json sources: format /3 by any
470
+ // method, /1 and /2 the classifier's at or above each leaf's threshold) and (format /3) its units by method
471
+ // (meta/labels.json by_method), none for a source the commit carries no labels of
472
  labelFiles: (labelFiles.get(r.source) || []).sort(),
473
  labelled: labels?.sources?.[r.source] || null,
474
+ byMethod: labelsByMethod ? labels.by_method?.[r.source] || null : null,
475
  };
476
  });
477
 
 
482
  pin: record?.tag || rev.sha,
483
  date: rev.date,
484
  releaseDate: record?.date || rev.date,
485
+ overrides: { catalog: params.get('catalog'), vocabulary: params.get('vocabulary'), figures: figuresUrl },
486
  hasVocabulary: Boolean(vocabJson),
487
+ facetIds,
488
  // #1577: who published each file of a material set and under which license, read when the attribution list is
489
  // made; a commit before it has none
490
  hasAttribution: has('meta/attribution.parquet'),
491
  hasKind,
492
+ // one kind of source (above), and whether the labels are labels by method (meta/labels.json format /3)
493
+ oneKind,
494
+ labelsByMethod,
495
  // #2006: the stage table the stages were computed with (version, and each stage with its names, status, about and
496
  // counts), null when the commit has no stage of its sources; #2066: stagesWhy, why it has none (noFigures,
497
  // notCounted or noSources); stageList, the stages of the release's figures, whose status (#2422) the first
 
501
  stagesWhy,
502
  stageList: stageFigures?.stages || [],
503
  stageFigures: parseStageFigures(stageFigures),
504
+ // the release tag the stage figures were counted on (counted_on), false while not counted, undefined without them,
505
+ // which the release line says (first.js drawRelease)
506
+ countedOn: countedOf(stageFigures),
507
  // #2066: the Chinese text of each English text the release shows (TRANSLATIONS, #2065): English -> Chinese, empty
508
  // for a commit without the table
509
  zh: new Map(translations.map((r) => [r.en, r.zh])),
510
  vocab,
511
  sources,
512
  // #1158: the size figures of the whole index and of each layer (meta/size_figures.json, read as they are; #2422:
513
+ // the page says their deduplicated size; of one kind, that of the whole index), null for a commit without them
514
+ sizes: figures ? { index: figures.index, [SOURCE]: figures.index, ...figures.layers } : null,
515
  catalogFile: cat.file,
516
  coverage,
517
+ // the labels of units (LABELS: format, methods, model, leaves, sources, by_method), null for a commit without them
518
  labels,
519
  };
520
  }
first.js CHANGED
@@ -1,10 +1,9 @@
1
  // The first screen, drawn before the index is read: the pictograms and (#2422) the training stages of the stage table as
2
- // a column of bands, each with what it can use and (#2629) its funnel, from the release's meta/stage_figures.json of
3
- // the commit the page reads (commit.js), read on its own as soon as that commit is known, with the release line. app.js
4
- // draws both again once it has read the index (drawStages, drawRelease): each stage then a button that sets the filter
5
- // by stage, with its status from the stage table the page was deployed with, and under them what no stage counts, by
6
- // reason. It also has the words of a level's size (#2422: one size, the deduplicated
7
- // one; sizeOf, sizeParts, sizeLine, checkText) that app.js writes.
8
  import { clear, el, fmtBytes, fmtCompact, fmtDate, fmtInt, fmtShare } from './charts.js';
9
  import { HF, loadRevision, REPO } from './commit.js';
10
  import { lang, onLanguage, t } from './i18n.js';
@@ -61,6 +60,29 @@ export const stageColor = (id) => STAGE_COLOR[id] || '--none';
61
  // #2629: the rules every stage's material passes (artpool.stages.RULES, the steps of a funnel), each by the key of its
62
  // words; a rule the page does not know is said by its name
63
  export const RULE_KEY = { benchmark: 'benchmark', 'not compared': 'notCompared', duplicate: 'duplicate' };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  /** #2629: a stage's funnel (funnel of the stage figures, #2065: its counts before the rules, then after each rule) in
66
  * words by the measure m of its figure, each value formatted by fmt: what meets its condition, then what each rule
@@ -73,13 +95,52 @@ function funnelSteps(funnel, m, fmt) {
73
  ...gone.map(([rule, n]) => t(`stage.removed.${RULE_KEY[rule] || 'other'}`, { count: n, n: fmt(n), rule }))];
74
  }
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  /** What a stage can use, in the measures it is counted by (counted_by of the stage figures, #2065), as the dataset card's
77
  * stage figure says it: the headline is the stage's size where it is counted in bytes (after deduplication, so the
78
- * page's one size), else its units, else its rows; the line under it the rows of a stage counted in bytes, the material
79
- * sets of one counted in units. #2629: steps, its funnel in the headline's measure (funnelSteps), which ends at the
80
- * headline. -> {num, word, line, steps}: the figure, its unit, the line and the funnel; not counted yet while its counts
81
- * are null. */
 
 
82
  export function stageWhat(st) {
 
 
 
 
 
83
  const c = st.counts || {};
84
  const by = st.counted_by || [];
85
  const steps = (m, fmt) => funnelSteps(st.funnel || [], m, fmt);
@@ -89,7 +150,8 @@ export function stageWhat(st) {
89
  }
90
  if (by.includes('units') && c.units != null) {
91
  return { num: fmtInt(c.units), word: t('stage.units', { count: c.units }),
92
- line: c.material_sets == null ? '' : t('stage.sets', { count: c.material_sets, n: fmtInt(c.material_sets) }), steps: steps('units', fmtInt) };
 
93
  }
94
  if (by.includes('rows') && c.rows != null) {
95
  return { num: fmtCompact(c.rows), word: t('stage.rowsWord', { count: c.rows }), line: '', steps: steps('rows', fmtCompact) };
@@ -98,38 +160,52 @@ export function stageWhat(st) {
98
  }
99
 
100
  let drawn = null;
101
- /** #2422: the column: one band per stage of stages ([{id, name, zh, status, counted_by, counts, funnel, title}], in the
102
- * stage table's order): the stage's color, its name in the page's language, the mark of a provisional stage, what it
103
- * can use (stageWhat) and (#2629) under them its funnel. With onPick (app.js, once the page can filter by stage) each
104
- * band is a button that calls onPick(id), pressed for pick, the stage the filter holds, and a band that had the focus
105
- * keeps it. rest ({num, word, line, steps, name, title}, from app.js once the index is read): the last band, what no
106
- * stage counts, with (#2629) its sources by reason as its steps, which is no button. why: the short lines that say which
107
- * input the page misses. */
108
- export function drawStages(stages, { pick = '', onPick = null, onPoint = null, why = [], rest = null } = {}) {
109
- drawn = { stages, pick, onPick, onPoint, why, rest };
110
  // onPoint(g): the band the pointer or the focus is on (its place in the column; -1 for none), which the field brings
111
  // forward
112
  const point = (g) => ({ onpointerenter: () => onPoint?.(g), onpointerleave: () => onPoint?.(-1), onfocus: () => onPoint?.(g), onblur: () => onPoint?.(-1) });
113
  const box = document.getElementById('stage-tiles');
114
  const focused = box.contains(document.activeElement) ? document.activeElement.dataset.stage : null;
 
 
 
 
 
 
 
 
 
 
115
  const band = (name, mark, what) => [
116
  el('span', { class: 'core' }),
117
  el('span', {}, el('span', { class: 'nm' }, name, mark ? el('span', { class: 'prov' }, mark) : null), el('span', { class: 'sub' }, what.line)),
118
  el('span', { class: 'amount' }, el('b', { class: 'big' }, what.num), what.word ? el('span', { class: 'unit' }, what.word) : null),
119
- what.steps?.length ? el('span', { class: 'steps' }, what.steps.join(' \u00b7 ')) : null,
120
  ];
121
- // #2629: a band with a line of steps under its name and its figure
122
- const cls = (what) => (what.steps?.length ? 'stratum has-steps' : 'stratum');
 
 
 
 
 
 
123
  const items = stages.map((st, g) => {
124
  const on = pick === st.id;
125
  const what = stageWhat(st);
126
  const kids = band((lang() === 'zh' && st.zh) || st.name, st.status === 'provisional' ? t('stage.provisionalMark') : null, what);
127
  const style = `--c: var(${stageColor(st.id)})`;
128
  return el('li', {}, onPick
129
- ? el('button', { type: 'button', class: cls(what), style, 'aria-pressed': String(on), 'data-stage': st.id, title: st.title, onclick: () => onPick(st.id), ...point(g) }, kids)
130
- : el('div', { class: cls(what), style, ...point(g) }, kids));
131
  });
132
- if (rest) items.push(el('li', {}, el('div', { class: cls(rest), style: '--c: var(--none)', title: rest.title, ...point(stages.length) }, band(rest.name, null, rest))));
133
  clear(box).append(...items);
134
  box.classList.toggle('picked', !!pick);
135
  if (focused) box.querySelector(`[data-stage="${focused}"]`)?.focus({ preventScroll: true });
@@ -139,15 +215,29 @@ export function drawStages(stages, { pick = '', onPick = null, onPoint = null, w
139
  }
140
 
141
  let release = null;
 
 
 
142
  /** #2422: the release the page reads, in one line: its tag (a link to the dataset at that tag, the tag naming it a
143
- * release), its day and a link to the list of every release (the dataset's CHANGELOG.md). */
144
- export function drawRelease(tag, date) {
145
- release = { tag, date };
 
 
 
 
 
 
 
146
  clear(document.getElementById('release-line')).append(
147
  el('a', { class: 'mono', href: `${HF}/datasets/${REPO}/tree/${tag}` }, tag), ' \u00b7 ', fmtDate(date), ' \u00b7 ',
148
- el('a', { href: `${HF}/datasets/${REPO}/blob/main/CHANGELOG.md` }, t('release.all')));
149
  }
150
 
 
 
 
 
151
  decorate();
152
  let drawnFromIndex = false;
153
  /** app.js has drawn the first screen from the index: what this module read early is not drawn again. */
@@ -156,16 +246,20 @@ export const markFromIndex = () => { drawnFromIndex = true; };
156
  onLanguage(() => {
157
  if (drawnFromIndex) return;
158
  if (drawn) drawStages(drawn.stages, drawn);
159
- if (release) drawRelease(release.tag, release.date);
160
  });
161
- // the release's stage figures, read as soon as the commit the page reads is known (?rev= or main as it is now), so the
162
- // first screen shows them before the whole index is read; a commit without the file waits for app.js
163
- loadRevision(new URLSearchParams(location.search).get('rev'))
164
- .then((rev) => (rev.sha && rev.files.includes(STAGE_FIGURES)
165
- ? fetch(`${HF}/datasets/${REPO}/resolve/${rev.sha}/${STAGE_FIGURES}`).then((r) => (r.ok ? r.json() : null)) : null))
 
 
 
 
166
  .then((doc) => {
167
  if (!doc || drawnFromIndex) return;
168
  drawStages(doc.stages || []);
169
- drawRelease(doc.release, doc.date);
170
  })
171
  .catch(() => {});
 
1
  // The first screen, drawn before the index is read: the pictograms and (#2422) the training stages of the stage table as
2
+ // a column of bands, each with what it can use and its units by status (its counted ones by method), from the
3
+ // release's meta/stage_figures.json of the commit the page reads (commit.js), read on its own as soon as that commit is
4
+ // known, with the release line. app.js draws both again once it has read the index (drawStages, drawRelease): each
5
+ // stage then a button that sets the filter by stage. It also has the words of a level's size (#2422: one size, the
6
+ // deduplicated one; sizeOf, sizeParts, sizeLine, checkText) that app.js writes.
 
7
  import { clear, el, fmtBytes, fmtCompact, fmtDate, fmtInt, fmtShare } from './charts.js';
8
  import { HF, loadRevision, REPO } from './commit.js';
9
  import { lang, onLanguage, t } from './i18n.js';
 
60
  // #2629: the rules every stage's material passes (artpool.stages.RULES, the steps of a funnel), each by the key of its
61
  // words; a rule the page does not know is said by its name
62
  export const RULE_KEY = { benchmark: 'benchmark', 'not compared': 'notCompared', duplicate: 'duplicate' };
63
+ // the methods that place a unit on a stage (artpool.stages.METHODS), in their order, and the statuses a unit has on a
64
+ // stage other than counted (artpool.stages.UNIT_STATUSES), in theirs, each by the key of its words
65
+ const METHODS = ['agent', 'classifier', 'rule'];
66
+ const STATUS_KEY = { 'not yet judged': 'notJudged', 'judged below threshold': 'below', 'duplicate of a counted unit': 'duplicate',
67
+ 'overlapping a benchmark': 'benchmark', 'size not recorded': 'unsized', 'archive of recorded members': 'archive' };
68
+
69
+ /** A stage's units by status (statuses of the stage figures; a corpus counts its rows as units), each formatted by fmt:
70
+ * methods, its counted units by each method its count takes (headline of the stage figures; the classifier's not
71
+ * counted yet while the release records no labels), beside, those of its other methods (post-training: the rules'
72
+ * placements, given beside the count and not in it), and statuses, its units of each other status, so that the three
73
+ * add up to every unit of the catalog; null for figures written before the stages gave each unit a status. */
74
+ export function stageStatuses(st, fmt = fmtCompact) {
75
+ const s = st.statuses;
76
+ if (!s) return null;
77
+ const by = s.counted?.methods || {};
78
+ const head = st.headline?.length ? st.headline : METHODS;
79
+ const said = (m) => t(`stage.method.${m}`, { n: by[m] == null ? t('n.notCounted') : fmt(by[m].units) });
80
+ return {
81
+ methods: METHODS.filter((m) => m in by && head.includes(m)).map(said),
82
+ beside: METHODS.filter((m) => m in by && !head.includes(m)).map(said),
83
+ statuses: Object.entries(STATUS_KEY).map(([k, key]) => t(`stage.status.${key}`, { n: fmt(s[k]?.units ?? 0) })),
84
+ };
85
+ }
86
 
87
  /** #2629: a stage's funnel (funnel of the stage figures, #2065: its counts before the rules, then after each rule) in
88
  * words by the measure m of its figure, each value formatted by fmt: what meets its condition, then what each rule
 
95
  ...gone.map(([rule, n]) => t(`stage.removed.${RULE_KEY[rule] || 'other'}`, { count: n, n: fmt(n), rule }))];
96
  }
97
 
98
+ // the label methods of a stage that takes the units with a label (methods of the stage figures), in their order
99
+ const LABEL_METHODS = ['agent', 'classifier'];
100
+ /** The units a stage's count takes by label method in words, one part per method counted (stage.byMethod, the method's
101
+ * name method.<m>), joined by plus signs so that they add up to its count, the agent's with its units of material sets
102
+ * and of corpus units an agent judged (agent_by_layer of the stage figures, stage.agentLayers); '' while none is
103
+ * counted; null for a stage whose count takes no label method (one that takes the units its rules place). */
104
+ function methodsLine(st) {
105
+ const m = st.methods;
106
+ const head = st.headline?.length ? st.headline : LABEL_METHODS;
107
+ if (!m || !LABEL_METHODS.some((k) => k in m && head.includes(k))) return null;
108
+ const layers = st.agent_by_layer;
109
+ const part = (k) => {
110
+ const said = t('stage.byMethod', { method: t(`method.${k}`), count: m[k].units, n: fmtInt(m[k].units) });
111
+ if (k !== 'agent' || layers?.material_set?.units == null || layers?.corpus?.units == null) return said;
112
+ return `${said} ${t('stage.agentLayers', { sets: fmtInt(layers.material_set.units), judged: fmtInt(layers.corpus.units) })}`;
113
+ };
114
+ return LABEL_METHODS.filter((k) => head.includes(k) && m[k]?.units != null).map(part).join(' + ');
115
+ }
116
+
117
+ /** What a stage's classifier units stand on (scoring of the stage figures) in words: the data files the classifier
118
+ * has scored so far of those it scores, with its model (stage.scored), and its held-out precision at its leaves'
119
+ * thresholds with its 95% interval (stage.precision; stage.precisionNone while no leaf has a threshold); [] for a
120
+ * stage without it. */
121
+ export function scoringLines(st) {
122
+ const s = st.scoring;
123
+ if (!s) return [];
124
+ const p = s.precision || {};
125
+ return [t('stage.scored', { n: fmtInt(s.files_scored), m: fmtInt(s.files_planned), model: s.model }),
126
+ p.precision == null ? t('stage.precisionNone')
127
+ : t('stage.precision', { p: p.precision, low: p.interval[0], high: p.interval[1], above: fmtInt(p.above), leaves: fmtInt(p.leaves) })];
128
+ }
129
+
130
  /** What a stage can use, in the measures it is counted by (counted_by of the stage figures, #2065), as the dataset card's
131
  * stage figure says it: the headline is the stage's size where it is counted in bytes (after deduplication, so the
132
+ * page's one size), else its units, else its rows; the line under it the rows of a stage counted in bytes, and of one
133
+ * counted in units its units by label method (methodsLine), which add up to the headline, where the figures have them,
134
+ * else its material sets. Under them its units by status (stageStatuses), or for figures without statuses (#2629)
135
+ * steps, its funnel in the headline's measure (funnelSteps), which ends at the headline, and what its classifier
136
+ * units stand on (scoringLines). -> {num, word, line, steps, statuses, scoring}: the figure, its unit, the line, the
137
+ * funnel, the statuses and the scoring; not counted yet while its counts are null. */
138
  export function stageWhat(st) {
139
+ const statuses = stageStatuses(st);
140
+ const what = { ...headlineOf(st), scoring: scoringLines(st) };
141
+ return statuses ? { ...what, steps: [], statuses } : { ...what, statuses: null };
142
+ }
143
+ function headlineOf(st) {
144
  const c = st.counts || {};
145
  const by = st.counted_by || [];
146
  const steps = (m, fmt) => funnelSteps(st.funnel || [], m, fmt);
 
150
  }
151
  if (by.includes('units') && c.units != null) {
152
  return { num: fmtInt(c.units), word: t('stage.units', { count: c.units }),
153
+ line: methodsLine(st) ?? (c.material_sets == null ? '' : t('stage.sets', { count: c.material_sets, n: fmtInt(c.material_sets) })),
154
+ steps: steps('units', fmtInt) };
155
  }
156
  if (by.includes('rows') && c.rows != null) {
157
  return { num: fmtCompact(c.rows), word: t('stage.rowsWord', { count: c.rows }), line: '', steps: steps('rows', fmtCompact) };
 
160
  }
161
 
162
  let drawn = null;
163
+ /** #2422: the column: one band per stage of stages ([{id, name, zh, status, counted_by, counts, funnel, statuses, title}],
164
+ * in the stage table's order): the stage's color, its name in the page's language, the mark of a provisional stage, what
165
+ * it can use (stageWhat) and under them its counted units by method and its units of every other status (or, for
166
+ * figures without statuses, its funnel). With onPick (app.js, once the page can filter by stage) each band is a button
167
+ * that calls onPick(id), pressed for pick, the stage the filter holds, and a band that had the focus keeps it. why: the
168
+ * short lines that say which input the page misses. */
169
+ export function drawStages(stages, { pick = '', onPick = null, onPoint = null, why = [] } = {}) {
170
+ drawn = { stages, pick, onPick, onPoint, why };
 
171
  // onPoint(g): the band the pointer or the focus is on (its place in the column; -1 for none), which the field brings
172
  // forward
173
  const point = (g) => ({ onpointerenter: () => onPoint?.(g), onpointerleave: () => onPoint?.(-1), onfocus: () => onPoint?.(g), onblur: () => onPoint?.(-1) });
174
  const box = document.getElementById('stage-tiles');
175
  const focused = box.contains(document.activeElement) ? document.activeElement.dataset.stage : null;
176
+ // under the line: the rules' placements beside the count where its count takes the label methods (the line says
177
+ // those), else what its count takes by method; then what its classifier units stand on; then its units of every
178
+ // other status
179
+ const scored = (what) => (what.scoring.length ? el('span', { class: 'by' }, what.scoring.join(' \u00b7 ')) : null);
180
+ const under = (what) => (what.statuses
181
+ ? el('span', { class: 'steps' }, el('span', { class: 'by' }, what.statuses.beside.length
182
+ ? t('stage.beside', { list: what.statuses.beside.join(' \u00b7 ') })
183
+ : t('stage.countedBy', { list: what.statuses.methods.join(' \u00b7 ') })),
184
+ scored(what), el('span', {}, what.statuses.statuses.join(' \u00b7 ')))
185
+ : what.steps?.length ? el('span', { class: 'steps' }, what.steps.join(' \u00b7 ')) : null);
186
  const band = (name, mark, what) => [
187
  el('span', { class: 'core' }),
188
  el('span', {}, el('span', { class: 'nm' }, name, mark ? el('span', { class: 'prov' }, mark) : null), el('span', { class: 'sub' }, what.line)),
189
  el('span', { class: 'amount' }, el('b', { class: 'big' }, what.num), what.word ? el('span', { class: 'unit' }, what.word) : null),
190
+ under(what),
191
  ];
192
+ // a band with lines under its name and its figure
193
+ const cls = (what) => (what.statuses || what.steps?.length ? 'stratum has-steps' : 'stratum');
194
+ // on hover, beside the stage's condition, its units by status in full
195
+ const title = (st) => {
196
+ const full = stageStatuses(st, fmtInt);
197
+ return [st.title, ...(full ? [t('stage.countedBy', { list: full.methods.join(', ') }),
198
+ ...(full.beside.length ? [t('stage.beside', { list: full.beside.join(', ') })] : []), ...scoringLines(st), ...full.statuses] : [])].filter(Boolean).join('\n');
199
+ };
200
  const items = stages.map((st, g) => {
201
  const on = pick === st.id;
202
  const what = stageWhat(st);
203
  const kids = band((lang() === 'zh' && st.zh) || st.name, st.status === 'provisional' ? t('stage.provisionalMark') : null, what);
204
  const style = `--c: var(${stageColor(st.id)})`;
205
  return el('li', {}, onPick
206
+ ? el('button', { type: 'button', class: cls(what), style, 'aria-pressed': String(on), 'data-stage': st.id, title: title(st), onclick: () => onPick(st.id), ...point(g) }, kids)
207
+ : el('div', { class: cls(what), style, title: title(st), ...point(g) }, kids));
208
  });
 
209
  clear(box).append(...items);
210
  box.classList.toggle('picked', !!pick);
211
  if (focused) box.querySelector(`[data-stage="${focused}"]`)?.focus({ preventScroll: true });
 
215
  }
216
 
217
  let release = null;
218
+ // a release tag, which names a revision of the dataset; a publish (<tag>.p<n>: main as the publish that brought its
219
+ // rows to version n after that tag left it) names none, and its link is to main
220
+ const RELEASE_TAG = /^release-\d{4}-\d{2}-\d{2}\.\d+$/;
221
  /** #2422: the release the page reads, in one line: its tag (a link to the dataset at that tag, the tag naming it a
222
+ * release), its day, the release tag or publish its figures were counted on (counted: meta/stage_figures.json
223
+ * counted_on, a link to the dataset at that tag, or at main for a publish; false while not counted, which the line
224
+ * says; undefined without the figures, which it leaves out) and a link to the list of every release (the dataset's
225
+ * CHANGELOG.md). */
226
+ export function drawRelease(tag, date, counted) {
227
+ release = { tag, date, counted };
228
+ const rev = RELEASE_TAG.test(counted || '') ? counted : 'main';
229
+ const on = counted === false ? [t('release.notCounted'), ' \u00b7 ']
230
+ : counted ? [t('release.countedOn'), ' ', el('a', { class: 'mono', href: `${HF}/datasets/${REPO}/tree/${rev}` }, counted), ' \u00b7 ']
231
+ : [];
232
  clear(document.getElementById('release-line')).append(
233
  el('a', { class: 'mono', href: `${HF}/datasets/${REPO}/tree/${tag}` }, tag), ' \u00b7 ', fmtDate(date), ' \u00b7 ',
234
+ ...on, el('a', { href: `${HF}/datasets/${REPO}/blob/main/CHANGELOG.md` }, t('release.all')));
235
  }
236
 
237
+ /** The release tag or publish the stage figures doc was counted on, false while not counted, undefined without one
238
+ * (drawRelease). */
239
+ export const countedOf = (doc) => (!doc ? undefined : doc.counted ? doc.counted_on || undefined : false);
240
+
241
  decorate();
242
  let drawnFromIndex = false;
243
  /** app.js has drawn the first screen from the index: what this module read early is not drawn again. */
 
246
  onLanguage(() => {
247
  if (drawnFromIndex) return;
248
  if (drawn) drawStages(drawn.stages, drawn);
249
+ if (release) drawRelease(release.tag, release.date, release.counted);
250
  });
251
+ // the release's stage figures, read as soon as the commit the page reads is known (?rev= or main as it is now), or from
252
+ // the address's figures=, so the first screen shows them before the whole index is read; a commit without the file
253
+ // waits for app.js
254
+ const query = new URLSearchParams(location.search);
255
+ const figuresAt = query.get('figures');
256
+ (figuresAt ? fetch(figuresAt).then((r) => (r.ok ? r.json() : null))
257
+ : loadRevision(query.get('rev'))
258
+ .then((rev) => (rev.sha && rev.files.includes(STAGE_FIGURES)
259
+ ? fetch(`${HF}/datasets/${REPO}/resolve/${rev.sha}/${STAGE_FIGURES}`).then((r) => (r.ok ? r.json() : null)) : null)))
260
  .then((doc) => {
261
  if (!doc || drawnFromIndex) return;
262
  drawStages(doc.stages || []);
263
+ drawRelease(doc.release, doc.date, countedOf(doc));
264
  })
265
  .catch(() => {});
first.json CHANGED
@@ -1,45 +1,45 @@
1
  {
2
  "collections": 14,
3
- "date": "2026-11-21",
4
  "format": "portal-first/5",
5
- "index": "e26658c3df0ca7a6871d71cf0e815cb903b254fc",
6
- "raw_rows": 1206406941,
7
  "raw_rows_not_counted": 0,
8
- "raw_sources": 139,
9
- "ready_sources": 2222,
10
  "ready_units": 5582,
11
  "ready_units_not_counted": 0,
12
  "sizes": {
13
  "corpus": {
14
- "bytes": 4468489595169130,
15
  "check": {
16
- "compared": 23907,
17
  "error": 2,
18
  "gone": 164,
19
  "hash_mismatch": 15,
20
- "match": 23755,
21
  "needs_auth": 516,
22
- "no_length": 1851,
23
- "rows": 26583,
24
- "size_mismatch": 137,
25
  "unreachable": 143
26
  },
27
  "counts": {
28
- "corpora": 139,
29
- "rows": 1206406941,
30
  "rows_not_counted": 0
31
  },
32
- "distinct_bytes": 4154005797539103,
33
  "estimate": {
34
- "bytes": 514316309239340,
35
- "high": 1050649190969052,
36
- "low": 251877418452551,
37
- "readings": 4306,
38
- "rows": 279904983
39
  },
40
  "facts": {
41
- "collecting": 25,
42
- "every_row_sized": 92,
43
  "pii": {
44
  "dates": [
45
  "2026-10-04",
@@ -55,88 +55,88 @@
55
  "present": 14,
56
  "suspected": 1
57
  },
58
- "not_judged": 121
59
  },
60
- "sources": 139,
61
  "summary_read": 0
62
  },
63
  "shown": {
64
- "bytes": "4.47 PB",
65
- "compared": "23,907",
66
- "corpora": "139",
67
- "distinct_bytes": "4.15 PB",
68
  "estimate": "514 TB",
69
- "match": "23,755",
70
  "range": "252 TB to 1.05 PB",
71
- "read": "26,583",
72
- "rows": "1,206,406,941",
73
- "unsized_rows": "291,042,254"
74
  },
75
  "shown_zh": {
76
- "bytes": "4.47 PB",
77
- "compared": "23,907",
78
- "corpora": "139",
79
- "distinct_bytes": "4.15 PB",
80
  "estimate": "514 TB",
81
- "match": "23,755",
82
  "range": "252 TB \u5230 1.05 PB",
83
- "read": "26,583",
84
- "rows": "1,206,406,941",
85
- "unsized_rows": "291,042,254"
86
  },
87
- "unsized_rows": 291042254
88
  },
89
  "index": {
90
- "bytes": 4468525578656252,
91
  "check": {
92
- "compared": 35825,
93
  "error": 5,
94
  "gone": 167,
95
  "hash_mismatch": 88,
96
- "match": 35579,
97
  "needs_auth": 526,
98
- "no_length": 1851,
99
- "rows": 38519,
100
- "size_mismatch": 158,
101
  "unreachable": 145
102
  },
103
  "counts": {
104
- "corpora": 139,
105
- "material_sets": 2222
106
  },
107
- "distinct_bytes": 4154041666221130,
108
  "estimate": {
109
- "bytes": 514316309239340,
110
- "high": 1050649190969052,
111
- "low": 251877418452551,
112
- "readings": 4306,
113
- "rows": 279904983
114
  },
115
  "shown": {
116
- "bytes": "4.47 PB",
117
- "compared": "35,825",
118
- "corpora": "139",
119
- "distinct_bytes": "4.15 PB",
120
  "estimate": "514 TB",
121
- "match": "35,579",
122
- "material_sets": "2,222",
123
  "range": "252 TB to 1.05 PB",
124
- "read": "38,519",
125
- "unsized_rows": "291,042,254"
126
  },
127
  "shown_zh": {
128
- "bytes": "4.47 PB",
129
- "compared": "35,825",
130
- "corpora": "139",
131
- "distinct_bytes": "4.15 PB",
132
  "estimate": "514 TB",
133
- "match": "35,579",
134
- "material_sets": "2,222",
135
  "range": "252 TB \u5230 1.05 PB",
136
- "read": "38,519",
137
- "unsized_rows": "291,042,254"
138
  },
139
- "unsized_rows": 291042254
140
  },
141
  "material_set": {
142
  "bytes": 35983487122,
@@ -155,10 +155,10 @@
155
  "counts": {
156
  "collections": 14,
157
  "empty_collections": 1,
158
- "files": 14340,
159
  "files_not_counted": 0,
160
- "in_no_collection": 5,
161
- "material_sets": 2222,
162
  "units": 5582,
163
  "units_not_counted": 0
164
  },
@@ -172,9 +172,9 @@
172
  "files": null,
173
  "judged": 0,
174
  "levels": {},
175
- "not_judged": 2222
176
  },
177
- "sources": 2222,
178
  "summary_read": 0
179
  },
180
  "shown": {
@@ -184,14 +184,14 @@
184
  "distinct_bytes": "35.9 GB",
185
  "empty_collections": "1",
186
  "estimate": "none",
187
- "files": "14,340",
188
- "in_no_collection": "5",
189
  "match": "11,824",
190
- "material_sets": "2,222",
191
  "range": "none",
192
  "read": "11,936",
193
  "units": "5,582",
194
- "unsized_rows": "0"
195
  },
196
  "shown_zh": {
197
  "bytes": "36.0 GB",
@@ -200,16 +200,16 @@
200
  "distinct_bytes": "35.9 GB",
201
  "empty_collections": "1",
202
  "estimate": "\u65e0",
203
- "files": "14,340",
204
- "in_no_collection": "5",
205
  "match": "11,824",
206
- "material_sets": "2,222",
207
  "range": "\u65e0",
208
  "read": "11,936",
209
  "units": "5,582",
210
- "unsized_rows": "0"
211
  },
212
- "unsized_rows": 0
213
  }
214
  }
215
  }
 
1
  {
2
  "collections": 14,
3
+ "date": "2026-11-22",
4
  "format": "portal-first/5",
5
+ "index": "4fc6aaf347b76fb50f02464749b908a5e943f58e",
6
+ "raw_rows": 1275880615,
7
  "raw_rows_not_counted": 0,
8
+ "raw_sources": 173,
9
+ "ready_sources": 2223,
10
  "ready_units": 5582,
11
  "ready_units_not_counted": 0,
12
  "sizes": {
13
  "corpus": {
14
+ "bytes": 6321773942949163,
15
  "check": {
16
+ "compared": 23971,
17
  "error": 2,
18
  "gone": 164,
19
  "hash_mismatch": 15,
20
+ "match": 23818,
21
  "needs_auth": 516,
22
+ "no_length": 1876,
23
+ "rows": 26672,
24
+ "size_mismatch": 138,
25
  "unreachable": 143
26
  },
27
  "counts": {
28
+ "corpora": 173,
29
+ "rows": 1275880615,
30
  "rows_not_counted": 0
31
  },
32
+ "distinct_bytes": 5842637891836114,
33
  "estimate": {
34
+ "bytes": 514331975583338,
35
+ "high": 1050678040383540,
36
+ "low": 251885642332258,
37
+ "readings": 4334,
38
+ "rows": 279904705
39
  },
40
  "facts": {
41
+ "collecting": 41,
42
+ "every_row_sized": 115,
43
  "pii": {
44
  "dates": [
45
  "2026-10-04",
 
55
  "present": 14,
56
  "suspected": 1
57
  },
58
+ "not_judged": 155
59
  },
60
+ "sources": 173,
61
  "summary_read": 0
62
  },
63
  "shown": {
64
+ "bytes": "6.32 PB",
65
+ "compared": "23,971",
66
+ "corpora": "173",
67
+ "distinct_bytes": "5.84 PB",
68
  "estimate": "514 TB",
69
+ "match": "23,818",
70
  "range": "252 TB to 1.05 PB",
71
+ "read": "26,672",
72
+ "rows": "1,275,880,615",
73
+ "unsized_rows": "298,463,440"
74
  },
75
  "shown_zh": {
76
+ "bytes": "6.32 PB",
77
+ "compared": "23,971",
78
+ "corpora": "173",
79
+ "distinct_bytes": "5.84 PB",
80
  "estimate": "514 TB",
81
+ "match": "23,818",
82
  "range": "252 TB \u5230 1.05 PB",
83
+ "read": "26,672",
84
+ "rows": "1,275,880,615",
85
+ "unsized_rows": "298,463,440"
86
  },
87
+ "unsized_rows": 298463440
88
  },
89
  "index": {
90
+ "bytes": 6321809926436285,
91
  "check": {
92
+ "compared": 35889,
93
  "error": 5,
94
  "gone": 167,
95
  "hash_mismatch": 88,
96
+ "match": 35642,
97
  "needs_auth": 526,
98
+ "no_length": 1876,
99
+ "rows": 38608,
100
+ "size_mismatch": 159,
101
  "unreachable": 145
102
  },
103
  "counts": {
104
+ "corpora": 173,
105
+ "material_sets": 2223
106
  },
107
+ "distinct_bytes": 5842673760518141,
108
  "estimate": {
109
+ "bytes": 514331975583338,
110
+ "high": 1050678040383540,
111
+ "low": 251885642332258,
112
+ "readings": 4334,
113
+ "rows": 279904705
114
  },
115
  "shown": {
116
+ "bytes": "6.32 PB",
117
+ "compared": "35,889",
118
+ "corpora": "173",
119
+ "distinct_bytes": "5.84 PB",
120
  "estimate": "514 TB",
121
+ "match": "35,642",
122
+ "material_sets": "2,223",
123
  "range": "252 TB to 1.05 PB",
124
+ "read": "38,608",
125
+ "unsized_rows": "298,463,449"
126
  },
127
  "shown_zh": {
128
+ "bytes": "6.32 PB",
129
+ "compared": "35,889",
130
+ "corpora": "173",
131
+ "distinct_bytes": "5.84 PB",
132
  "estimate": "514 TB",
133
+ "match": "35,642",
134
+ "material_sets": "2,223",
135
  "range": "252 TB \u5230 1.05 PB",
136
+ "read": "38,608",
137
+ "unsized_rows": "298,463,449"
138
  },
139
+ "unsized_rows": 298463449
140
  },
141
  "material_set": {
142
  "bytes": 35983487122,
 
155
  "counts": {
156
  "collections": 14,
157
  "empty_collections": 1,
158
+ "files": 14349,
159
  "files_not_counted": 0,
160
+ "in_no_collection": 6,
161
+ "material_sets": 2223,
162
  "units": 5582,
163
  "units_not_counted": 0
164
  },
 
172
  "files": null,
173
  "judged": 0,
174
  "levels": {},
175
+ "not_judged": 2223
176
  },
177
+ "sources": 2223,
178
  "summary_read": 0
179
  },
180
  "shown": {
 
184
  "distinct_bytes": "35.9 GB",
185
  "empty_collections": "1",
186
  "estimate": "none",
187
+ "files": "14,349",
188
+ "in_no_collection": "6",
189
  "match": "11,824",
190
+ "material_sets": "2,223",
191
  "range": "none",
192
  "read": "11,936",
193
  "units": "5,582",
194
+ "unsized_rows": "9"
195
  },
196
  "shown_zh": {
197
  "bytes": "36.0 GB",
 
200
  "distinct_bytes": "35.9 GB",
201
  "empty_collections": "1",
202
  "estimate": "\u65e0",
203
+ "files": "14,349",
204
+ "in_no_collection": "6",
205
  "match": "11,824",
206
+ "material_sets": "2,223",
207
  "range": "\u65e0",
208
  "read": "11,936",
209
  "units": "5,582",
210
+ "unsized_rows": "9"
211
  },
212
+ "unsized_rows": 9
213
  }
214
  }
215
  }
index.html CHANGED
@@ -64,7 +64,7 @@
64
  </div>
65
  <p class="field-empty" id="field-empty" hidden><span data-i18n="sources.none">No source matches</span><button class="link" id="field-clear" type="button" data-i18n="filter.clear">Clear</button></p>
66
  <!-- what a point's light says -->
67
- <p class="field-legend" id="field-legend" hidden><span><i class="l1"></i><span data-i18n="field.legendOn">in the selection</span></span><span><i class="l2"></i><span data-i18n="field.legendHalf">kept, in the other layer</span></span><span><i class="l3"></i><span data-i18n="field.legendOff">filtered out</span></span></p>
68
  <p class="field-off" id="field-off" hidden data-i18n="field.off">The ground of this screen is a field of points, one per source, drawn with WebGL, which this browser does not offer. Everything else on the page works without it.</p>
69
 
70
  <div class="panel views" id="views" hidden>
@@ -86,22 +86,24 @@
86
  <p class="eyebrow" data-i18n="page.eyebrow">The public index</p>
87
  <h1 data-i18n="page.title">Training Data Foundation</h1>
88
  <p class="lede" data-i18n="hero.lede">Real public data for pre-training, mid-training and post-training: each file with its address, size, hashes and license, fetched with one command.</p>
89
- <!-- the release the page reads, in one line: its tag, its day and a link to every release (first.js drawRelease) -->
90
  <p class="release-line" id="release-line"><span class="sk sk-line"></span></p>
91
  </div>
92
  <!-- the stratigraphic column: one band per stage of the stage table, top to bottom as the field stacks them, each
93
- with its funnel, and under them what no stage counts, by reason -->
94
  <figure class="stage-fig" aria-labelledby="stage-fig-h">
95
  <figcaption class="eyebrow" id="stage-fig-h" data-i18n="stage.figTitle">What each training stage can use</figcaption>
96
  <ul class="column" id="stage-tiles"><li><div class="stratum sk-tile"></div></li><li><div class="stratum sk-tile"></div></li><li><div class="stratum sk-tile"></div></li></ul>
97
  <!-- a missing input, one short line each (app.js renderStageFig) -->
98
  <p class="stage-why" id="stage-why" hidden></p>
99
  </figure>
100
- <!-- the words the page counts in and sorts by (material set, corpus, unit, domain): each a button that opens its
 
101
  meaning in place, as the index's vocabulary gives it (app.js renderTerms); the manual's glossary has the rest;
102
  #2614: the popover they open follows the manual's view, outside the page, as the manual's start has the line too -->
103
  <p class="terms" id="terms" hidden></p>
104
- <!-- #2422: the filters: the search, then the domain, the form, the size, the training permit and the personal-data
 
105
  mark (two labels every source carries, which the page filters on and counts and never leaves anything out of a
106
  count for) and the file types. The stage is set by its band above, so its select stays out of sight. A filter
107
  the panel does not show (collection, subdomain, license tier, redistribution, status) still holds from the
@@ -118,6 +120,16 @@
118
  <label hidden><span data-i18n="filter.stage">Training stage</span><select id="f-stage"><option value="" data-i18n="filter.all">All</option></select><span id="f-stage-note" hidden></span></label>
119
  <label><span data-i18n="filter.domain">Domain</span><select id="f-domain"><option value="" data-i18n="filter.all">All</option></select></label>
120
  <label><span data-i18n="filter.form">Form</span><select id="f-form"><option value="" data-i18n="filter.all">All</option></select></label>
 
 
 
 
 
 
 
 
 
 
121
  <label><span data-i18n="filter.size">Size</span><select id="f-size">
122
  <option value="" data-i18n="filter.any">Any</option>
123
  <option value="lt1g" data-i18n="filter.size.lt1g">Under 1 GB</option>
@@ -137,7 +149,7 @@
137
  <option value="marked" data-i18n="filter.pii.marked">Present or suspected</option>
138
  <option value="unknown" data-i18n="filter.pii.unknown">Not judged yet</option>
139
  </select></label>
140
- <!-- #1524: the file types of the layer shown with their rows (app.js fillExt), any number checked; folded
141
  while none is checked, its summary saying how many are -->
142
  <details class="ext-fold" id="ext-fold">
143
  <summary><span data-i18n="filter.ext">File type</span><span class="ext-on" id="ext-on"></span></summary>
@@ -155,8 +167,9 @@
155
  <aside class="panel work-right" aria-labelledby="sel-h">
156
  <div class="pad">
157
  <div class="sel-top"><p class="eyebrow" id="sel-h" data-i18n="chip.selection">Selection</p>
158
- <!-- the layer switch (#1083): the list, the charts and the command take one layer, material sets by default -->
159
- <span class="seg" role="group" aria-label="Show" data-i18n-attr="aria-label:layer.label" id="layer-seg">
 
160
  <button type="button" data-kind="material_set" aria-pressed="true" data-i18n="kind.material_set">Material sets</button>
161
  <button type="button" data-kind="corpus" aria-pressed="false" data-i18n="kind.corpus">Corpora</button>
162
  </span>
@@ -197,9 +210,12 @@
197
  <div class="band-head row reveal">
198
  <h2 id="map-h"><span class="sk sk-line"></span></h2>
199
  <span class="seg-wrap" id="metric-wrap"><span class="seg-label" id="metric-label" data-i18n="metric.label">Count</span>
 
 
200
  <span class="seg" role="group" aria-labelledby="metric-label" id="metric-seg">
201
- <button type="button" data-metric="sets" aria-pressed="true" data-i18n="metric.sets">Material sets</button>
202
  <button type="button" data-metric="units" aria-pressed="false" data-i18n="metric.units">Units</button>
 
203
  </span>
204
  </span>
205
  </div>
@@ -210,20 +226,29 @@
210
  <figure class="chart" id="form-fig"></figure>
211
  </div>
212
  </div>
213
- <!-- the leaves whose material sets hold the fewest units, with their counts, as the funnel picks them (app.js
214
- renderFewest, from projections.leaves of the commit's meta/coverage.json) -->
215
  <div class="card fewest-card" id="fewest" hidden>
216
  <h3 data-i18n="fewest.title">Leaves with the fewest units</h3>
217
- <p class="small" data-i18n="fewest.text">The leaves of the domain grid whose material sets hold the fewest units, the fewest first: the leaves the data foundation promotes corpus rows into material sets for first.</p>
218
  <div id="fewest-body"></div>
219
  </div>
220
- <!-- every leaf with its units by method, agent and classifier, and the classifier's ones by class (app.js
221
- renderLeaves, from projections.leaves of meta/coverage.json and meta/labels.json of the commit) -->
 
222
  <div class="card fewest-card" id="leaves" hidden>
223
  <h3 data-i18n="leaves.title">Units by leaf</h3>
224
- <p class="small" data-i18n="leaves.text">Every leaf of the domain grid with its units by method: agent, the units of the material sets whose domain holds the leaf, each chosen by an agent, and classifier, the corpus units scored by a classifier at or above the leaf's threshold, then the classifier's units by class. Each row's command takes the leaf's classifier units straight from the corpora (--kind corpus --leaf).</p>
225
  <div id="leaves-body"></div>
226
  </div>
 
 
 
 
 
 
 
 
227
  </section>
228
  </div>
229
  </div>
 
64
  </div>
65
  <p class="field-empty" id="field-empty" hidden><span data-i18n="sources.none">No source matches</span><button class="link" id="field-clear" type="button" data-i18n="filter.clear">Clear</button></p>
66
  <!-- what a point's light says -->
67
+ <p class="field-legend" id="field-legend" hidden><span><i class="l1"></i><span data-i18n="field.legendOn">in the selection</span></span><span id="legend-half"><i class="l2"></i><span data-i18n="field.legendHalf">kept, in the other layer</span></span><span><i class="l3"></i><span data-i18n="field.legendOff">filtered out</span></span></p>
68
  <p class="field-off" id="field-off" hidden data-i18n="field.off">The ground of this screen is a field of points, one per source, drawn with WebGL, which this browser does not offer. Everything else on the page works without it.</p>
69
 
70
  <div class="panel views" id="views" hidden>
 
86
  <p class="eyebrow" data-i18n="page.eyebrow">The public index</p>
87
  <h1 data-i18n="page.title">Training Data Foundation</h1>
88
  <p class="lede" data-i18n="hero.lede">Real public data for pre-training, mid-training and post-training: each file with its address, size, hashes and license, fetched with one command.</p>
89
+ <!-- the release the page reads, in one line: its tag, its day, the tag its figures were counted on and a link to every release (first.js drawRelease) -->
90
  <p class="release-line" id="release-line"><span class="sk sk-line"></span></p>
91
  </div>
92
  <!-- the stratigraphic column: one band per stage of the stage table, top to bottom as the field stacks them, each
93
+ with its counted units by method and its units of every other status -->
94
  <figure class="stage-fig" aria-labelledby="stage-fig-h">
95
  <figcaption class="eyebrow" id="stage-fig-h" data-i18n="stage.figTitle">What each training stage can use</figcaption>
96
  <ul class="column" id="stage-tiles"><li><div class="stratum sk-tile"></div></li><li><div class="stratum sk-tile"></div></li><li><div class="stratum sk-tile"></div></li></ul>
97
  <!-- a missing input, one short line each (app.js renderStageFig) -->
98
  <p class="stage-why" id="stage-why" hidden></p>
99
  </figure>
100
+ <!-- the words the page counts in and sorts by (of one kind of source: source, unit, row, label, domain; of two
101
+ layers: material set, corpus, unit, domain): each a button that opens its
102
  meaning in place, as the index's vocabulary gives it (app.js renderTerms); the manual's glossary has the rest;
103
  #2614: the popover they open follows the manual's view, outside the page, as the manual's start has the line too -->
104
  <p class="terms" id="terms" hidden></p>
105
+ <!-- #2422: the filters: the search, then the domain, the form, the facets, the size, the training permit and the
106
+ personal-data
107
  mark (two labels every source carries, which the page filters on and counts and never leaves anything out of a
108
  count for) and the file types. The stage is set by its band above, so its select stays out of sight. A filter
109
  the panel does not show (collection, subdomain, license tier, redistribution, status) still holds from the
 
120
  <label hidden><span data-i18n="filter.stage">Training stage</span><select id="f-stage"><option value="" data-i18n="filter.all">All</option></select><span id="f-stage-note" hidden></span></label>
121
  <label><span data-i18n="filter.domain">Domain</span><select id="f-domain"><option value="" data-i18n="filter.all">All</option></select></label>
122
  <label><span data-i18n="filter.form">Form</span><select id="f-form"><option value="" data-i18n="filter.all">All</option></select></label>
123
+ <!-- the facets of the catalog, each a recognised standard: a select of its codes in the standard's hierarchy,
124
+ a code keeping the sources of the codes under it (app.js facetOptions); shown while the catalog has the
125
+ facet's column -->
126
+ <p class="eyebrow facet-title" id="facet-title" data-i18n="filter.facets" hidden>By standard</p>
127
+ <label hidden><span>Subject</span><select id="f-subject"><option value="" data-i18n="filter.all">All</option></select></label>
128
+ <label hidden><span>Industry</span><select id="f-industry"><option value="" data-i18n="filter.all">All</option></select></label>
129
+ <label hidden><span>Occupation and work</span><select id="f-occupation"><option value="" data-i18n="filter.all">All</option></select></label>
130
+ <label hidden><span>Business process</span><select id="f-business_process"><option value="" data-i18n="filter.all">All</option></select></label>
131
+ <label hidden><span>Resource type</span><select id="f-resource_type"><option value="" data-i18n="filter.all">All</option></select></label>
132
+ <label hidden><span>File format</span><select id="f-file_format"><option value="" data-i18n="filter.all">All</option></select></label>
133
  <label><span data-i18n="filter.size">Size</span><select id="f-size">
134
  <option value="" data-i18n="filter.any">Any</option>
135
  <option value="lt1g" data-i18n="filter.size.lt1g">Under 1 GB</option>
 
149
  <option value="marked" data-i18n="filter.pii.marked">Present or suspected</option>
150
  <option value="unknown" data-i18n="filter.pii.unknown">Not judged yet</option>
151
  </select></label>
152
+ <!-- #1524: the file types of the sources shown with their rows (app.js fillExt), any number checked; folded
153
  while none is checked, its summary saying how many are -->
154
  <details class="ext-fold" id="ext-fold">
155
  <summary><span data-i18n="filter.ext">File type</span><span class="ext-on" id="ext-on"></span></summary>
 
167
  <aside class="panel work-right" aria-labelledby="sel-h">
168
  <div class="pad">
169
  <div class="sel-top"><p class="eyebrow" id="sel-h" data-i18n="chip.selection">Selection</p>
170
+ <!-- the layer switch (#1083) of an index commit of two layers: the list, the charts and the command take one
171
+ layer, material sets by default; hidden on a commit of one kind of source (app.js renderMapHead) -->
172
+ <span class="seg" role="group" aria-label="Show" data-i18n-attr="aria-label:layer.label" id="layer-seg" hidden>
173
  <button type="button" data-kind="material_set" aria-pressed="true" data-i18n="kind.material_set">Material sets</button>
174
  <button type="button" data-kind="corpus" aria-pressed="false" data-i18n="kind.corpus">Corpora</button>
175
  </span>
 
210
  <div class="band-head row reveal">
211
  <h2 id="map-h"><span class="sk sk-line"></span></h2>
212
  <span class="seg-wrap" id="metric-wrap"><span class="seg-label" id="metric-label" data-i18n="metric.label">Count</span>
213
+ <!-- of one kind of source: sources, units or rows; of two layers, material sets or units (app.js
214
+ renderMapHead names them and shows the rows of one kind only) -->
215
  <span class="seg" role="group" aria-labelledby="metric-label" id="metric-seg">
216
+ <button type="button" data-metric="sets" aria-pressed="true" data-i18n="metric.sources">Sources</button>
217
  <button type="button" data-metric="units" aria-pressed="false" data-i18n="metric.units">Units</button>
218
+ <button type="button" data-metric="rows" aria-pressed="false" data-i18n="metric.allRows" hidden>Rows</button>
219
  </span>
220
  </span>
221
  </div>
 
226
  <figure class="chart" id="form-fig"></figure>
227
  </div>
228
  </div>
229
+ <!-- the leaves with the fewest units, with their counts (app.js renderFewest: by the units labelled for each
230
+ leaf, meta/labels.json, or on an older commit by the units of the material sets, meta/coverage.json) -->
231
  <div class="card fewest-card" id="fewest" hidden>
232
  <h3 data-i18n="fewest.title">Leaves with the fewest units</h3>
233
+ <p class="small" id="fewest-text" data-i18n="fewest.text">The leaves of the domain grid with the fewest units labelled for them by any method, the fewest first.</p>
234
  <div id="fewest-body"></div>
235
  </div>
236
+ <!-- every leaf with its units by method (agent, classifier), the classifier's threshold, its units by class
237
+ and the command that takes its units by label (app.js renderLeaves, from meta/labels.json and
238
+ projections.leaves of meta/coverage.json of the commit) -->
239
  <div class="card fewest-card" id="leaves" hidden>
240
  <h3 data-i18n="leaves.title">Units by leaf</h3>
241
+ <p class="small" id="leaves-text" data-i18n="leaves.text">Every leaf of the domain grid with its units labelled by any method and by each method: agent (judged one by one usable for the leaf by an agent) and classifier (scored at or above the leaf's threshold, shown beside it); then its units by class. Each row's command takes the leaf's labelled units from every source (--leaf), by the method chosen above the table (--method).</p>
242
  <div id="leaves-body"></div>
243
  </div>
244
+ <!-- every source by its kind of source and by the class of its form, the material sets with their units and the
245
+ corpora with theirs (app.js renderKinds, from projections.source_kinds and projections.classes of the
246
+ commit's meta/coverage.json) -->
247
+ <div class="card fewest-card" id="kinds" hidden>
248
+ <h3 data-i18n="kinds.title">Units by kind of source and by class</h3>
249
+ <p class="small" data-i18n="kinds.text">Every source of this commit, whatever its status, by its kind of source (catalog/source_kinds.tsv) and by the class of its form (catalog/stages.yaml): its material sets with their units, and its corpora with their units, a corpus counting its rows. The units of the two layers are never added together.</p>
250
+ <div id="kinds-body"></div>
251
+ </div>
252
  </section>
253
  </div>
254
  </div>
linked.js CHANGED
@@ -2,30 +2,34 @@
2
  // the bars by domain and by form. One crossfilter selection holds the filters: a click on a bar or a map cell
3
  // and the filter panel set its clauses; the charts, the counts of the filter options, the tables behind the charts and
4
  // the list of selected sources all read it. app.js draws the rest of the page and loads this module after the first
5
- // screen has painted. Every chart draws one layer only (#1083), the one the clause kind selects, in its color and its
6
- // measure: material sets in the main color, in sets or units; corpora in gray, in rows. The two are never stacked or
 
7
  // added. The same DuckDB-WASM holds meta/preview.parquet once a row's "Preview rows" first opens.
8
  // Standard tool: linked charts over one crossfilter selection by Mosaic vgplot (wasmConnector, DuckDB-WASM).
9
  import * as vg from 'https://cdn.jsdelivr.net/npm/@uwdata/vgplot@0.34.3/+esm';
10
  import { widest as measured } from './charts.js';
11
 
12
  // #2422: the page's colors in its theme (style.css), read when a chart is drawn, so a new theme draws them again
13
- // (app.js): each layer's color (data.js KINDS: --ours for material sets, --other for corpora), the empty part of a map
14
- // cell (--map-empty), the low end of a layer's color scale on the map (--map-low-ours, --map-low-other: its color at 20%
15
- // over the empty cell's, so a cell with a small count still shows apart from an empty one) and the ink of the labels
 
16
  const css = (name) => getComputedStyle(document.documentElement).getPropertyValue(name).trim();
17
- const colors = () => ({ kind: { material_set: css('--ours'), corpus: css('--other') }, empty: css('--map-empty'),
18
- low: { material_set: css('--map-low-ours'), corpus: css('--map-low-other') }, ink: css('--ink-2') });
19
 
20
  export const sel = vg.Selection.crossfilter();
21
 
22
  // The page's own columns of every source (app.js pageRow, from data.js), joined to meta/catalog.parquet of the commit
23
  // the page reads. A domain key is a top-level code, _multi or _none (dkeys, a list); codes are the domain codes with
24
- // their leaves; hcol is the map's column (a form, _other or _none); kind is the layer, material_set or corpus;
25
- // collection is that of a material set ('' for a corpus); n_units counts the units of a material set and n_rows the
26
- // rows of a corpus (0 for the other kind); #1524: exts are its file types and ext_rows the rows of each, in the same
 
27
  // order; #2006: stages are the ids of the training stages one of its units passes (the commit's stage figures); #2422: pii is its
28
- // personal-data mark (none, marked or unknown), sizeb the size class of its deduplicated size. The view dom holds one
 
29
  // row per source and domain key (dkey): DuckDB does not take UNNEST next to an aggregate
30
  // in one SELECT, so the domain charts and their tables group dom by dkey.
31
  const SRC = `CREATE OR REPLACE TABLE src AS SELECT p.source, c.title,
@@ -36,7 +40,10 @@ const SRC = `CREATE OR REPLACE TABLE src AS SELECT p.source, c.title,
36
  CAST(p.sizeb AS VARCHAR) AS sizeb, CAST(p.tier AS VARCHAR) AS tier,
37
  CAST(p.train AS VARCHAR) AS train, CAST(p.redist AS VARCHAR) AS redist, CAST(p.pii AS VARCHAR) AS pii,
38
  CAST(p.qtext AS VARCHAR) AS qtext,
39
- CAST(p.exts AS VARCHAR[]) AS exts, CAST(p.ext_rows AS DOUBLE[]) AS ext_rows, CAST(p.stages AS VARCHAR[]) AS stages
 
 
 
40
  FROM page p LEFT JOIN catalog c USING (source)`;
41
  const DOM = 'CREATE OR REPLACE VIEW dom AS SELECT *, UNNEST(dkeys) AS dkey FROM src';
42
  // the page's DuckDB-WASM, once open
@@ -75,16 +82,17 @@ export async function previewRows(read, source) {
75
  return rows.toArray().map((r) => ({ ...r }));
76
  }
77
 
78
- // ---- the metric of the charts, in the layer shown: material sets (sets) or their units, or the rows of corpora; its
79
- // sum, and the same sum as text for the labels at the bar ends
 
80
  const AGG = { sets: () => vg.sum('n_src'), units: () => vg.sum('n_units'), rows: () => vg.sum('n_rows') };
81
  const LABEL = {
82
  sets: () => vg.sql`format('{:,}', CAST(sum(n_src) AS BIGINT))`,
83
  units: () => vg.sql`format('{:,}', CAST(sum(n_units) AS BIGINT))`,
84
  rows: () => vg.sql`format('{:,}', CAST(sum(n_rows) AS BIGINT))`,
85
  };
86
- // the columns of the tables behind the charts, over the layer shown: its sources (n), the units of material sets and
87
- // the rows of corpora (0 in the other layer)
88
  const SUMS = 'count(*) AS n, sum(n_units) AS units, sum(n_rows) AS rows';
89
 
90
  const whereOf = (filter) => (filter && filter.length ? `WHERE ${filter.map((p) => `(${p})`).join(' AND ')}` : '');
@@ -104,7 +112,8 @@ class Rows extends vg.MosaicClient {
104
  const connect = (client) => { vg.coordinator().connect(client); return client; };
105
 
106
  // ---- the filters: one clause source per filter, its predicate over src
107
- const KEYS = ['domain', 'leaf', 'form', 'collection', 'kind', 'status', 'train', 'redist', 'tier', 'size', 'q', 'ext', 'stage', 'pii'];
 
108
  const SOURCES = Object.fromEntries(KEYS.map((k) => [k, { filter: k, reset() {} }]));
109
  // a clause that keeps every row, made the active clause last: the next round of queries then gives every client its
110
  // own predicate (a client of the active clause would be skipped). A new clause object each time, so the selection emits.
@@ -129,6 +138,13 @@ const PREDICATE = {
129
  stage: (v) => vg.sql`list_contains(stages, ${lit(v)})`,
130
  // #2422: the personal-data mark
131
  pii: (v) => vg.sql`pii = ${lit(v)}`,
 
 
 
 
 
 
 
132
  };
133
  // what each filter's option counts are over: one value per row, or a list unnested; #2422: the filters the panel shows
134
  // (app.js SELECTS), the file types apart (startFacets)
@@ -139,6 +155,12 @@ const FACET = {
139
  size: 'sizeb',
140
  train: "UNNEST(CASE train WHEN 'yes' THEN ['yes', 'cond'] WHEN 'cond' THEN ['cond'] ELSE []::VARCHAR[] END)",
141
  pii: 'pii',
 
 
 
 
 
 
142
  };
143
 
144
  // clients that a filter's clause leaves out: the facet of that filter, and the chart that sets it (its marks and its
 
2
  // the bars by domain and by form. One crossfilter selection holds the filters: a click on a bar or a map cell
3
  // and the filter panel set its clauses; the charts, the counts of the filter options, the tables behind the charts and
4
  // the list of selected sources all read it. app.js draws the rest of the page and loads this module after the first
5
+ // screen has painted. Every chart draws the sources the clause kind selects, in its color and its measure: of one kind
6
+ // of source (app.js oneKind) every source, in the main color, in sources, units or rows; of two layers one layer only
7
+ // (#1083), material sets in the main color, in sets or units, corpora in gray, in rows, the two never stacked or
8
  // added. The same DuckDB-WASM holds meta/preview.parquet once a row's "Preview rows" first opens.
9
  // Standard tool: linked charts over one crossfilter selection by Mosaic vgplot (wasmConnector, DuckDB-WASM).
10
  import * as vg from 'https://cdn.jsdelivr.net/npm/@uwdata/vgplot@0.34.3/+esm';
11
  import { widest as measured } from './charts.js';
12
 
13
  // #2422: the page's colors in its theme (style.css), read when a chart is drawn, so a new theme draws them again
14
+ // (app.js): each layer's color (data.js KINDS: --ours for material sets, --other for corpora; --ours for the one kind
15
+ // of source, data.js SOURCE), the empty part of a map cell (--map-empty), the low end of a layer's color scale on the
16
+ // map (--map-low-ours, --map-low-other: its color at 20% over the empty cell's, so a cell with a small count still
17
+ // shows apart from an empty one) and the ink of the labels
18
  const css = (name) => getComputedStyle(document.documentElement).getPropertyValue(name).trim();
19
+ const colors = () => ({ kind: { material_set: css('--ours'), corpus: css('--other'), source: css('--ours') }, empty: css('--map-empty'),
20
+ low: { material_set: css('--map-low-ours'), corpus: css('--map-low-other'), source: css('--map-low-ours') }, ink: css('--ink-2') });
21
 
22
  export const sel = vg.Selection.crossfilter();
23
 
24
  // The page's own columns of every source (app.js pageRow, from data.js), joined to meta/catalog.parquet of the commit
25
  // the page reads. A domain key is a top-level code, _multi or _none (dkeys, a list); codes are the domain codes with
26
+ // their leaves; hcol is the map's column (a form, _other or _none); kind is the layer, material_set or corpus, or of one
27
+ // kind source for every source; collection is that of a material set or a source ('' for none); n_units counts the
28
+ // units of a material set (of one kind, of every source) and n_rows the rows of a corpus (of one kind, of every source;
29
+ // 0 for the other kind of two layers); #1524: exts are its file types and ext_rows the rows of each, in the same
30
  // order; #2006: stages are the ids of the training stages one of its units passes (the commit's stage figures); #2422: pii is its
31
+ // personal-data mark (none, marked or unknown), sizeb the size class of its deduplicated size; fc_<facet> are its codes
32
+ // on each facet of the catalog with every code above them in the facet's hierarchy. The view dom holds one
33
  // row per source and domain key (dkey): DuckDB does not take UNNEST next to an aggregate
34
  // in one SELECT, so the domain charts and their tables group dom by dkey.
35
  const SRC = `CREATE OR REPLACE TABLE src AS SELECT p.source, c.title,
 
40
  CAST(p.sizeb AS VARCHAR) AS sizeb, CAST(p.tier AS VARCHAR) AS tier,
41
  CAST(p.train AS VARCHAR) AS train, CAST(p.redist AS VARCHAR) AS redist, CAST(p.pii AS VARCHAR) AS pii,
42
  CAST(p.qtext AS VARCHAR) AS qtext,
43
+ CAST(p.exts AS VARCHAR[]) AS exts, CAST(p.ext_rows AS DOUBLE[]) AS ext_rows, CAST(p.stages AS VARCHAR[]) AS stages,
44
+ CAST(p.fc_subject AS VARCHAR[]) AS fc_subject, CAST(p.fc_industry AS VARCHAR[]) AS fc_industry,
45
+ CAST(p.fc_occupation AS VARCHAR[]) AS fc_occupation, CAST(p.fc_business_process AS VARCHAR[]) AS fc_business_process,
46
+ CAST(p.fc_resource_type AS VARCHAR[]) AS fc_resource_type, CAST(p.fc_file_format AS VARCHAR[]) AS fc_file_format
47
  FROM page p LEFT JOIN catalog c USING (source)`;
48
  const DOM = 'CREATE OR REPLACE VIEW dom AS SELECT *, UNNEST(dkeys) AS dkey FROM src';
49
  // the page's DuckDB-WASM, once open
 
82
  return rows.toArray().map((r) => ({ ...r }));
83
  }
84
 
85
+ // ---- the metric of the charts: sources (sets) or their units, or their rows (of two layers, material sets or their
86
+ // units in the layer of material sets, the rows of corpora in theirs); its sum, and the same sum as text for the labels
87
+ // at the bar ends
88
  const AGG = { sets: () => vg.sum('n_src'), units: () => vg.sum('n_units'), rows: () => vg.sum('n_rows') };
89
  const LABEL = {
90
  sets: () => vg.sql`format('{:,}', CAST(sum(n_src) AS BIGINT))`,
91
  units: () => vg.sql`format('{:,}', CAST(sum(n_units) AS BIGINT))`,
92
  rows: () => vg.sql`format('{:,}', CAST(sum(n_rows) AS BIGINT))`,
93
  };
94
+ // the columns of the tables behind the charts: their sources (n), their units and their rows (of two layers, the units
95
+ // of material sets and the rows of corpora, 0 in the other layer)
96
  const SUMS = 'count(*) AS n, sum(n_units) AS units, sum(n_rows) AS rows';
97
 
98
  const whereOf = (filter) => (filter && filter.length ? `WHERE ${filter.map((p) => `(${p})`).join(' AND ')}` : '');
 
112
  const connect = (client) => { vg.coordinator().connect(client); return client; };
113
 
114
  // ---- the filters: one clause source per filter, its predicate over src
115
+ const KEYS = ['domain', 'leaf', 'form', 'collection', 'kind', 'status', 'train', 'redist', 'tier', 'size', 'q', 'ext', 'stage', 'pii',
116
+ 'subject', 'industry', 'occupation', 'business_process', 'resource_type', 'file_format'];
117
  const SOURCES = Object.fromEntries(KEYS.map((k) => [k, { filter: k, reset() {} }]));
118
  // a clause that keeps every row, made the active clause last: the next round of queries then gives every client its
119
  // own predicate (a client of the active clause would be skipped). A new clause object each time, so the selection emits.
 
138
  stage: (v) => vg.sql`list_contains(stages, ${lit(v)})`,
139
  // #2422: the personal-data mark
140
  pii: (v) => vg.sql`pii = ${lit(v)}`,
141
+ // a code of a facet: a source with that code or one under it
142
+ subject: (v) => vg.sql`list_contains(fc_subject, ${lit(v)})`,
143
+ industry: (v) => vg.sql`list_contains(fc_industry, ${lit(v)})`,
144
+ occupation: (v) => vg.sql`list_contains(fc_occupation, ${lit(v)})`,
145
+ business_process: (v) => vg.sql`list_contains(fc_business_process, ${lit(v)})`,
146
+ resource_type: (v) => vg.sql`list_contains(fc_resource_type, ${lit(v)})`,
147
+ file_format: (v) => vg.sql`list_contains(fc_file_format, ${lit(v)})`,
148
  };
149
  // what each filter's option counts are over: one value per row, or a list unnested; #2422: the filters the panel shows
150
  // (app.js SELECTS), the file types apart (startFacets)
 
155
  size: 'sizeb',
156
  train: "UNNEST(CASE train WHEN 'yes' THEN ['yes', 'cond'] WHEN 'cond' THEN ['cond'] ELSE []::VARCHAR[] END)",
157
  pii: 'pii',
158
+ subject: 'UNNEST(fc_subject)',
159
+ industry: 'UNNEST(fc_industry)',
160
+ occupation: 'UNNEST(fc_occupation)',
161
+ business_process: 'UNNEST(fc_business_process)',
162
+ resource_type: 'UNNEST(fc_resource_type)',
163
+ file_format: 'UNNEST(fc_file_format)',
164
  };
165
 
166
  // clients that a filter's clause leaves out: the facet of that filter, and the chart that sets it (its marks and its
llms.txt CHANGED
@@ -1,11 +1,11 @@
1
  # Training Data Foundation: for agents
2
 
3
- - The index holds two layers over the same public web, kept apart and never added together. Each corpus is one whole upstream read in bulk and counted in rows; a material set is admitted for building tasks from works the search found upstream or from a group of corpus rows, its files checked and grouped into units, and it is counted in units, apart from any corpus its rows came from. Task material comes first: material sets, grouped into collections, one per task family. A material set (task-ready) is the units admitted from one source, which reads one upstream (one dataset or one data catalog), for building tasks (the catalog column `kind` is `material_set`, and `collection` names its collection). A unit is a group of files that its upstream publishes as one thing, delivered whole; its key `unit_id` is the `unit_group` its rows share (`extra.source_meta.unit_group`), defined once, in the glossary of the data page's manual, https://battam-training-data-foundation.static.hf.space/index.html?lng=en#manual/glossary . A unit is material, not a task: one unit may give several tasks, and one task may use several units. Corpora come second, to search when no material set fits: a corpus (raw; plural corpora) is one whole upstream that a collector keeps reading, such as Common Crawl's office documents, PyPI's release files, Mendeley Data or NVD: its rows are pointers to files or API responses, and it is counted in rows (`kind` is `corpus`); `tools/fetch.py` takes a corpus row by row, each under its own key as its `unit_id`.
4
- - Pick material sets or corpora from `meta/catalog.parquet` (one row per material set or corpus, about 50 KB; do not download `meta/` whole). Columns: `source`; `kind`, `material_set` or `corpus` (select one layer: units and rows are never added together); `collection`, the code of a material set's collection (every code with its name is in `meta/vocabulary.json`), or of the collection that lists a corpus as holding its kind of material (`corpora` in `meta/vocabulary.json`; empty for any other corpus); `domain`, a list of codes D1 to D10 or leaves such as D3.5, or `multi`, `unclassified`; `form`, such as `test-suites` or `spreadsheets`; `upstream_kind`, `upstream_agent` and `upstream_entry`, the source's upstream (`dataset` or `catalog`, its agent, and the address its reading starts from; a source that still reads several upstreams gives each, joined by ` | `); `units` (a material set's distinct `unit_id` values: a test case, one workbook, one package; a corpus is counted in rows, and gives the same number as `files`) and `files` (its rows: for a material set, the files of its units and its README.md and LICENSE); `publishers` (a material set's distinct publisher names over all its rows; empty when its rows name none); `language` (the language codes of the rows' labels, what the default profile filters on; `not recorded` when a row has none); `contamination.level` (by the rule of the default profile of `tools/fetch.py` over `meta/bench_overlap.parquet` and `meta/bench_checked.parquet`: `none` when every data file is compared and kept and no row is removed, the hit class with the most removed rows when some are removed, `not scanned` otherwise); `license.ship`; `pii.level`; `distinct_bytes` (deduplicated size) and `bytes` (recorded size, the sum over rows); `size_check` (the rows read in `meta/sizes.parquet`, `compared` those that compared a size or hash, and how many have each status, `match` when the measured size agrees; the check's share is `match` over `compared`), `unsized_rows` (rows without a recorded size) and `unsized_estimate` (their estimated size, with its 95% range); `fetch_check` (whether the upstream still serves the files: `rows`, the sampled rows read in `meta/sizes.parquet`; `fetched`, those that fetched and matched their recorded size and hash; `read_at`, the day read; `level`, `all`, `some`, `none`, `needs auth` (no row read fetched, and the source's rows need the paying or signed-in reader its `needs_auth` names, which the check, reading anonymously, does not have) or `not read`); the same figures for the whole index, each layer and each collection are in `meta/size_figures.json`. Who published each file of a material set, and under which license and license URL, is in `meta/attribution.parquet` (one row per source, publisher, license and license URL, with its number of files). The vocabulary is `meta/vocabulary.json`: every domain code with its name (and `zh`, its Chinese name), what it covers and its parent, every form with its Chinese name and what it means, every category of `meta/not_included.parquet` with its requirement in English and in Chinese, the two layers with their relation, and every collection with its name, what it holds, its campaigns (take a collection with `--tag campaign:<name>` for each of its campaigns) and the corpora it lists, if any (take one with `--source`), and the criteria the default profile of `tools/fetch.py` applies, in its order (`profile`, each with the option that keeps what it removes).
5
- - Size of this release: Whole index: Recorded size 4.47 PB; deduplicated size 4.15 PB; size check: 99.3% match (35,825 of the 38,519 rows read compared); not compared: address unreachable 145, file gone 167, login needed 526, no size from the server 1,851, other error 5; estimated size of 279,904,983 of the 291,042,254 rows without a recorded size: 514 TB (an estimate; 95% range 252 TB to 1.05 PB, the sum of its sources' ranges, wider than a joint interval; from 4,306 rows read), the other 11,137,271 with too few rows read for an estimate. Task material: Recorded size 36.0 GB; deduplicated size 35.9 GB; size check: 99.2% match (11,918 of the 11,936 rows read compared); not compared: address unreachable 2, file gone 3, login needed 10, other error 3. Corpora: Recorded size 4.47 PB; deduplicated size 4.15 PB; size check: 99.4% match (23,907 of the 26,583 rows read compared); not compared: address unreachable 143, file gone 164, login needed 516, no size from the server 1,851, other error 2; estimated size of 279,904,983 of the 291,042,254 rows without a recorded size: 514 TB (an estimate; 95% range 252 TB to 1.05 PB, the sum of its sources' ranges, wider than a joint interval; from 4,306 rows read), the other 11,137,271 with too few rows read for an estimate. Distinct content is the sum of `size_bytes` over the rows minus the sizes of the rows that repeat another row's content (the same sha256, else sha1, else md5 and size, within the same hash scope; one copy of each content is kept, in the first source by registry order), counted after each release over the data files it published, per source in the catalog column `distinct_bytes`; archive members whose archive the same source also lists whole have other hashes, so they are not subtracted. `tools/fetch.py` removes duplicates over your own selection when it reads it. The deduplicated sizes here were counted over the data files of release `release-2026-11-21.1`. The recorded size is the sum of `size_bytes` over the rows that have one (catalog column `bytes`). The check reads a sample of rows of every data file (`meta/sizes.parquet`), each day the files with rows of a source not read there yet and those of the sources read longest ago, about a seventh of all the readings, so each is read again within a week: 20 of its rows with a recorded size of each source whose rows it holds, and of its rows without one its share of its source's sample, sized for their mean size within 25% at 95% confidence by the spread of the sizes read so far (at most 400 rows per source per round, 20 for a source with none read yet); its share is the rows that match their recorded size out of the rows it compared (status `match`, `size_mismatch` or `hash_mismatch`), and the rows it could not compare, which never reached their file, are counted beside it by status (`unreachable`, `gone`, `needs_auth`, `no_length`, `error`; catalog column `size_check`). The estimate for a source's rows without a recorded size (catalog columns `unsized_rows` and `unsized_estimate`) is their number times the mean measured size of such rows read, with a 95% BCa bootstrap range (`scipy.stats.bootstrap`, its default resample count); a source with fewer than 10 such rows read has none. Above one source, the estimate is the sum of its sources' estimates and its range the sum of their ranges, which is wider than a joint interval. The figures of every level are in `meta/size_figures.json`.
6
- - Fetch with one command: `uv run https://huggingface.co/datasets/Battam/training-data-foundation/resolve/main/tools/fetch.py --kind material_set --domain D3 --form spreadsheets --out ./data` takes those material sets whole, as the data page does unless told otherwise; take a corpus, whose whole can be petabytes, with `--sample N` (the data page takes 3 units of each by default) or `--limit N`. Without uv: `pip install duckdb`, download `tools/fetch.py` and run it with `python`. Select with `--source`, `--kind` (`material_set` or `corpus`: one layer), `--domain`, `--form`, `--tag`, `--ext`, or `--selection <file>` (a selection file the data page saves: the ids of its sources and its commit); `--sample N` takes at most N units per source, `--limit N` takes N units over the whole selection, `--unit <unit_id>` takes the unit of that `unit_id` whole (with `--source`); `--kind corpus --leaf <code>` takes the corpus units whose label for that leaf (such as `D2.3`) is at or above its threshold in `meta/labels.json`, read from `labels/<source>/` at the same commit (`--min-score X` sets another bar; `--sample`, `--seed` and `--limit` work over them as over any units); before its first download the run prints the units, files and total size it selected.
7
  - It pins the commit it reads and prints it; pass `--revision <commit>` to get the same files later. A name that does not exist stops with exit code 2 and the closest names.
8
- - The default profile removes duplicate copies, rows that matched a benchmark (copies of benchmark data, rows of groupings awaiting a ruling), rows not compared with the benchmark list yet (counted apart, with their own reason), rows recorded in a language other than English, files above 20 MB, and rows that the release's fetch check read and found refused by their site (HTTP 401 or 403, a login, or an empty or short body). Before downloading it prints how many units each criterion removed; each criterion has its own option (`--keep-duplicates`, `--allow-benchmark`, `--allow-not-compared`, `--any-language`, `--any-size`, `--allow-refused`; `--allow-benchmark` also keeps rows not compared yet), and `--all` turns off every criterion except benchmark and not compared, so rows that matched a benchmark or were not compared yet come in only with their own options. The license and the personal-data mark are labels of every row, not filters: by default every row comes, and two options leave rows out only when given, `--training-only` the files whose license does not allow shipping (license.ship yes and conditional stay) and `--no-personal-data` personal data (catalog pii.level present or suspected, rows marked sensitive). Compared with the benchmark list (keys of 2026-11-12): 2,222 of 2,222 material sets; 215 of 215 corpora. The profile also removes every row whose data file was not compared (`--allow-benchmark` keeps them, unchecked).
9
  - Output: `./data/<domain>/<source>/<unit folder>/...` holds each unit whole, in a folder of its own named after its `unit_id`, its files at their paths within the unit; `./data/<domain>/<source>/` also holds the README.md and LICENSE of a material set; `./data/_meta/manifest.jsonl` has one line per file (source, path, url, sha256, bytes, spdx, licence_url, publisher, retrieved, origin_kind, leaf, unit_id, verified); `./data/_meta/sizes.tsv` one line per source. Every file is checked against the sha256 the index records. A unit stored inside a container (such as a disk image inside a zip) is written as the unit itself: fetch.py takes the member out and checks it against the unit's recorded sha256, so no second tool is needed; only units marked expand (archives meant to be used as folders) are unpacked by `tools/to_pool.py`.
10
  - The index holds material only: what a task checks is decided when the task is built from the material. Keep out of the environment the agent works in whatever the task checks its result against:
11
  - Workbooks (such as the form `spreadsheets`): a published workbook holds the cached results of its formulas, so a workbook put in as fetched hands the agent the values a task may ask it to compute. Strip the cached values first: in .xlsx and .xlsm the `<v>` of every formula cell (`xl/worksheets/*.xml`), the chart caches (`c:numCache` and `c:strCache` in `xl/charts/*.xml`), the pivot caches (`xl/pivotCache/`, definitions and records) and the external link caches (`xl/externalLinks/`); in .ods the value attributes (`office:value` and the like) and the text of formula cells; in .xls the cached result of every FORMULA record and its STRING record.
 
1
  # Training Data Foundation: for agents
2
 
3
+ - The index holds sources of one kind over the same public web, each reading one upstream (one dataset or one data catalog). Every source is of one kind, and a unit is task material for a leaf through its labels, each of one method (agent or classifier); a source whose units an agent chose for a leaf (a material set) is counted in units, and every other source (a corpus, one whole upstream read in bulk) in rows, so units and rows are never added together. A unit is task material for a leaf of the domain grid through its labels (`meta/labels.json` and `labels/<source>/`), each with its method: `agent`, a unit an agent judged one by one usable for the leaf (every unit of a source an agent chose for a leaf, a material set, which `collection` names the collection of, one per task family; and the units of other sources the agents judged), and `classifier`, a classifier's score for the leaf, counted at or above the leaf's threshold. A unit is a group of files that its upstream publishes as one thing, delivered whole; its key `unit_id` is the `unit_group` its rows share (`extra.source_meta.unit_group`), defined once, in the glossary of the data page's manual, https://battam-training-data-foundation.static.hf.space/index.html?lng=en#manual/glossary . A unit is material, not a task: one unit may give several tasks, and one task may use several units. A corpus (plural corpora) is a source that is one whole upstream a collector keeps reading, such as Common Crawl's office documents, PyPI's release files, Mendeley Data or NVD: its rows are pointers to files or API responses, and it is counted in rows; `tools/fetch.py` takes a corpus row by row, each under its own key as its `unit_id`.
4
+ - Pick sources from `meta/catalog.parquet` (one row per source, about 50 KB; do not download `meta/` whole), or units by label with `--leaf`. Columns: `source`; `collection`, the code of a material set's collection (every code with its name is in `meta/vocabulary.json`), or of the collection that lists a corpus as holding its kind of material (`corpora` in `meta/vocabulary.json`; empty for any other corpus); `domain`, a list of codes D1 to D10 or leaves such as D3.5, or `multi`, `unclassified`; `form`, such as `test-suites` or `spreadsheets`; `upstream_kind`, `upstream_agent` and `upstream_entry`, the source's upstream (`dataset` or `catalog`, its agent, and the address its reading starts from; a source that still reads several upstreams gives each, joined by ` | `); `units` (a material set's distinct `unit_id` values: a test case, one workbook, one package; a corpus is counted in rows, and gives the same number as `files`) and `files` (its rows: for a material set, the files of its units and its README.md and LICENSE); `publishers` (a material set's distinct publisher names over all its rows; empty when its rows name none); `language` (the language codes of the rows' labels, what the default profile filters on; `not recorded` when a row has none); `contamination.level` (by the rule of the default profile of `tools/fetch.py` over `meta/bench_overlap.parquet` and `meta/bench_checked.parquet`: `none` when every data file is compared and kept and no row is removed, the hit class with the most removed rows when some are removed, `not scanned` otherwise); `license.ship`; `pii.level`; `distinct_bytes` (deduplicated size) and `bytes` (recorded size, the sum over rows); `size_check` (the rows read in `meta/sizes.parquet`, `compared` those that compared a size or hash, and how many have each status, `match` when the measured size agrees; the check's share is `match` over `compared`), `unsized_rows` (rows without a recorded size) and `unsized_estimate` (their estimated size, with its 95% range); `fetch_check` (whether the upstream still serves the files: `rows`, the sampled rows read in `meta/sizes.parquet`; `fetched`, those that fetched and matched their recorded size and hash; `read_at`, the day read; `level`, `all`, `some`, `none`, `needs auth` (no row read fetched, and the source's rows need the paying or signed-in reader its `needs_auth` names, which the check, reading anonymously, does not have) or `not read`); the same figures for the whole index, each layer and each collection are in `meta/size_figures.json`. Who published each file of a material set, and under which license and license URL, is in `meta/attribution.parquet` (one row per source, publisher, license and license URL, with its number of files). The vocabulary is `meta/vocabulary.json`: every domain code with its name (and `zh`, its Chinese name), what it covers and its parent, every form with its Chinese name and what it means, every category of `meta/not_included.parquet` with its requirement in English and in Chinese, the two layers with their relation, and every collection with its name, what it holds, its campaigns (take a collection with `--tag campaign:<name>` for each of its campaigns) and the corpora it lists, if any (take one with `--source`), and the criteria the default profile of `tools/fetch.py` applies, in its order (`profile`, each with the option that keeps what it removes).
5
+ - Size of this release: Whole index: Recorded size 6.32 PB; deduplicated size 5.84 PB; size check: 99.3% match (35,889 of the 38,608 rows read compared); not compared: address unreachable 145, file gone 167, login needed 526, no size from the server 1,876, other error 5; estimated size of 279,904,705 of the 298,463,449 rows without a recorded size: 514 TB (an estimate; 95% range 252 TB to 1.05 PB, the sum of its sources' ranges, wider than a joint interval; from 4,334 rows read), the other 18,558,744 with too few rows read for an estimate. Task material: Recorded size 36.0 GB; deduplicated size 35.9 GB; size check: 99.2% match (11,918 of the 11,936 rows read compared); not compared: address unreachable 2, file gone 3, login needed 10, other error 3; 9 rows without a recorded size, too few of them read for an estimate. Corpora: Recorded size 6.32 PB; deduplicated size 5.84 PB; size check: 99.4% match (23,971 of the 26,672 rows read compared); not compared: address unreachable 143, file gone 164, login needed 516, no size from the server 1,876, other error 2; estimated size of 279,904,705 of the 298,463,440 rows without a recorded size: 514 TB (an estimate; 95% range 252 TB to 1.05 PB, the sum of its sources' ranges, wider than a joint interval; from 4,334 rows read), the other 18,558,735 with too few rows read for an estimate. Distinct content is the sum of `size_bytes` over the rows minus the sizes of the rows that repeat another row's content (the same sha256, else sha1, else md5 and size, within the same hash scope; one copy of each content is kept, in the first source by registry order), counted after each release over the data files it published, per source in the catalog column `distinct_bytes`; archive members whose archive the same source also lists whole have other hashes, so they are not subtracted. `tools/fetch.py` removes duplicates over your own selection when it reads it. The deduplicated sizes here were counted over the data files of `release-2026-11-21.3`: a release tag, or `<tag>.p<n>`, main as the publish that brought its rows to version n after that tag left it. The recorded size is the sum of `size_bytes` over the rows that have one (catalog column `bytes`). The check reads a sample of rows of every data file (`meta/sizes.parquet`), each day the files with rows of a source not read there yet and those of the sources read longest ago, about a seventh of all the readings, so each is read again within a week: 20 of its rows with a recorded size of each source whose rows it holds, and of its rows without one its share of its source's sample, sized for their mean size within 25% at 95% confidence by the spread of the sizes read so far (at most 400 rows per source per round, 20 for a source with none read yet); its share is the rows that match their recorded size out of the rows it compared (status `match`, `size_mismatch` or `hash_mismatch`), and the rows it could not compare, which never reached their file, are counted beside it by status (`unreachable`, `gone`, `needs_auth`, `no_length`, `error`; catalog column `size_check`). The estimate for a source's rows without a recorded size (catalog columns `unsized_rows` and `unsized_estimate`) is their number times the mean measured size of such rows read, with a 95% BCa bootstrap range (`scipy.stats.bootstrap`, its default resample count); a source with fewer than 10 such rows read has none. Above one source, the estimate is the sum of its sources' estimates and its range the sum of their ranges, which is wider than a joint interval. The figures of every level are in `meta/size_figures.json`.
6
+ - Fetch with one command: `uv run https://huggingface.co/datasets/Battam/training-data-foundation/resolve/main/tools/fetch.py --domain D3 --form spreadsheets --sample 3 --out ./data` takes three units of each of those sources; a corpus's whole can be petabytes, so take one with `--sample N` (the data page takes 3 units of each by default) or `--limit N`. Without uv: `pip install duckdb`, download `tools/fetch.py` and run it with `python`. Select with `--source`, `--leaf <code>` (the units labelled for that leaf), `--domain`, `--form`, `--tag`, `--ext`, or `--selection <file>` (a selection file the data page saves: the ids of its sources and its commit); `--sample N` takes at most N units per source, `--limit N` takes N units over the whole selection, `--unit <unit_id>` takes the unit of that `unit_id` whole (with `--source`); `--leaf <code>` takes the units labelled for that leaf (such as `D2.3`; a top-level code such as `D2` also takes those of every leaf under it), of every source: an `agent` label always counts, a `classifier` label at or above its leaf's threshold in `meta/labels.json`, `--method` keeps the labels of one method or more, and the labels are read from `labels/<source>/` at the same commit (`--min-score X` sets another bar; `--sample`, `--seed` and `--limit` work over them as over any units); before its first download the run prints the units, files and total size it selected.
7
  - It pins the commit it reads and prints it; pass `--revision <commit>` to get the same files later. A name that does not exist stops with exit code 2 and the closest names.
8
+ - The default profile removes duplicate copies, rows that matched a benchmark (copies of benchmark data, rows of groupings awaiting a ruling), rows not compared with the benchmark list yet (counted apart, with their own reason), rows recorded in a language other than English, and files above 20 MB. Before downloading it prints how many units each criterion removed; each criterion has its own option (`--keep-duplicates`, `--allow-benchmark`, `--allow-not-compared`, `--any-language`, `--any-size`; `--allow-benchmark` also keeps rows not compared yet), and `--all` turns off every criterion except benchmark and not compared, so rows that matched a benchmark or were not compared yet come in only with their own options. The license, the personal-data mark and the fetch check's reading are labels of every row, not filters: by default every row comes, and three options leave rows out only when given, `--training-only` the files whose license does not allow shipping (license.ship yes and conditional stay), `--no-personal-data` personal data (catalog pii.level present or suspected, rows marked sensitive), and `--no-refused` the rows that the release's fetch check read and found refused by their site (HTTP 401 or 403, a login, or an empty or short body). Compared with the benchmark list (keys of 2026-11-18): 2,222 of 2,223 material sets; 141 of 289 corpora. The profile also removes every row whose data file was not compared (`--allow-benchmark` keeps them, unchecked).
9
  - Output: `./data/<domain>/<source>/<unit folder>/...` holds each unit whole, in a folder of its own named after its `unit_id`, its files at their paths within the unit; `./data/<domain>/<source>/` also holds the README.md and LICENSE of a material set; `./data/_meta/manifest.jsonl` has one line per file (source, path, url, sha256, bytes, spdx, licence_url, publisher, retrieved, origin_kind, leaf, unit_id, verified); `./data/_meta/sizes.tsv` one line per source. Every file is checked against the sha256 the index records. A unit stored inside a container (such as a disk image inside a zip) is written as the unit itself: fetch.py takes the member out and checks it against the unit's recorded sha256, so no second tool is needed; only units marked expand (archives meant to be used as folders) are unpacked by `tools/to_pool.py`.
10
  - The index holds material only: what a task checks is decided when the task is built from the material. Keep out of the environment the agent works in whatever the task checks its result against:
11
  - Workbooks (such as the form `spreadsheets`): a published workbook holds the cached results of its formulas, so a workbook put in as fetched hands the agent the values a task may ask it to compute. Strip the cached values first: in .xlsx and .xlsm the `<v>` of every formula cell (`xl/worksheets/*.xml`), the chart caches (`c:numCache` and `c:strCache` in `xl/charts/*.xml`), the pivot caches (`xl/pivotCache/`, definitions and records) and the external link caches (`xl/externalLinks/`); in .ods the value attributes (`office:value` and the like) and the text of formula cells; in .xls the cached result of every FORMULA record and its STRING record.
locales/en.json CHANGED
@@ -26,25 +26,6 @@
26
  "field.legendHalf": "kept, in the other layer",
27
  "field.legendOff": "filtered out",
28
  "strata.rest": "In no stage",
29
- "strata.restTitle": "Sources none of whose units a stage counts, and the units or rows the stages leave out: they did not meet the condition, a rule removed them, or the release has not counted them yet. They are in the index like the others and can be taken the same way.",
30
- "strata.restUnits_one": "{{n}} unit in no stage",
31
- "strata.restUnits_other": "{{n}} units in no stage",
32
- "strata.restRows_one": "{{n}} corpus row in no stage",
33
- "strata.restRows_other": "{{n}} corpus rows in no stage",
34
- "strata.whyUnits": "Units: {{list}}",
35
- "strata.whyRows": "Corpus rows: {{list}}",
36
- "strata.why.condition_one": "{{n}} did not meet the condition",
37
- "strata.why.condition_other": "{{n}} did not meet the condition",
38
- "strata.why.benchmark_one": "{{n}} overlaps a benchmark",
39
- "strata.why.benchmark_other": "{{n}} overlap a benchmark",
40
- "strata.why.notCompared_one": "{{n}} not compared with the benchmarks yet",
41
- "strata.why.notCompared_other": "{{n}} not compared with the benchmarks yet",
42
- "strata.why.duplicate_one": "{{n}} duplicate",
43
- "strata.why.duplicate_other": "{{n}} duplicates",
44
- "strata.why.notCounted_one": "{{n}} not counted yet",
45
- "strata.why.notCounted_other": "{{n}} not counted yet",
46
- "strata.why.other_one": "{{n}} {{why}}",
47
- "strata.why.other_other": "{{n}} {{why}}",
48
  "strata.domains_one": "domain",
49
  "strata.domains_other": "domains",
50
  "strata.all": "All {{n}} in the list below",
@@ -62,6 +43,8 @@
62
 
63
  "hero.lede": "Real public data for pre-training, mid-training and post-training: each file with its address, size, hashes and license, fetched with one command.",
64
  "release.all": "All releases",
 
 
65
  "hero.preview": "Preview data",
66
  "link.dataset": "Dataset",
67
  "link.fields": "Index fields",
@@ -119,6 +102,8 @@
119
  "n.pointerRow_other": "{{n}} pointer rows",
120
  "n.rowsCompact_one": "{{n}} row",
121
  "n.rowsCompact_other": "{{n}} rows",
 
 
122
 
123
  "name.notClassified": "Not classified",
124
  "name.noCollection": "No collection",
@@ -210,6 +195,8 @@
210
  "cat.lead.ready_other": "units",
211
  "cat.lead.raw_one": "row in corpora",
212
  "cat.lead.raw_other": "rows in corpora",
 
 
213
  "coll.open": "Open its material sets",
214
  "coll.showing": "Showing its material sets",
215
 
@@ -222,11 +209,22 @@
222
  "th.domain": "Domain",
223
  "th.leaf": "Leaf",
224
  "fewest.title": "Leaves with the fewest units",
225
- "fewest.text": "The leaves of the domain grid whose material sets hold the fewest units, the fewest first: the leaves the data foundation promotes corpus rows into material sets for first.",
 
226
  "leaves.title": "Units by leaf",
227
- "leaves.text": "Every leaf of the domain grid with its units by method: agent, the units of the material sets whose domain holds the leaf, each chosen by an agent, and classifier, the corpus units scored by a classifier at or above the leaf's threshold, then the classifier's units by class. Each row's command takes the leaf's classifier units straight from the corpora (--kind corpus --leaf).",
228
  "leaves.model": "Labels by {{model}}.",
229
- "leaves.noLabels": "This commit carries no labels of corpus units yet.",
 
 
 
 
 
 
 
 
 
 
230
  "th.agent": "Units chosen by an agent",
231
  "th.classifier": "Units scored by a classifier",
232
  "th.threshold": "Threshold",
@@ -243,6 +241,7 @@
243
  "th.state": "State",
244
  "th.address": "Address",
245
  "th.size": "Size",
 
246
 
247
  "filter.title": "Filters",
248
  "filter.noneOn": "none on",
@@ -272,6 +271,15 @@
272
  "filter.ext": "File type",
273
  "filter.extNone": "No file type in this selection",
274
  "filter.optCount": "{{name}} ({{n}})",
 
 
 
 
 
 
 
 
 
275
  "chip.selection": "Selection",
276
  "chip.none": "Whole index",
277
  "chip.remove": "Remove {{k}}: {{v}}",
@@ -293,6 +301,8 @@
293
  "metric.sets": "Material sets",
294
  "metric.units": "Units",
295
  "metric.rows": "Corpus rows",
 
 
296
  "map.units_one": "{{n}} unit",
297
  "map.units_other": "{{n}} units",
298
  "map.rows_one": "{{n}} corpus row",
@@ -300,6 +310,8 @@
300
  "map.nothing": "Nothing matches",
301
  "map.head": "{{amount}}, {{domains}}",
302
  "map.title": "{{metric}}: domain × form",
 
 
303
 
304
  "col.title": "Source",
305
  "col.domain": "Domain",
@@ -362,6 +374,7 @@
362
  "detail.files": "Units and files",
363
  "detail.from": "Comes from",
364
  "detail.upstream": "Upstream",
 
365
  "upstreamKind.dataset": "Dataset",
366
  "upstreamKind.catalog": "Data catalog",
367
  "detail.publishers_one": "{{n}} publisher; main site",
@@ -434,6 +447,23 @@
434
  "stage.noFigures": "No stage figures in this release yet (meta/stage_figures.json): the filter by stage is off.",
435
  "stage.noSources": "This release's stage figures do not list each source's stages yet: the filter by stage is off.",
436
  "stage.notCounted": "This release has no stage fields yet: the filter by stage is off.",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
  "status.flagged": "Flagged, not usable as it is",
438
  "fetch.all": "All {{rows}} sampled rows read fetched and matched their recorded size and hash (read {{date}}).",
439
  "fetch.some": "{{fetched}} of the {{rows}} sampled rows read ({{share}}) fetched and matched their recorded size and hash (read {{date}}); the others did not.",
@@ -446,6 +476,8 @@
446
  "detail.takeWholeNoSize": "The whole material set: {{units}}",
447
  "detail.more": "Batches and first rows",
448
  "detail.notCounted": "not counted",
 
 
449
 
450
  "get.nothing": "Nothing to take",
451
  "get.takeOne_one": "Get at most {{count}} unit",
@@ -465,12 +497,15 @@
465
  "get.change": "Change filters",
466
  "get.take": "Take",
467
  "get.sql": "DuckDB SQL, pinned to the commit",
 
 
468
  "sql.headSets": "Training Data Foundation @ {{sha}}: {{sets}} ({{units}})",
469
  "sql.headCorpora": "Training Data Foundation @ {{sha}}: {{corpora}} ({{rows}})",
470
  "sql.all": "no filter",
471
  "sql.noProfile": "Rows as published: this query applies no rule of the default profile of tools/fetch.py (no deduplication; benchmark copies, rows not compared with the benchmark list, languages other than English and files over 20 MB all stay in); the command applies them. Rows of any license and rows marked as carrying personal data stay in with either.",
472
  "sql.catalogNoProfile": "Every source of the catalog as published: the default profile of tools/fetch.py is not applied here; the command applies it.",
473
  "sql.chip": "{{k}}: {{v}}",
 
474
  "csv.progress_one": "{{done}}/{{n}} file",
475
  "csv.progress_other": "{{done}}/{{n}} files",
476
  "csv.button": "CSV · {{rows}}",
@@ -506,7 +541,7 @@
506
  "tree.domainNote": ": such as D3_data or D3",
507
  "tree.leftOut": "Left out by default",
508
  "tree.flagNote": "Add the flag beside an item to the command to take it.",
509
- "tree.labelNote": "Rows of any license and rows with personal data come by default; to leave them out, add",
510
  "profile.duplicate": "Duplicates",
511
  "profile.benchmark": "Benchmark copies",
512
  "profile.not compared": "Not compared with the benchmark list",
@@ -524,5 +559,7 @@
524
  "manual.back": "Back to the page",
525
  "manual.contents": "Contents",
526
  "manual.loading": "Loading the manual…",
527
- "manual.missing": "The manual is not on this page yet: {{error}}"
 
 
528
  }
 
26
  "field.legendHalf": "kept, in the other layer",
27
  "field.legendOff": "filtered out",
28
  "strata.rest": "In no stage",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  "strata.domains_one": "domain",
30
  "strata.domains_other": "domains",
31
  "strata.all": "All {{n}} in the list below",
 
43
 
44
  "hero.lede": "Real public data for pre-training, mid-training and post-training: each file with its address, size, hashes and license, fetched with one command.",
45
  "release.all": "All releases",
46
+ "release.countedOn": "figures counted on",
47
+ "release.notCounted": "figures not counted yet",
48
  "hero.preview": "Preview data",
49
  "link.dataset": "Dataset",
50
  "link.fields": "Index fields",
 
102
  "n.pointerRow_other": "{{n}} pointer rows",
103
  "n.rowsCompact_one": "{{n}} row",
104
  "n.rowsCompact_other": "{{n}} rows",
105
+ "n.source_one": "{{n}} source",
106
+ "n.source_other": "{{n}} sources",
107
 
108
  "name.notClassified": "Not classified",
109
  "name.noCollection": "No collection",
 
195
  "cat.lead.ready_other": "units",
196
  "cat.lead.raw_one": "row in corpora",
197
  "cat.lead.raw_other": "rows in corpora",
198
+ "cat.lead.rows_one": "row",
199
+ "cat.lead.rows_other": "rows",
200
  "coll.open": "Open its material sets",
201
  "coll.showing": "Showing its material sets",
202
 
 
209
  "th.domain": "Domain",
210
  "th.leaf": "Leaf",
211
  "fewest.title": "Leaves with the fewest units",
212
+ "fewest.text": "The leaves of the domain grid with the fewest units labelled for them by any method, the fewest first.",
213
+ "fewest.textSets": "The leaves of the domain grid whose material sets hold the fewest units, the fewest first.",
214
  "leaves.title": "Units by leaf",
215
+ "leaves.text": "Every leaf of the domain grid with its units labelled by any method and by each method: agent (judged one by one usable for the leaf by an agent) and classifier (scored at or above the leaf's threshold, shown beside it); then its units by class. Each row's command takes the leaf's labelled units from every source (--leaf), by the method chosen above the table (--method).",
216
  "leaves.model": "Labels by {{model}}.",
217
+ "leaves.noLabels": "This commit carries no labels of units yet.",
218
+ "leaves.method": "Method the commands take",
219
+ "leaves.methodAll": "Every method",
220
+ "leaves.textClassifier": "Every leaf of the domain grid with its units by method: agent, the units of the material sets whose domain holds the leaf, each chosen by an agent, and classifier, the corpus units scored by a classifier at or above the leaf's threshold, then the classifier's units by class. Each row's command takes the leaf's classifier units straight from the corpora (--kind corpus --leaf).",
221
+ "kinds.title": "Units by kind of source and by class",
222
+ "kinds.text": "Every source of this commit, whatever its status, by its kind of source (catalog/source_kinds.tsv) and by the class of its form (catalog/stages.yaml): its material sets with their units, and its corpora with their units, a corpus counting its rows. The units of the two layers are never added together.",
223
+ "kinds.none": "This commit's projection gives no counts by kind of source yet.",
224
+ "th.kind": "Kind of source",
225
+ "th.class": "Class",
226
+ "th.sources": "Sources",
227
+ "th.corpusUnits": "Corpus units",
228
  "th.agent": "Units chosen by an agent",
229
  "th.classifier": "Units scored by a classifier",
230
  "th.threshold": "Threshold",
 
241
  "th.state": "State",
242
  "th.address": "Address",
243
  "th.size": "Size",
244
+ "th.sources": "Sources",
245
 
246
  "filter.title": "Filters",
247
  "filter.noneOn": "none on",
 
271
  "filter.ext": "File type",
272
  "filter.extNone": "No file type in this selection",
273
  "filter.optCount": "{{name}} ({{n}})",
274
+ "filter.facets": "By standard",
275
+ "facet.subject": "Subject",
276
+ "facet.industry": "Industry",
277
+ "facet.occupation": "Occupation and work",
278
+ "facet.business_process": "Business process",
279
+ "facet.resource_type": "Resource type",
280
+ "facet.file_format": "File format",
281
+ "facet.multi": "Spans the facet",
282
+ "facet.codePage": "{code} at the standard's source",
283
  "chip.selection": "Selection",
284
  "chip.none": "Whole index",
285
  "chip.remove": "Remove {{k}}: {{v}}",
 
301
  "metric.sets": "Material sets",
302
  "metric.units": "Units",
303
  "metric.rows": "Corpus rows",
304
+ "metric.allRows": "Rows",
305
+ "metric.sources": "Sources",
306
  "map.units_one": "{{n}} unit",
307
  "map.units_other": "{{n}} units",
308
  "map.rows_one": "{{n}} corpus row",
 
310
  "map.nothing": "Nothing matches",
311
  "map.head": "{{amount}}, {{domains}}",
312
  "map.title": "{{metric}}: domain × form",
313
+ "map.allRows_one": "{{n}} row",
314
+ "map.allRows_other": "{{n}} rows",
315
 
316
  "col.title": "Source",
317
  "col.domain": "Domain",
 
374
  "detail.files": "Units and files",
375
  "detail.from": "Comes from",
376
  "detail.upstream": "Upstream",
377
+ "detail.card": "Card",
378
  "upstreamKind.dataset": "Dataset",
379
  "upstreamKind.catalog": "Data catalog",
380
  "detail.publishers_one": "{{n}} publisher; main site",
 
447
  "stage.noFigures": "No stage figures in this release yet (meta/stage_figures.json): the filter by stage is off.",
448
  "stage.noSources": "This release's stage figures do not list each source's stages yet: the filter by stage is off.",
449
  "stage.notCounted": "This release has no stage fields yet: the filter by stage is off.",
450
+ "stage.countedBy": "Counted: {{list}}",
451
+ "stage.beside": "Beside the count, not in it: {{list}}",
452
+ "stage.agentLayers": "({{sets}} of material sets, {{judged}} judged corpus units)",
453
+ "stage.scored": "Classifier units of the {{n}} of {{m}} data files scored so far, by model {{model}}",
454
+ "stage.precision": "classifier precision {{p}} (95% interval {{low}} to {{high}}) at the thresholds of {{leaves}} leaves, on {{above}} held-out judgments",
455
+ "stage.precisionNone": "classifier precision not measured yet: no leaf has a threshold",
456
+ "stage.method.agent": "agent {{n}}",
457
+ "stage.method.classifier": "classifier {{n}}",
458
+ "stage.method.rule": "rules {{n}}",
459
+ "stage.status.notJudged": "not yet judged {{n}}",
460
+ "stage.status.below": "below threshold {{n}}",
461
+ "stage.status.duplicate": "duplicate {{n}}",
462
+ "stage.status.benchmark": "overlapping a benchmark {{n}}",
463
+ "stage.status.unsized": "size not recorded {{n}}",
464
+ "stage.status.archive": "archives of recorded members {{n}}",
465
+ "stage.byMethod_one": "{{method}}: {{n}} unit",
466
+ "stage.byMethod_other": "{{method}}: {{n}} units",
467
  "status.flagged": "Flagged, not usable as it is",
468
  "fetch.all": "All {{rows}} sampled rows read fetched and matched their recorded size and hash (read {{date}}).",
469
  "fetch.some": "{{fetched}} of the {{rows}} sampled rows read ({{share}}) fetched and matched their recorded size and hash (read {{date}}); the others did not.",
 
476
  "detail.takeWholeNoSize": "The whole material set: {{units}}",
477
  "detail.more": "Batches and first rows",
478
  "detail.notCounted": "not counted",
479
+ "detail.labelsFirstMethod": "The labels of its first {{n}} units, each a classifier's score (in bold at or above its leaf's threshold) or the method agent",
480
+ "detail.unitsRows": "Units and rows",
481
 
482
  "get.nothing": "Nothing to take",
483
  "get.takeOne_one": "Get at most {{count}} unit",
 
497
  "get.change": "Change filters",
498
  "get.take": "Take",
499
  "get.sql": "DuckDB SQL, pinned to the commit",
500
+ "get.sourceWord_one": "source",
501
+ "get.sourceWord_other": "sources",
502
  "sql.headSets": "Training Data Foundation @ {{sha}}: {{sets}} ({{units}})",
503
  "sql.headCorpora": "Training Data Foundation @ {{sha}}: {{corpora}} ({{rows}})",
504
  "sql.all": "no filter",
505
  "sql.noProfile": "Rows as published: this query applies no rule of the default profile of tools/fetch.py (no deduplication; benchmark copies, rows not compared with the benchmark list, languages other than English and files over 20 MB all stay in); the command applies them. Rows of any license and rows marked as carrying personal data stay in with either.",
506
  "sql.catalogNoProfile": "Every source of the catalog as published: the default profile of tools/fetch.py is not applied here; the command applies it.",
507
  "sql.chip": "{{k}}: {{v}}",
508
+ "sql.headSources": "Training Data Foundation @ {{sha}}: {{sources}} ({{units}}, {{rows}})",
509
  "csv.progress_one": "{{done}}/{{n}} file",
510
  "csv.progress_other": "{{done}}/{{n}} files",
511
  "csv.button": "CSV · {{rows}}",
 
541
  "tree.domainNote": ": such as D3_data or D3",
542
  "tree.leftOut": "Left out by default",
543
  "tree.flagNote": "Add the flag beside an item to the command to take it.",
544
+ "tree.labelNote": "Rows of any license, rows with personal data and rows the fetch check found refused by their site come by default; to leave them out, add",
545
  "profile.duplicate": "Duplicates",
546
  "profile.benchmark": "Benchmark copies",
547
  "profile.not compared": "Not compared with the benchmark list",
 
559
  "manual.back": "Back to the page",
560
  "manual.contents": "Contents",
561
  "manual.loading": "Loading the manual…",
562
+ "manual.missing": "The manual is not on this page yet: {{error}}",
563
+ "method.agent": "Agent",
564
+ "method.classifier": "Classifier"
565
  }
locales/zh.json CHANGED
@@ -26,17 +26,6 @@
26
  "field.legendHalf": "符合筛选,在另一层",
27
  "field.legendOff": "被筛掉",
28
  "strata.rest": "未归入任何阶段",
29
- "strata.restTitle": "没有任何单元被哪个阶段计入的来源,以及各阶段没有计入的单元或行:它们没有满足条件、被某条规则去掉,或者这次发布还没有计数。它们和别的来源一样在索引里,取法也一样。",
30
- "strata.restUnits_other": "{{n}} 个单元不在任何阶段中",
31
- "strata.restRows_other": "{{n}} 行语料库数据不在任何阶段中",
32
- "strata.whyUnits": "单元:{{list}}",
33
- "strata.whyRows": "语料库行:{{list}}",
34
- "strata.why.condition_other": "未满足条件 {{n}}",
35
- "strata.why.benchmark_other": "与基准测试重叠 {{n}}",
36
- "strata.why.notCompared_other": "尚未与基准测试比对 {{n}}",
37
- "strata.why.duplicate_other": "重复 {{n}}",
38
- "strata.why.notCounted_other": "尚未计数 {{n}}",
39
- "strata.why.other_other": "{{why}} {{n}}",
40
  "strata.domains_other": "个领域",
41
  "strata.all": "全部 {{n}} 个见下方列表",
42
  "strata.table": "下方列表有全部列",
@@ -53,6 +42,8 @@
53
 
54
  "hero.lede": "面向预训练、中训练和后训练的真实公开数据:每个文件都带地址、大小、哈希和许可证,一条命令即可获取。",
55
  "release.all": "全部发布",
 
 
56
  "hero.preview": "预览数据",
57
  "link.dataset": "数据集",
58
  "link.fields": "索引字段",
@@ -100,6 +91,7 @@
100
  "n.publisher_other": "{{n}} 个发布方",
101
  "n.pointerRow_other": "{{n}} 条指针行",
102
  "n.rowsCompact_other": "{{n}} 行",
 
103
 
104
  "name.notClassified": "未分类",
105
  "name.noCollection": "无合集",
@@ -183,6 +175,7 @@
183
  "kindOne.corpus": "语料库",
184
  "cat.lead.ready_other": "个单元",
185
  "cat.lead.raw_other": "行语料库数据",
 
186
  "coll.open": "打开它的材料集",
187
  "coll.showing": "正在显示它的材料集",
188
 
@@ -193,11 +186,22 @@
193
  "th.domain": "领域",
194
  "th.leaf": "叶子",
195
  "fewest.title": "单元最少的叶子",
196
- "fewest.text": "领域网格中材料集单元最少的叶子,最少的在前:数据基座优先为这些叶子把语料库行提升为材料集。",
 
197
  "leaves.title": "每个叶子的单元",
198
- "leaves.text": "领域网格中的每个叶子按方法分的单元:Agent 逐个判过的,即领域含这个叶子的材料集的单元;分类器打分的,即对这个叶子的分数不低于其阈值的语料库单元;再按类别分分类器打分的单元。每一行的命令直接从语料库取这个叶子分类器打分的单元(--kind corpus --leaf)。",
199
  "leaves.model": "标签由 {{model}} 给出。",
200
- "leaves.noLabels": "这个提交还没有语料库单元的标签。",
 
 
 
 
 
 
 
 
 
 
201
  "th.agent": "Agent 逐个判过的单元",
202
  "th.classifier": "分类器打分的单元",
203
  "th.threshold": "阈值",
@@ -214,6 +218,7 @@
214
  "th.state": "状态",
215
  "th.address": "地址",
216
  "th.size": "大小",
 
217
 
218
  "filter.title": "筛选",
219
  "filter.noneOn": "未启用",
@@ -242,6 +247,15 @@
242
  "filter.ext": "文件类型",
243
  "filter.extNone": "当前选择中没有文件类型",
244
  "filter.optCount": "{{name}}({{n}})",
 
 
 
 
 
 
 
 
 
245
  "chip.selection": "当前选择",
246
  "chip.none": "整个索引",
247
  "chip.remove": "移除 {{k}}:{{v}}",
@@ -263,11 +277,14 @@
263
  "metric.sets": "材料集",
264
  "metric.units": "单元",
265
  "metric.rows": "语料库行数",
 
 
266
  "map.units_other": "{{n}} 个单元",
267
  "map.rows_other": "{{n}} 行语料库数据",
268
  "map.nothing": "没有匹配项",
269
  "map.head": "{{amount}},{{domains}}",
270
  "map.title": "{{metric}}:领域 × 形式",
 
271
 
272
  "col.title": "来源",
273
  "col.domain": "领域",
@@ -328,6 +345,7 @@
328
  "detail.files": "单元和文件",
329
  "detail.from": "出自",
330
  "detail.upstream": "上游",
 
331
  "upstreamKind.dataset": "数据集",
332
  "upstreamKind.catalog": "数据目录",
333
  "detail.publishers_other": "{{n}} 个发布方;主要网站",
@@ -388,6 +406,22 @@
388
  "stage.noFigures": "这次发布还没有阶段数字(meta/stage_figures.json):按阶段筛选已关闭。",
389
  "stage.noSources": "这次发布的阶段数字还没有列出每个来源的阶段:按阶段筛选已关闭。",
390
  "stage.notCounted": "这次发布还没有阶段字段:按阶段筛选已关闭。",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  "status.flagged": "已标记,不能直接使用",
392
  "fetch.all": "读过的 {{rows}} 个抽样行全部取到,大小和哈希与记录一致(读取于 {{date}})。",
393
  "fetch.some": "读过的 {{rows}} 个抽样行中有 {{fetched}} 个({{share}})取到,大小和哈希与记录一致(读取于 {{date}});其余没有。",
@@ -400,6 +434,8 @@
400
  "detail.takeWholeNoSize": "整个材料集:{{units}}",
401
  "detail.more": "批次与前几行",
402
  "detail.notCounted": "未统计",
 
 
403
 
404
  "get.nothing": "没有可获取的内容",
405
  "get.takeOne_other": "最多获取 {{count}} 个单元",
@@ -415,12 +451,14 @@
415
  "get.change": "修改筛选",
416
  "get.take": "获取",
417
  "get.sql": "DuckDB SQL,固定到该提交",
 
418
  "sql.headSets": "数据基座 @ {{sha}}:{{sets}}({{units}})",
419
  "sql.headCorpora": "数据基座 @ {{sha}}:{{corpora}}({{rows}})",
420
  "sql.all": "无筛选",
421
  "sql.noProfile": "按发布原样读取各行:这条查询不应用 tools/fetch.py 默认配置的任何规则(不去重;基准副本、没有与基准测试清单比对过的行、非英文和超过 20 MB 的文件都保留);命令会应用这些规则。任何许可证的行和标为带有个人数据的行,两者都保留。",
422
  "sql.catalogNoProfile": "按发布原样列出目录中的每个来源:这里不应用 tools/fetch.py 的默认配置,命令才应用它。",
423
  "sql.chip": "{{k}}:{{v}}",
 
424
  "csv.progress_other": "{{done}}/{{n}} 个文件",
425
  "csv.button": "CSV · {{rows}}",
426
  "csv.tooMany": "超过 {{n}} 条指针行:请使用命令或 SQL",
@@ -452,7 +490,7 @@
452
  "tree.domainNote": ":例如 D3_data 或 D3",
453
  "tree.leftOut": "默认排除",
454
  "tree.flagNote": "把某一项旁边的选项加进命令,就会取回它。",
455
- "tree.labelNote": "任何许可证的行和带个人数据的行默认都会���到;要去掉它们,加上",
456
  "profile.duplicate": "重复内容",
457
  "profile.benchmark": "基准副本",
458
  "profile.not compared": "未与基准测试清单比对",
@@ -470,5 +508,7 @@
470
  "manual.back": "返回页面",
471
  "manual.contents": "目录",
472
  "manual.loading": "正在加载手册…",
473
- "manual.missing": "本页还没有手册:{{error}}"
 
 
474
  }
 
26
  "field.legendHalf": "符合筛选,在另一层",
27
  "field.legendOff": "被筛掉",
28
  "strata.rest": "未归入任何阶段",
 
 
 
 
 
 
 
 
 
 
 
29
  "strata.domains_other": "个领域",
30
  "strata.all": "全部 {{n}} 个见下方列表",
31
  "strata.table": "下方列表有全部列",
 
42
 
43
  "hero.lede": "面向预训练、中训练和后训练的真实公开数据:每个文件都带地址、大小、哈希和许可证,一条命令即可获取。",
44
  "release.all": "全部发布",
45
+ "release.countedOn": "数字统计于",
46
+ "release.notCounted": "数字尚未统计",
47
  "hero.preview": "预览数据",
48
  "link.dataset": "数据集",
49
  "link.fields": "索引字段",
 
91
  "n.publisher_other": "{{n}} 个发布方",
92
  "n.pointerRow_other": "{{n}} 条指针行",
93
  "n.rowsCompact_other": "{{n}} 行",
94
+ "n.source_other": "{{n}} 个来源",
95
 
96
  "name.notClassified": "未分类",
97
  "name.noCollection": "无合集",
 
175
  "kindOne.corpus": "语料库",
176
  "cat.lead.ready_other": "个单元",
177
  "cat.lead.raw_other": "行语料库数据",
178
+ "cat.lead.rows_other": "行",
179
  "coll.open": "打开它的材料集",
180
  "coll.showing": "正在显示它的材料集",
181
 
 
186
  "th.domain": "领域",
187
  "th.leaf": "叶子",
188
  "fewest.title": "单元最少的叶子",
189
+ "fewest.text": "领域网格中以任一方法标注给它的单元最少的叶子,最少的在前。",
190
+ "fewest.textSets": "领域网格中材料集单元最少的叶子,最少的在前。",
191
  "leaves.title": "每个叶子的单元",
192
+ "leaves.text": "领域网格中的每个叶子,以任一方法和按每种方法标注给它的单元:agent(Agent 逐个判定可用于该叶子)和 classifier(分数不低于该叶子的阈值,阈值列在旁边);再按类别分它的单元。每一行的命令从所有来源取这个叶子有标签的单元(--leaf),按表格上方选定的方法(--method)。",
193
  "leaves.model": "标签由 {{model}} 给出。",
194
+ "leaves.noLabels": "这个提交还没有单元的标签。",
195
+ "leaves.method": "命令取用的方法",
196
+ "leaves.methodAll": "所有方法",
197
+ "leaves.textClassifier": "领域网格中的每个叶子按方法分的单元:Agent 逐个判过的,即领域含这个叶子的材料集的单元;分类器打分的,即对这个叶子的分数不低于其阈值的语料库单元;再按类别分分类器打分的单元。每一行的命令直接从语料库取这个叶子分类器打分的单元(--kind corpus --leaf)。",
198
+ "kinds.title": "\u6309\u6765\u6e90\u7c7b\u578b\u548c\u7c7b\u522b\u5206\u7684\u5355\u5143",
199
+ "kinds.text": "\u8fd9\u4e2a\u63d0\u4ea4\u7684\u6bcf\u4e2a\u6765\u6e90\uff0c\u4e0d\u8bba\u72b6\u6001\uff0c\u6309\u6765\u6e90\u7c7b\u578b\uff08catalog/source_kinds.tsv\uff09\u548c\u5176\u5f62\u6001\u7684\u7c7b\u522b\uff08catalog/stages.yaml\uff09\u5206\uff1a\u6750\u6599\u96c6\u53ca\u5176\u5355\u5143\uff0c\u8bed\u6599\u5e93\u53ca\u5176\u5355\u5143\uff08\u8bed\u6599\u5e93\u6309\u884c\u8ba1\uff09\u3002\u4e24\u5c42\u7684\u5355\u5143\u4ece\u4e0d\u76f8\u52a0\u3002",
200
+ "kinds.none": "\u8fd9\u4e2a\u63d0\u4ea4\u7684\u6295\u5f71\u8fd8\u6ca1\u6709\u6309\u6765\u6e90\u7c7b\u578b\u7684\u8ba1\u6570\u3002",
201
+ "th.kind": "\u6765\u6e90\u7c7b\u578b",
202
+ "th.class": "\u7c7b\u522b",
203
+ "th.sources": "\u6765\u6e90",
204
+ "th.corpusUnits": "\u8bed\u6599\u5e93\u5355\u5143",
205
  "th.agent": "Agent 逐个判过的单元",
206
  "th.classifier": "分类器打分的单元",
207
  "th.threshold": "阈值",
 
218
  "th.state": "状态",
219
  "th.address": "地址",
220
  "th.size": "大小",
221
+ "th.sources": "来源",
222
 
223
  "filter.title": "筛选",
224
  "filter.noneOn": "未启用",
 
247
  "filter.ext": "文件类型",
248
  "filter.extNone": "当前选择中没有文件类型",
249
  "filter.optCount": "{{name}}({{n}})",
250
+ "filter.facets": "按标准",
251
+ "facet.subject": "学科",
252
+ "facet.industry": "行业",
253
+ "facet.occupation": "职业与工作",
254
+ "facet.business_process": "业务流程",
255
+ "facet.resource_type": "资源类型",
256
+ "facet.file_format": "文件格式",
257
+ "facet.multi": "跨越整个分面",
258
+ "facet.codePage": "{code} 在标准出处的页面",
259
  "chip.selection": "当前选择",
260
  "chip.none": "整个索引",
261
  "chip.remove": "移除 {{k}}:{{v}}",
 
277
  "metric.sets": "材料集",
278
  "metric.units": "单元",
279
  "metric.rows": "语料库行数",
280
+ "metric.allRows": "行数",
281
+ "metric.sources": "来源",
282
  "map.units_other": "{{n}} 个单元",
283
  "map.rows_other": "{{n}} 行语料库数据",
284
  "map.nothing": "没有匹配项",
285
  "map.head": "{{amount}},{{domains}}",
286
  "map.title": "{{metric}}:领域 × 形式",
287
+ "map.allRows_other": "{{n}} 行",
288
 
289
  "col.title": "来源",
290
  "col.domain": "领域",
 
345
  "detail.files": "单元和文件",
346
  "detail.from": "出自",
347
  "detail.upstream": "上游",
348
+ "detail.card": "卡片",
349
  "upstreamKind.dataset": "数据集",
350
  "upstreamKind.catalog": "数据目录",
351
  "detail.publishers_other": "{{n}} 个发布方;主要网站",
 
406
  "stage.noFigures": "这次发布还没有阶段数字(meta/stage_figures.json):按阶段筛选已关闭。",
407
  "stage.noSources": "这次发布的阶段数字还没有列出每个来源的阶段:按阶段筛选已关闭。",
408
  "stage.notCounted": "这次发布还没有阶段字段:按阶段筛选已关闭。",
409
+ "stage.countedBy": "已计入:{{list}}",
410
+ "stage.beside": "列在计数旁、不计入其中:{{list}}",
411
+ "stage.agentLayers": "(材料集 {{sets}},判过的语料库单元 {{judged}})",
412
+ "stage.scored": "分类器的单元来自目前已打分的 {{n}} / {{m}} 个数据文件,模型 {{model}}",
413
+ "stage.precision": "分类器在 {{leaves}} 个叶子的阈值上的精确率 {{p}}(95% 区间 {{low}} 至 {{high}}),基于 {{above}} 个留出的判定",
414
+ "stage.precisionNone": "分类器精确率尚未测得:还没有叶子有阈值",
415
+ "stage.method.agent": "Agent {{n}}",
416
+ "stage.method.classifier": "分类器 {{n}}",
417
+ "stage.method.rule": "规则 {{n}}",
418
+ "stage.status.notJudged": "尚未判定 {{n}}",
419
+ "stage.status.below": "低于阈值 {{n}}",
420
+ "stage.status.duplicate": "重复 {{n}}",
421
+ "stage.status.benchmark": "与基准测试重叠 {{n}}",
422
+ "stage.status.unsized": "大小未记录 {{n}}",
423
+ "stage.status.archive": "成员已记录的归档 {{n}}",
424
+ "stage.byMethod_other": "{{method}}:{{n}} 个单元",
425
  "status.flagged": "已标记,不能直接使用",
426
  "fetch.all": "读过的 {{rows}} 个抽样行全部取到,大小和哈希与记录一致(读取于 {{date}})。",
427
  "fetch.some": "读过的 {{rows}} 个抽样行中有 {{fetched}} 个({{share}})取到,大小和哈希与记录一致(读取于 {{date}});其余没有。",
 
434
  "detail.takeWholeNoSize": "整个材料集:{{units}}",
435
  "detail.more": "批次与前几行",
436
  "detail.notCounted": "未统计",
437
+ "detail.labelsFirstMethod": "它前 {{n}} 个单元的标签,每个是分类器的分数(不低于该叶子阈值的加粗)或方法 agent",
438
+ "detail.unitsRows": "单元和行",
439
 
440
  "get.nothing": "没有可获取的内容",
441
  "get.takeOne_other": "最多获取 {{count}} 个单元",
 
451
  "get.change": "修改筛选",
452
  "get.take": "获取",
453
  "get.sql": "DuckDB SQL,固定到该提交",
454
+ "get.sourceWord_other": "个来源",
455
  "sql.headSets": "数据基座 @ {{sha}}:{{sets}}({{units}})",
456
  "sql.headCorpora": "数据基座 @ {{sha}}:{{corpora}}({{rows}})",
457
  "sql.all": "无筛选",
458
  "sql.noProfile": "按发布原样读取各行:这条查询不应用 tools/fetch.py 默认配置的任何规则(不去重;基准副本、没有与基准测试清单比对过的行、非英文和超过 20 MB 的文件都保留);命令会应用这些规则。任何许可证的行和标为带有个人数据的行,两者都保留。",
459
  "sql.catalogNoProfile": "按发布原样列出目录中的每个来源:这里不应用 tools/fetch.py 的默认配置,命令才应用它。",
460
  "sql.chip": "{{k}}:{{v}}",
461
+ "sql.headSources": "数据基座 @ {{sha}}:{{sources}}({{units}},{{rows}})",
462
  "csv.progress_other": "{{done}}/{{n}} 个文件",
463
  "csv.button": "CSV · {{rows}}",
464
  "csv.tooMany": "超过 {{n}} 条指针行:请使用命令或 SQL",
 
490
  "tree.domainNote": ":例如 D3_data 或 D3",
491
  "tree.leftOut": "默认排除",
492
  "tree.flagNote": "把某一项旁边的选项加进命令,就会取回它。",
493
+ "tree.labelNote": "任何许可证的行、带个人数据的行和取回核对发现被所在网站拒绝的行默认都会取到;要去掉它们,加上",
494
  "profile.duplicate": "重复内容",
495
  "profile.benchmark": "基准副本",
496
  "profile.not compared": "未与基准测试清单比对",
 
508
  "manual.back": "返回页面",
509
  "manual.contents": "目录",
510
  "manual.loading": "正在加载手册…",
511
+ "manual.missing": "本页还没有手册:{{error}}",
512
+ "method.agent": "Agent 逐个判过的",
513
+ "method.classifier": "分类器打分的"
514
  }
portal.json CHANGED
@@ -1,8 +1,8 @@
1
  {
2
- "commit": "16188452d45d15924c3bd10a9cb6d200b0680878",
3
- "digest": "047183764a18c5b568a448b8fc8152a75df3b0599e0c975ee8755d81b87703f5",
4
  "files": 29,
5
  "format": "portal-deploy/1",
6
  "funnel": "93c9d8ae26cfb409122f4cd4222359d30c31566c",
7
- "index": "e26658c3df0ca7a6871d71cf0e815cb903b254fc"
8
  }
 
1
  {
2
+ "commit": "5b2c299894d9335564272afeccc2e23d697c0ef5",
3
+ "digest": "92cf7d2e1df52c87f209e31b8f497d006a119083ed0d96d8a2483e843732df60",
4
  "files": 29,
5
  "format": "portal-deploy/1",
6
  "funnel": "93c9d8ae26cfb409122f4cd4222359d30c31566c",
7
+ "index": "4fc6aaf347b76fb50f02464749b908a5e943f58e"
8
  }
style.css CHANGED
@@ -351,10 +351,12 @@ button.stratum:hover .core, .stratum[aria-pressed="true"] .core { transform: sca
351
  .stratum .amount { text-align: right; white-space: nowrap; }
352
  .stratum .big { font-size: clamp(30px, 0.55vw + 22px, 36px); }
353
  .stratum .unit { font-size: var(--fs-1); color: var(--ink-muted); margin-left: 4px; }
354
- /* #2629: a line under the name and the figure: a stage's funnel (what meets its condition, then what each rule
355
- removes), or under the last band what no stage counts by reason; the core runs beside it */
356
  .stratum.has-steps .core { grid-row: span 2; }
357
  .stratum .steps { grid-column: 2 / -1; color: var(--ink-muted); font-size: var(--fs-1); line-height: 1.35; }
 
 
358
  .stratum[aria-pressed="true"] { background: var(--wash); box-shadow: inset 0 0 0 1px var(--panel-line); }
359
  /* while one stage is picked the others step back */
360
  .column.picked .stratum:not([aria-pressed="true"]) { opacity: 0.45; }
 
351
  .stratum .amount { text-align: right; white-space: nowrap; }
352
  .stratum .big { font-size: clamp(30px, 0.55vw + 22px, 36px); }
353
  .stratum .unit { font-size: var(--fs-1); color: var(--ink-muted); margin-left: 4px; }
354
+ /* a band's lines under its name and its figure: its counted units by method, then its units of every other status (or,
355
+ for figures without statuses, its funnel); the core runs beside them */
356
  .stratum.has-steps .core { grid-row: span 2; }
357
  .stratum .steps { grid-column: 2 / -1; color: var(--ink-muted); font-size: var(--fs-1); line-height: 1.35; }
358
+ .stratum .steps > span { display: block; }
359
+ .stratum .steps > .by { color: var(--ink-2); }
360
  .stratum[aria-pressed="true"] { background: var(--wash); box-shadow: inset 0 0 0 1px var(--panel-line); }
361
  /* while one stage is picked the others step back */
362
  .column.picked .stratum:not([aria-pressed="true"]) { opacity: 0.45; }