tamnd commited on
Commit
f7fdfb1
·
verified ·
1 Parent(s): 4ed384f

Index the parts and say so on the card

Browse files
Files changed (1) hide show
  1. README.md +156 -10
README.md CHANGED
@@ -5,6 +5,8 @@ language:
5
  license: other
6
  license_name: per-document-restricted
7
  license_link: https://github.com/tamnd/gao/blob/main/law/posture.go
 
 
8
  multilinguality:
9
  - monolingual
10
  language_creators:
@@ -20,11 +22,20 @@ tags:
20
  - web
21
  - corpus
22
  - metadata-only
 
 
 
 
 
 
 
 
 
23
  ---
24
 
25
  # ViTweb
26
 
27
- > Vietnamese text under one schema, nothing sealed here yet
28
 
29
  This dataset is one row per page gao's own crawler fetched and kept: the address, the host, the fetch time, the robots decision that allowed it, and every measurement the page was judged on, with the text withheld because a crawled page carries no grant to pass it on.
30
 
@@ -32,8 +43,10 @@ This dataset is one row per page gao's own crawler fetched and kept: the address
32
 
33
  - [What is it](#what-is-it)
34
  - [What is in it](#what-is-in-it)
 
35
  - [How it is laid out](#how-it-is-laid-out)
36
  - [Reading it](#reading-it)
 
37
  - [The columns](#the-columns)
38
  - [What this repo is](#what-this-repo-is)
39
  - [What ships and what does not](#what-ships-and-what-does-not)
@@ -54,18 +67,42 @@ Every page that was not kept is in `open-index/vitweb-rejects` with the stage an
54
 
55
  ## What is in it
56
 
57
- Nothing yet. The repo was created ahead of the first ingest, and this section fills in from the parts index once there are parts to index.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  ## How it is laid out
60
 
61
  ```
62
  README.md
63
  parts.csv
 
 
 
64
  ```
65
 
66
  One directory per source, and the file name is the snapshot, the input file of the source the part came out of, and the part. The snapshot is the source and the revision it was pinned at, so re-pinning a source puts its new parts beside the old ones in the same directory under a different name rather than moving the directory. That is deliberate: the directory is the config name somebody writes in a `load_dataset` call, and a name that moves every time a source is re-pinned is a name nobody can write down.
67
 
68
- The directories are named plainly rather than Hive style. A Hive path spells the directory `snapshot=gao-v1.0`, and then every reader who globs the repo gets a `snapshot` column in their result set that is in no file, sitting next to a `source` column that is, so the first thing the layout teaches them is a distinction they did not ask for.
69
 
70
  ## Reading it
71
 
@@ -80,19 +117,46 @@ INSTALL httpfs;
80
  LOAD httpfs;
81
  ```
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  **Count one source.** A count reads the row counts out of each file's footer rather than the file, so this is a few hundred kilobytes whatever the source weighs.
84
 
85
  ```sql
86
  SELECT count(*) AS documents
87
- FROM read_parquet('hf://datasets/open-index/vitweb/data/SOURCE/*.parquet');
88
  ```
89
 
90
- **Group by a column.** Parquet is columnar, so a query over two columns reads two columns. This one touches only the columns it names.
 
 
 
 
 
 
 
 
 
91
 
92
  ```sql
93
  SELECT license_class, count(*) AS documents,
94
  round(avg(n_syllables)) AS mean_syllables
95
- FROM read_parquet('hf://datasets/open-index/vitweb/data/SOURCE/*.parquet')
96
  GROUP BY license_class ORDER BY documents DESC;
97
  ```
98
 
@@ -100,7 +164,7 @@ GROUP BY license_class ORDER BY documents DESC;
100
 
101
  ```sql
102
  SELECT url, lang, n_syllables, substr(text, 1, 60) AS opening
103
- FROM read_parquet('hf://datasets/open-index/vitweb/data/*/*.parquet')
104
  WHERE lang = 'vie' AND n_syllables BETWEEN 200 AND 400
105
  LIMIT 5;
106
  ```
@@ -110,7 +174,7 @@ The `lang` column is ISO 639-3, so the value to filter on is `vie` rather than t
110
  **Every column and its type.**
111
 
112
  ```sql
113
- DESCRIBE SELECT * FROM read_parquet('hf://datasets/open-index/vitweb/data/*/*.parquet');
114
  ```
115
 
116
  ### Python
@@ -120,10 +184,91 @@ The configs in this card's front matter are what `datasets` reads, so a source i
120
  ```python
121
  from datasets import load_dataset
122
 
123
- ds = load_dataset("open-index/vitweb", split="train", streaming=True)
 
124
  print(next(iter(ds))["url"])
125
  ```
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  ## The columns
128
 
129
  42 columns, in file order. Every part in this repo has all of them, and a column a stage has not run yet is null rather than absent, so a query written against one source works against the next.
@@ -207,7 +352,7 @@ Every row carries its own class in the `license_class` column, so a reader who n
207
 
208
  **The measurements are gao's own and they are not a quality judgment.** `lang_score` is the share of tokens that are Vietnamese syllables, `heuristics` is the full map the sift produced, and `gao_qual` and `gao_edu` are zero because the classifier behind them is trained against a reference set that does not exist yet. A page is here because it is Vietnamese prose of some length, not because it is good.
209
 
210
- **The extractor keeps some of what a template puts around an article.** On the first run a third of the repetition rejections were article pages rather than listings, which is what a related-articles rail at the bottom of a CMS template looks like to an eight syllable gram counter. Those pages are in the rejects repo with their measured rate, so the size of the problem is a query rather than a guess, and it is being worked on in the extractor rather than by moving the threshold.
211
 
212
  **It is a crawl in progress and the parts are the order it happened in.** Nothing is shuffled and nothing is deduplicated across runs. Consecutive rows are frequently from one host, because a crawl of a host is a run of requests to that host, so the first N rows are a sample of one site rather than of the corpus.
213
 
@@ -230,6 +375,7 @@ The releases carry the signed manifest, the dedup, and the quality filtering. Th
230
 
231
  If you use this, cite the corpora it is made of. They did the collecting. This repo did the reading.
232
 
 
233
  For the assembly itself:
234
 
235
  ```bibtex
 
5
  license: other
6
  license_name: per-document-restricted
7
  license_link: https://github.com/tamnd/gao/blob/main/law/posture.go
8
+ size_categories:
9
+ - 1K<n<10K
10
  multilinguality:
11
  - monolingual
12
  language_creators:
 
22
  - web
23
  - corpus
24
  - metadata-only
25
+ configs:
26
+ - config_name: default
27
+ data_files:
28
+ - split: train
29
+ path: data/*/*.parquet
30
+ - config_name: web
31
+ data_files:
32
+ - split: train
33
+ path: data/web/*.parquet
34
  ---
35
 
36
  # ViTweb
37
 
38
+ > 3,260 Vietnamese documents, metadata only from one public corpus, 970.5 kB of Parquet, one schema
39
 
40
  This dataset is one row per page gao's own crawler fetched and kept: the address, the host, the fetch time, the robots decision that allowed it, and every measurement the page was judged on, with the text withheld because a crawled page carries no grant to pass it on.
41
 
 
43
 
44
  - [What is it](#what-is-it)
45
  - [What is in it](#what-is-in-it)
46
+ - [Where the text came from](#where-the-text-came-from)
47
  - [How it is laid out](#how-it-is-laid-out)
48
  - [Reading it](#reading-it)
49
+ - [What you can build with it](#what-you-can-build-with-it)
50
  - [The columns](#the-columns)
51
  - [What this repo is](#what-this-repo-is)
52
  - [What ships and what does not](#what-ships-and-what-does-not)
 
67
 
68
  ## What is in it
69
 
70
+ | source | documents | parts | input files | size | pinned at |
71
+ | --- | ---: | ---: | ---: | ---: | --- |
72
+ | `web` | 3,260 | 16 | 3 | 970.5 kB | `web-20260819` |
73
+ | **total** | **3,260** | **16** | | **970.5 kB** | |
74
+
75
+ Every count here is the row count in a part's own Parquet footer, added up. None of it is what a run reported writing, because a run that died between pushing a part and writing down that it had is exactly the case a count has to be right about.
76
+
77
+ The per part version of this table is `parts.csv` at the root of the repo, which is one row per file with its source, its snapshot, the input file it came from, its document count and its size. It is a CSV so that it can be read without a Parquet reader, and it is small enough to open in anything.
78
+
79
+ The repo grows while ingests run, so these numbers are the ones from the last time `gao store index` was run against it rather than a sealed total. The counts in `parts.csv` and the counts here always agree, because they are generated together.
80
+
81
+ ## Where the text came from
82
+
83
+ Four public corpora, pinned at a revision, read once, and written out under the schema below. Nothing here was crawled by us. Every one of them has its own card, its own paper in most cases, and its own terms, and the links are the place to read them.
84
+
85
+ ### `web`
86
+
87
+ 3,260 documents.
88
+
89
+ Two more are pinned in the ingest manifest and are not here. CulturaX is gated on the Hub and the terms were never granted to anybody on this project, so not one byte of it has been read and it is dropped rather than pending. It is mC4 and OSCAR, both built out of Common Crawl, so it went over the same pages the sources above went over, though that is worth less than it sounds: identity here is a hash of the extracted text, and two Common Crawl derivatives in this repo share under one percent of the smaller of them, because two extractors rarely agree on every byte of a page. MADLAD-400 ships as gzipped JSONL rather than Parquet, so it costs a rewrite that the Parquet sources do not, and it is queued behind them.
90
+
91
+ The manifest with every pinned revision, every input file and its byte count is at https://github.com/tamnd/gao/blob/main/harvest/manifest.json.
92
 
93
  ## How it is laid out
94
 
95
  ```
96
  README.md
97
  parts.csv
98
+ data/web/
99
+ web-20260819-00000-00000.parquet
100
+ ... and 15 more
101
  ```
102
 
103
  One directory per source, and the file name is the snapshot, the input file of the source the part came out of, and the part. The snapshot is the source and the revision it was pinned at, so re-pinning a source puts its new parts beside the old ones in the same directory under a different name rather than moving the directory. That is deliberate: the directory is the config name somebody writes in a `load_dataset` call, and a name that moves every time a source is re-pinned is a name nobody can write down.
104
 
105
+ The directories are named plainly rather than Hive style. A Hive path spells the directory `snapshot=web-20260819`, and then every reader who globs the repo gets a `snapshot` column in their result set that is in no file, sitting next to a `source` column that is, so the first thing the layout teaches them is a distinction they did not ask for.
106
 
107
  ## Reading it
108
 
 
117
  LOAD httpfs;
118
  ```
119
 
120
+ **What is in the repo, without opening a single Parquet file.** `parts.csv` is a CSV of one row per part, so this is a few tens of kilobytes of reading.
121
+
122
+ ```sql
123
+ SELECT source, count(*) AS parts, sum(documents) AS documents,
124
+ round(sum(bytes) / 1e9, 1) AS gb
125
+ FROM 'hf://datasets/open-index/vitweb/parts.csv'
126
+ GROUP BY source ORDER BY documents DESC;
127
+ ```
128
+
129
+ ```
130
+ ┌─────────┬───────┬───────────┬────────┐
131
+ │ source │ parts │ documents │ gb │
132
+ │ varchar │ int64 │ int128 │ double │
133
+ ├─────────┼───────┼───────────┼────────┤
134
+ │ web │ 16 │ 3260 │ 0.0 │
135
+ └─────────┴───────┴───────────┴────────┘
136
+ ```
137
+
138
  **Count one source.** A count reads the row counts out of each file's footer rather than the file, so this is a few hundred kilobytes whatever the source weighs.
139
 
140
  ```sql
141
  SELECT count(*) AS documents
142
+ FROM read_parquet('hf://datasets/open-index/vitweb/data/web/*.parquet');
143
  ```
144
 
145
+ ```
146
+ ┌───────────┐
147
+ │ documents │
148
+ │ int64 │
149
+ ├───────────┤
150
+ │ 3260 │
151
+ └───────────┘
152
+ ```
153
+
154
+ **Group by a column.** Parquet is columnar, so a query over two columns reads two columns. This one touches 3,260 documents across 16 files.
155
 
156
  ```sql
157
  SELECT license_class, count(*) AS documents,
158
  round(avg(n_syllables)) AS mean_syllables
159
+ FROM read_parquet('hf://datasets/open-index/vitweb/data/web/*.parquet')
160
  GROUP BY license_class ORDER BY documents DESC;
161
  ```
162
 
 
164
 
165
  ```sql
166
  SELECT url, lang, n_syllables, substr(text, 1, 60) AS opening
167
+ FROM read_parquet('hf://datasets/open-index/vitweb/data/web/web-20260819-00001-00004.parquet')
168
  WHERE lang = 'vie' AND n_syllables BETWEEN 200 AND 400
169
  LIMIT 5;
170
  ```
 
174
  **Every column and its type.**
175
 
176
  ```sql
177
+ DESCRIBE SELECT * FROM read_parquet('hf://datasets/open-index/vitweb/data/web/web-20260819-00001-00004.parquet');
178
  ```
179
 
180
  ### Python
 
184
  ```python
185
  from datasets import load_dataset
186
 
187
+ # One source, streamed rather than downloaded.
188
+ ds = load_dataset("open-index/vitweb", "web", split="train", streaming=True)
189
  print(next(iter(ds))["url"])
190
  ```
191
 
192
+ Streaming is the right default here. The whole repo does not fit on most disks and one source of it does not fit on many, so a run that reads once should read over the network rather than land the corpus first.
193
+
194
+ When it does need to be on disk, take a source or a single part rather than the repo.
195
+
196
+ ```python
197
+ from huggingface_hub import snapshot_download
198
+
199
+ # One source on disk, which for the smallest of these is 970.5 kB.
200
+ snapshot_download(
201
+ "open-index/vitweb",
202
+ repo_type="dataset",
203
+ allow_patterns="data/web/*",
204
+ )
205
+ ```
206
+
207
+ ```python
208
+ import pyarrow.parquet as pq
209
+ from huggingface_hub import hf_hub_download
210
+
211
+ # One part, for looking rather than training. Read the columns you want:
212
+ # text is most of the bytes and a row group of it is a couple of hundred MB.
213
+ path = hf_hub_download("open-index/vitweb", "data/web/web-20260819-00001-00004.parquet", repo_type="dataset")
214
+ table = pq.read_table(path, columns=["url", "host", "lang", "n_syllables"])
215
+ print(table.num_rows, table.schema.names)
216
+ ```
217
+
218
+ ## What you can build with it
219
+
220
+ The repo is addresses and measurements, so what it is good for is deciding which pages are worth fetching, and measuring a crawl while it runs. Both are column scans.
221
+
222
+ ### A fetch list somebody else can act on
223
+
224
+ The rows are pages that were fetched once and passed every gate, so the URLs are a list of Vietnamese prose pages that are known to exist, known to be allowed by robots.txt, and known to be long enough to be worth a request.
225
+
226
+ ```sql
227
+ SELECT url, host, n_syllables, lang_score
228
+ FROM read_parquet('hf://datasets/open-index/vitweb/data/*/*.parquet')
229
+ WHERE n_syllables >= 400 AND lang_score >= 0.9 AND diacritics = 'present'
230
+ ORDER BY n_syllables DESC;
231
+ ```
232
+
233
+ Fetching them yourself is what makes the text yours to use. `fetched_at` says how old our reading of each page is, and `robots_decision` says which rule allowed it at that time rather than now.
234
+
235
+ ### Which Vietnamese sites are worth crawling
236
+
237
+ A host's yield is the thing every crawler wants and nobody publishes: how many pages of real prose come back per site, and how long they are.
238
+
239
+ ```sql
240
+ SELECT host, count(*) AS pages, round(avg(n_syllables)) AS syllables
241
+ FROM read_parquet('hf://datasets/open-index/vitweb/data/*/*.parquet')
242
+ GROUP BY host ORDER BY pages DESC LIMIT 5;
243
+ ```
244
+
245
+ ```
246
+ ┌──────────────────┬───────┬───────────┐
247
+ │ host │ pages │ syllables │
248
+ │ varchar │ int64 │ double │
249
+ ├──────────────────┼───────┼───────────┤
250
+ │ baoquangninh.vn │ 82 │ 1153.0 │
251
+ │ baolamdong.vn │ 21 │ 1364.0 │
252
+ │ tuoitre.vn │ 7 │ 1147.0 │
253
+ │ vtv.vn │ 6 │ 660.0 │
254
+ │ radio.nhandan.vn │ 5 │ 206.0 │
255
+ └──────────────────┴───────┴───────────┘
256
+ ```
257
+
258
+ Two provincial papers ahead of the national ones, on a seed list that had both. That is the gap this crawl exists to fill, and it shows up in the first four hundred pages.
259
+
260
+ ### Measuring a crawl rather than describing one
261
+
262
+ Joining this repo to `open-index/vitweb-rejects` on `url` gives the whole outcome of every request, which is what a yield curve is made of.
263
+
264
+ ```sql
265
+ SELECT date_trunc('day', fetched_at) AS day, count(*) AS kept
266
+ FROM read_parquet('hf://datasets/open-index/vitweb/data/*/*.parquet')
267
+ GROUP BY day ORDER BY day;
268
+ ```
269
+
270
+ `url_template` is the URL with its variable parts replaced, which is what the crawl budgets against. Grouping by it rather than by host is how a calendar trap or a faceted catalog shows up as one template with thousands of rows.
271
+
272
  ## The columns
273
 
274
  42 columns, in file order. Every part in this repo has all of them, and a column a stage has not run yet is null rather than absent, so a query written against one source works against the next.
 
352
 
353
  **The measurements are gao's own and they are not a quality judgment.** `lang_score` is the share of tokens that are Vietnamese syllables, `heuristics` is the full map the sift produced, and `gao_qual` and `gao_edu` are zero because the classifier behind them is trained against a reference set that does not exist yet. A page is here because it is Vietnamese prose of some length, not because it is good.
354
 
355
+ **The repetition filter removes party and government prose, and that is a known fault rather than a finding about the writing.** On the first run a third of the repetition rejections were article pages rather than listing pages. Two of them were pulled out and read: the extraction was clean, with no navigation and no related stories in it, and what pushed them over the threshold was the register. An official is named in full every time they are mentioned, so `đồng chí Vũ Quyết Tiến, Phó Bí thư Tỉnh ủy, Chủ tịch Ủy ban MTTQ tỉnh` is three occurrences of the same eight syllable gram in a nine hundred word article, and the body doing the meeting is named in full in every paragraph about it. The threshold those pages fail is Gopher's, scaled from words to syllables, and a Vietnamese title is long in syllables and carries one fact. Every page it removed is in `open-index/vitweb-rejects` with its measured rate, so the threshold can be moved and the corpus recomposed without fetching anything again.
356
 
357
  **It is a crawl in progress and the parts are the order it happened in.** Nothing is shuffled and nothing is deduplicated across runs. Consecutive rows are frequently from one host, because a crawl of a host is a run of requests to that host, so the first N rows are a sample of one site rather than of the corpus.
358
 
 
375
 
376
  If you use this, cite the corpora it is made of. They did the collecting. This repo did the reading.
377
 
378
+
379
  For the assembly itself:
380
 
381
  ```bibtex