File size: 28,962 Bytes
d4a220a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
06d78dc
f764f9a
 
 
 
 
 
 
 
d4a220a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
da4ec9b
d4a220a
da4ec9b
f6e6560
da4ec9b
d4a220a
da4ec9b
d4a220a
da4ec9b
 
e015904
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d4a220a
 
 
 
 
 
 
 
 
 
 
 
da4ec9b
 
d4a220a
d8bc5bc
d4a220a
d662246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d4a220a
 
 
e015904
d662246
da4ec9b
e015904
 
 
 
d662246
 
 
 
 
d8bc5bc
 
 
 
 
da4ec9b
 
 
 
 
 
 
 
 
 
 
 
d8bc5bc
 
 
 
 
 
 
 
 
 
 
 
 
da4ec9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d4a220a
 
 
 
 
 
 
 
 
da4ec9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d4a220a
 
 
 
 
 
 
 
d8bc5bc
 
da4ec9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d4a220a
 
 
 
 
 
 
 
 
 
 
 
 
 
da4ec9b
e015904
d4a220a
 
 
 
 
 
 
 
 
 
 
 
 
f6e6560
d662246
 
d8bc5bc
f6e6560
d4a220a
 
 
 
 
 
 
 
 
f6e6560
d4a220a
 
011f8d5
 
d4a220a
 
e015904
d4a220a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d662246
d4a220a
117bab9
 
 
 
d4a220a
 
 
 
 
51ba066
 
 
 
 
 
f6e6560
da4ec9b
f6e6560
51ba066
f6e6560
51ba066
 
f6e6560
 
 
51ba066
 
 
 
 
f6e6560
51ba066
 
 
 
 
 
 
 
f6e6560
 
 
 
 
51ba066
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f6e6560
51ba066
 
d4a220a
 
b38a959
d4a220a
 
 
 
 
 
 
 
 
d8bc5bc
 
 
 
 
 
 
 
d4a220a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e015904
 
 
 
 
 
 
 
 
 
f6e6560
 
 
 
e015904
 
da4ec9b
e015904
da4ec9b
d4a220a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1cd52d2
 
d4a220a
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
---
language:
- vi
license: cc-by-4.0
pretty_name: "Vietnamese National Legal Database (vbpl.vn)"
size_categories:
- 100K<n<1M
task_categories:
- text-classification
- text-retrieval
- question-answering
- text-generation
- summarization
tags:
- legal
- vietnamese
- vietnam
- law
- statute
- regulation
- legislation
- moj
- ministry-of-justice
source_datasets:
- original
configs:
- config_name: documents
  default: true
  data_files:
  - split: train
    path: documents-*.parquet
- config_name: embed
  data_files:
  - split: train
    path: embed-*.parquet
- config_name: reduce
  data_files:
  - split: train
    path: reduce-*.parquet
---

# Vietnamese National Legal Database — `vbpl.vn`

> 🇻🇳 **Tóm tắt.** Bộ dữ liệu mức **văn bản** của
> **Cơ sở dữ liệu Quốc gia về pháp luật** thu thập từ cổng
> [`vbpl.vn`](https://vbpl.vn/) do Bộ Tư pháp vận hành. Bao gồm
> luật, pháp lệnh, nghị định, thông tư, quyết định, nghị quyết,
> chỉ thị… ở cả cấp **trung ương** (Quốc hội, Chính phủ, các bộ)
> lẫn **địa phương** (HĐND/UBND 63 tỉnh, thành). Mỗi dòng là một
> văn bản pháp luật kèm markdown đã chuẩn hoá tiếng Việt
> (NFC + chính tả hiện đại sau 1984) và lớp cấu trúc phân cấp đầy
> đủ: **document → section → paragraph → sentence**.
>
> 🇬🇧 **Summary.** Document-level corpus of Vietnam's
> **National Legal Database** harvested from
> [`vbpl.vn`](https://vbpl.vn/) (operated by the Ministry of Justice).
> Covers laws, ordinances, decrees, circulars, decisions,
> resolutions, directives, etc. across both **central** (National
> Assembly, Government, ministries) and **provincial** (People's
> Council / People's Committee of the 63 provinces and cities)
> levels of authority. Each row is one legal document with its
> Vietnamese-normalised markdown body (NFC + modern post-1984
> orthography) and a hierarchical structure layer:
> **document → section → paragraph → sentence**, every unit
> carrying a stable id + char span back into the markdown.

## Tổng quan · At a glance

| Chỉ số · Metric | Giá trị · Value |
|---|---:|
| Văn bản công bố · Documents | **158,822** |
| Tổng số bản ghi đầu vào · Raw extract rows | 158,822 |
| Loại bỏ vì rỗng · Dropped (empty body) | 0 |
| Không có thân bài · `markdown` is null (source has no body) | 11,505 |
| Có cấu trúc · With structure layer | 158,822 |
| Có tệp đính kèm · With downloaded attachment | 0 |
| Trung vị ký tự · Median chars / doc | 5,111 |
| Trung vị trang · Median pages / doc | – |
| Trung vị đoạn văn · Median paragraphs / doc | 1 |
| Trung vị câu · Median sentences / doc | 17 |

## Tổng quan trực quan · Visual overview

Sáu hình tóm tắt cấu trúc của corpus. Tất cả hình được tạo bằng `plotly` + `kaleido` (Chromium headless) và lưu thành PNG tĩnh để hiển thị trong dataset card. — Six pictures summarising the corpus structure. All figures are rendered with `plotly` + `kaleido` (headless Chromium) and saved as static PNG for the dataset card.

### Phân bố theo lĩnh vực pháp luật

![Phân bố theo lĩnh vực pháp luật](./overview-legalarea-treemap.png)

Top 25 legal areas sized by document count. The pale `Chưa phân loại` ('uncategorised') rectangle covers ~72% on its own -- vbpl.vn editors haven't tagged most legacy docs.

### Phạm vi → loại văn bản

![Phạm vi → loại văn bản](./overview-scope-doctype-sunburst.png)

Two-level radial split: `scope` (inner) → `doc_type` (outer, top 12 per scope). Reveals where the corpus weight sits -- `dia_phuong` (~66%) is mostly `QĐ` (decisions) and `NQ` (resolutions), while `trung_uong` mixes `QĐ` / `NĐ` (decrees) / `TT` (circulars).

### Top 20 loại văn bản

![Top 20 loại văn bản](./overview-doctype-bars.png)

Document types ranked by count, with the canonical short code, full Vietnamese name, and an English gloss.

### Số văn bản theo năm và phạm vi

![Số văn bản theo năm và phạm vi](./overview-year-stack.png)

Stacked area of documents issued per year, split by `scope`. The legacy CMS migration concentrates early years; modern post-2010 output is dominated by `dia_phuong`.

### Loại văn bản qua các năm

![Loại văn bản qua các năm](./overview-doctype-year-heatmap.png)

Top-12 `doc_type` × year heatmap (log₁₀ scale). Shows the shift from `CT` directives in the early 90s to `QĐ` decisions as the workhorse instrument from 2000 onwards.

### Top 15 cơ quan ban hành

![Top 15 cơ quan ban hành](./overview-agency-bars.png)

Top issuing agencies. Quốc hội + Chính phủ + the larger ministries dominate `trung_uong`; provincial People's Councils / Committees split the `dia_phuong` half.

## Phạm vi · Scope split

Bộ dữ liệu chia làm hai nhánh: ``trung_uong`` (văn bản pháp luật do
Quốc hội + Chính phủ + các bộ ngành Trung ương ban hành) và
``dia_phuong`` (HĐND/UBND của 63 tỉnh, thành). — The corpus splits
into ``trung_uong`` (central authorities: National Assembly,
Government, ministries) and ``dia_phuong`` (the 63 provinces and
cities, mostly People's Council / People's Committee output).

| Value | Count | Share |
|---|---:|---:|
| `dia_phuong` | 104,345 | 65.7% |
| `trung_uong` | 54,477 | 34.3% |

## Loại văn bản · `doc_type` + `legal_type`

Mỗi văn bản được gắn **slug tiếng Việt không dấu** (`doc_type`,
ví dụ `quyet_dinh`, `nghi_dinh`, `thong_tu_lien_tich`) lẫn tên đầy
đủ tiếng Việt (`legal_type`, ví dụ `Quyết định`, `Nghị định`,
`Thông tư liên tịch`). Slug được sinh tự động từ tên đầy đủ qua
[`packages.datasites.vbpl.codes.slugify_vi`](https://github.com/tmquan/ViLA/blob/main/packages/datasites/vbpl/codes.py)
nên người đọc hiểu ngay loại văn bản mà không cần tra cứu bảng
mã. Mã ngắn cũ (`QĐ`, `NĐ`, `TTLT`, ...) vẫn xuất hiện trong số
hiệu (`43/2026/NĐ-CP`) và có thể khôi phục từ
`SLUG_TO_CANONICAL_CODE`. — Each document carries a self-describing
**ASCII snake_case slug** (`doc_type`, e.g. `quyet_dinh`,
`nghi_dinh`, `thong_tu_lien_tich`) and the canonical Vietnamese
full name (`legal_type`, e.g. `Quyết định`, `Nghị định`,
`Thông tư liên tịch`). The slug is automatically derived from the
full Vietnamese name via
[`slugify_vi`](https://github.com/tmquan/ViLA/blob/main/packages/datasites/vbpl/codes.py)
so a reader can interpret the doc type without consulting a separate
codebook. The compact short code (`QĐ`, `NĐ`, `TTLT`, ...) still
appears inside `so_hieu` itself (`43/2026/NĐ-CP`) and can be
recovered from any slug via the `SLUG_TO_CANONICAL_CODE` table in
`codes.py`. The set of slugs follows Luật Ban hành Văn bản Quy phạm
Pháp luật 2015 — `hien_phap` / `bo_luat` / `luat` / `phap_lenh` /
`lenh` / `nghi_quyet` / `nghi_dinh` / `quyet_dinh` / `thong_tu` /
`chi_thi` / `sac_lenh` / `van_ban_hop_nhat` / `thong_tu_lien_tich`
/ ...

### By slug · `doc_type`

| Value | Count | Share |
|---|---:|---:|
| `quyet_dinh` | 84,970 | 53.5% |
| `nghi_quyet` | 26,091 | 16.4% |
| `thong_tu` | 16,212 | 10.2% |
| `ban_dich_van_ban` | 10,576 | 6.7% |
| `chi_thi` | 7,908 | 5.0% |
| `nghi_dinh` | 4,690 | 3.0% |
| `thong_tu_lien_tich` | 3,393 | 2.1% |
| `van_ban_hop_nhat` | 1,792 | 1.1% |
| `sac_lenh` | 980 | 0.6% |
| `cong_van` | 708 | 0.4% |
| `luat` | 580 | 0.4% |
| `lenh` | 376 | 0.2% |

### By full name · `legal_type`

| Value | Count | Share |
|---|---:|---:|
| `Quyết định` | 84,962 | 53.5% |
| `Nghị quyết` | 26,086 | 16.4% |
| `Thông tư` | 16,212 | 10.2% |
| `Bản dịch văn bản` | 10,576 | 6.7% |
| `Chỉ thị` | 7,908 | 5.0% |
| `Nghị định` | 4,690 | 3.0% |
| `Thông tư liên tịch` | 3,393 | 2.1% |
| `Văn bản hợp nhất` | 1,788 | 1.1% |
| `Sắc lệnh` | 980 | 0.6% |
| `Công văn` | 708 | 0.4% |
| `Luật` | 580 | 0.4% |
| `Lệnh` | 376 | 0.2% |

## Lĩnh vực pháp luật · `legal_area`

`legal_area` is the canonical Vietnamese label pulled from the
``documentFields[]`` block on each detail-API response (~250
distinct labels in the corpus). Roughly two thirds of the documents
are tagged `Chưa phân loại` ("uncategorised") on the source portal;
we preserve that literal so consumers can see the gap explicitly
instead of nulling it. Top areas below; embedding scatters below
show the structural overlap between adjacent areas.

| Value | Count | Share |
|---|---:|---:|
| `Chưa phân loại` | 112,784 | 71.0% |
| `Đất đai` | 2,861 | 1.8% |
| `Quản lý thuế, phí, lệ phí và thu khác của ngân sách nhà nước` | 2,301 | 1.4% |
| `Quản lý thuế, phí và lệ phí` | 1,698 | 1.1% |
| `Lĩnh vực giá` | 1,673 | 1.1% |
| `Tổ chức- Biên chế` | 1,424 | 0.9% |
| `Lao động, tiền lương, tiền công` | 1,373 | 0.9% |
| `Quản lý ngân sách` | 1,211 | 0.8% |
| `Quản lý ngân sách nhà nước` | 1,052 | 0.7% |
| `Ngân sách nhà nước` | 951 | 0.6% |
| `Đường bộ` | 942 | 0.6% |
| `Chính quyền địa phương` | 869 | 0.5% |
| `Công chức, viên chức` | 715 | 0.5% |
| `Tài chính khác` | 657 | 0.4% |
| `Lâm nghiệp` | 637 | 0.4% |
| `Môi trường` | 557 | 0.4% |
| `Nông nghiệp` | 513 | 0.3% |
| `Thủy lợi` | 473 | 0.3% |
| `Chính sách thuế` | 465 | 0.3% |
| `Tổ chức cán bộ` | 407 | 0.3% |

## Cơ quan ban hành · Issuing agency

Top issuing agencies (top 15). Quốc hội + Chính phủ + Bộ Tài chính
+ Bộ Tư pháp + ... thường chiếm phần lớn `trung_uong`; các tỉnh
chia khá đều phần `dia_phuong`.

| Value | Count | Share |
|---|---:|---:|
| `Bộ Tài chính` | 11,793 | 7.4% |
| `Thủ tướng Chính phủ` | 7,849 | 4.9% |
| `Chính phủ` | 7,168 | 4.5% |
| `UBND Thành phố Hồ Chí Minh` | 5,312 | 3.3% |
| `Bộ Nông nghiệp và Phát triển nông thôn` | 2,526 | 1.6% |
| `UBND Tỉnh Lào Cai` | 2,497 | 1.6% |
| `UBND Tỉnh Nghệ An` | 2,477 | 1.6% |
| `UBND tỉnh Bình Phước` | 2,410 | 1.5% |
| `Ngân hàng Nhà nước Việt Nam` | 2,198 | 1.4% |
| `UBND Thành phố Hà Nội` | 2,123 | 1.3% |
| `UBND thành phố Đà Nẵng` | 2,018 | 1.3% |
| `UBND tỉnh Bà Rịa - Vũng Tàu` | 1,956 | 1.2% |
| `Bộ Giao thông vận tải` | 1,925 | 1.2% |
| `UBND Thành phố Hải Phòng` | 1,885 | 1.2% |
| `UBND Tỉnh Gia Lai` | 1,765 | 1.1% |

## Năm ban hành · Year of issue

Phân bố năm theo `ngay_ban_hanh` (ISO `YYYY-MM-DD`); rỗng nếu cổng
không cung cấp được trường này. — Year distribution from
`ngay_ban_hanh`; null when the source portal didn't expose the issue
date.

| Year | Count |
|---:|---:|
| 2026 | 761 |
| 2025 | 9,427 |
| 2024 | 7,307 |
| 2023 | 5,367 |
| 2022 | 5,378 |
| 2021 | 5,306 |
| 2020 | 4,682 |
| 2019 | 4,983 |
| 2018 | 4,979 |
| 2017 | 5,591 |
| 2016 | 6,307 |
| 2015 | 5,346 |
| 2014 | 5,880 |
| 2013 | 5,204 |
| 2012 | 4,893 |
| 2011 | 4,834 |
| 2010 | 4,431 |
| 2009 | 4,930 |
| 2008 | 5,453 |
| 2007 | 6,713 |
| 2006 | 6,684 |
| 2005 | 5,486 |
| 2004 | 5,120 |
| 2003 | 4,281 |
| 2002 | 3,627 |
| 2001 | 3,395 |
| 2000 | 2,785 |
| 1999 | 3,079 |
| 1998 | 2,746 |
| 1997 | 2,346 |

## Nguồn nội dung · Body provenance

Một văn bản trên `vbpl.vn` có thể có **HTML thân bài** (do API SPA
trả về sau khi qua reCAPTCHA) và/hoặc một **tệp đính kèm**
(`.pdf` / `.doc` / `.docx`). Pipeline ưu tiên parse tệp khi có,
quay về HTML khi không. — A vbpl document may have an inline
**body HTML** (returned by the SPA's API after reCAPTCHA) and/or a
downloadable **attachment** (`.pdf` / `.doc` / `.docx`). The pipeline
prefers parsing the file when present and falls back to the HTML
otherwise.

| Value | Count | Share |
|---|---:|---:|
| `body_html` | 147,317 | 92.8% |
| `shell_html` | 11,505 | 7.2% |

## Lược đồ bảng `documents` · `documents` schema

The parquet has three families of columns:

### Identification + meta

| Field | Type | Description |
|---|---|---|
| `doc_name` / `item_id` | string | Stable document id (= the `--<id>` suffix of the source URL). Mostly numeric (`186739`); legacy docs use `vbpqta_<n>` (Văn bản pháp quy toàn văn) or `vbpqdinhchinh_<n>` (corrigendum). |
| `scope` | string | `trung_uong` (central) \| `dia_phuong` (provincial). |
| `source` | string | Source host, always `vbpl.vn`. |
| `source_url` / `api_url` | string | Deep link back to the portal page / the underlying gateway API. |
| `title` | string (nullable) | Document subject after the full title scrub: (1) baseline cleanup (NFC, HTML-entity decode, `"số số"` doubling fix, trailing sentence punctuation), (2) decorative quote stripping at the title boundary and around inline phrases — leading / trailing / paired runs of `"`, `'`, `"`, `'`, `'`, `'` are removed but **word-internal single quotes are preserved** so legitimate Vietnamese / loan-word names survive intact (`Đắk R'lấp`, `M'nông`, `D'Ran`, `Côte d'Ivoire`, `Ea T'ling`, `Đạ M'ri`, …), (3) leading `"<Legal-type> số <Number> "` boilerplate head peeled (e.g. `"Quyết định số 143/QĐ-KHTC Ban hành Quy chế"` → `"Ban hành Quy chế"`), and (4) every `"<DocType> [số] <DocNum> [ngày <date>]"` cross-reference of OTHER documents stripped from anywhere in the body (`"Bãi bỏ Nghị quyết số 84/2018/NQ-HĐND ngày 07/12/2018 của HĐND tỉnh..."` → `"Bãi bỏ của HĐND tỉnh..."`). The Vietnamese noun `Lỗi` / `lỗi` / `loi` ("fault / error") is preserved wherever it appears — it's a legitimate subject word (e.g. `"Lỗi Ban hành Quy chế hoạt động của hội đồng tư vấn mua sắm tài sản"`), not a CMS marker. `null` for the pathological tail where the entire source title was just a bare doc-num token (e.g. `"1938/QĐ-UBND"`); other bibliographic columns still carry the citation handle. |
| `doc_type` | string | Self-describing **ASCII snake_case slug** of the Vietnamese doc-type name (`quyet_dinh`, `nghi_dinh`, `thong_tu_lien_tich`, `chi_thi`, `van_ban_hop_nhat`, ...). Auto-derived from `legal_type` via `slugify_vi`; the compact short code (``, ``, `TTLT`, ...) still appears in `so_hieu` itself (`43/2026/NĐ-CP`) and is recoverable via `SLUG_TO_CANONICAL_CODE`. |
| `legal_type` | string | Canonical Vietnamese **full name** for the document type (`Luật`, `Nghị định`, `Thông tư`, `Quyết định`, `Nghị quyết`, `Chỉ thị`, …). Round-trips with `doc_type` via `slugify_vi`. |
| `legal_area` | string | Legal area / subject domain (`Đất đai`, `Đường bộ`, `Lĩnh vực giá`, …). Defaults to `Chưa phân loại` when the source portal hasn't tagged the doc. |
| `so_hieu` | list&lt;string&gt; (nullable) | Document number(s) as a list of canonical short forms (e.g. `["43/2026/NĐ-CP"]`). A small minority of vbpl rows pack several identifiers into one source cell separated by Vietnamese ` và ` ("and") or `,`; those ship as multi-element lists (e.g. `["142/2009/QĐ-TTg", "49/2012/QĐ-TTg"]`). Source-side cruft is stripped: leading legal-type words (`"Nghị quyết số: 528/2018/UBTVQH14"``["528/2018/UBTVQH14"]`), trailing annotations (`"109/2005/QĐ-BCA (A11)"``["109/2005/QĐ-BCA"]`, `"49/2007/TTLT-BTC-BGD ngày 18/5/2007"``["49/2007/TTLT-BTC-BGD"]`), and the legitimate `"Không số"` ("no number") sentinel is preserved. `null` for rows with no usable number. |
| `ngay_ban_hanh` | string | Issue date, ISO `YYYY-MM-DD`. |
| `year` | int32 | Year extracted from `ngay_ban_hanh`. |
| `co_quan_ban_hanh` | string | Issuing agency (e.g. `"Chính phủ"`, `"Bộ Tài chính"`, `"Hội đồng nhân dân tỉnh A"`). |
| `trich_yeu` | string | Abstract / summary. |

### Body + stats

| Field | Type | Description |
|---|---|---|
| `markdown` | string (nullable) | NFC-normalised, modern-orthography Vietnamese markdown (page-segmented with `## Page N` headings when parsed from a PDF). Gateway / Word / Next.js scaffolding is stripped: the `Document Content\\n\\nbody { font-family: ... }\\np { margin: ... }` API preamble (~50 % of bodies), Word `<!-- /* Font Definitions */ @font-face { ... } p.MsoNormal { ... } -->` stylesheet dumps, standalone CSS rule blocks gated by property / selector / structural CSS tells, Ant Design `:where(.css-...){ ... }@keyframes ...{ ... }` chains, orphan selector fragments, and malformed inline `<span lang="..." style="...">` tags. ~90 % of rows lose 1-200 KB of boilerplate; total corpus markdown shrunk by ~1.77 GB / 42 %. **Null** when `body_source == "shell_html"` after the May-2026 live-API recovery (the source genuinely has no body for those legacy IDs); bibliographic metadata (title, agency, so_hieu, ...) is still populated on NULL-markdown rows so consumers retain the citation handle. |
| `num_pages` | int32 | Page count from the parser (PDF/DOCX only). |
| `num_sections` / `num_paragraphs` / `num_sentences` | int32 | Counts from the structure layer. |
| `char_len` | int32 | Character length of `markdown` **after** the junk-strip pass (recomputed at export time so consumers can dedupe on the actual shipped body). |
| `text_hash` | string | SHA-256 first-32 hex of `markdown` **after** the junk-strip pass (re-run-stable id; differs from the upstream `extract.jsonl` hash for any row that had scaffolding removed). |
| `parser_model` | string | Backend that produced the markdown (`local/pypdf`, `local/markdownify`, `nvidia/nemoretriever-parse`, …). |
| `parser_runtime` | string | The configured `parser.runtime` (`local` / `nim` / `hybrid`). |
| `body_source` | string | Which source produced the body: `file` (downloaded PDF/.doc/.docx), `body_html` (API-captured), `shell_html` (Next.js shell fallback -- the gateway never delivered a real body; published with `markdown=null` after the May-2026 live-API recovery sweep confirmed the source publishes only metadata for those legacy IDs). |
| `parsed_at` | string | ISO 8601 parser timestamp. |

### Hierarchy + entities

| Field | Type | Description |
|---|---|---|
| `structure_json` | string | Full :class:`DocumentStructure` (meta + stats + sections + paragraphs + sentences) as JSON. Includes char-span back-pointers so any unit can be located in `markdown` precisely. |
| `extracted_json` | string | Generic NER + statute-link extraction (entities, relations, statute_refs) as JSON. |
| `file_paths_json` | string | Downloaded attachments as JSON list of `{file_url, file_name, file_type, local_path}`. |

Quick load:

```python
import json
from datasets import load_dataset

ds = load_dataset("tmquan/vbpl-vn", split="train")
row = ds[0]
print(row["doc_type"], row["so_hieu"], row["ngay_ban_hanh"])
# e.g. "quyet_dinh 143/QĐ-KHTC 2018-01-29"
print(row["title"])
# e.g. "Ban hành Quy chế quản lý ngân sách ngành Tư pháp"
# (the redundant "Quyết định số 143/QĐ-KHTC " head has been
#  stripped; recombine via f"{row['legal_type']} số {row['so_hieu']} {row['title']}"
#  if your downstream pipeline still wants the full original.)
structure = json.loads(row["structure_json"])
for sec in structure.get("sections", []):
    print(sec["kind"], sec["label"])
```

## Companion stages · `embed` + `reduce`

Alongside the default `documents-*.parquet` shards (one row per
document, with text + structure), the repo also carries the
**embed** and **reduce** pipeline outputs as separate parquet
bundles. Both join back to the `documents` table on the
`doc_name` primary key. Only the **embeddable** rows
(147,317 after dropping NULL-markdown
docs) appear in these stages.

### `embed-*.parquet` — dense vectors

15 shards (~93 MB each, ~1.33 GB total, 10 000 rows per shard,
deterministic `doc_name` ordering). Schema mirrors the
`anle.toaan.gov.vn` corpus's embed stage exactly so
cross-corpus joins are straightforward:

| Field | Type | Description |
|---|---|---|
| `doc_name` | string | Join key back to `documents-*.parquet`. |
| `text_hash` | string | SHA-256 of the post-normalisation `markdown` (stable across re-runs). |
| `embedding` | list&lt;float64&gt; | **2048-D** dense vector from `nvidia/llama-nemotron-embed-1b-v2` (default; other models give other dims). |
| `embedding_dim` | int64 | Length of `embedding` (denormalised for fast filtering, always `2048` in this release). |
| `embedding_model_id` | string | Model slug as the embedder backend reports it. |
| `embedding_text_hash` | string | SHA-256 of the exact text fed to the embedder (differs from `text_hash` when sliding-window chunking applies). |
| `embedding_chunks_used` | int64 | Number of windows mean-pooled into the final vector (1 when the doc fits in one window). |
| `embedding_chunking` | string | Chunking strategy: `off` / `sliding` / `sentence`. |

### `reduce-*.parquet` — 2-D projections + cluster ids

15 shards (~0.5 MB each, ~7 MB total). PCA + t-SNE + UMAP run
with `cfg.reducer.n_components=2` so the `*_z` columns that
existed in the on-disk per-doc shards are dropped here.
HDBSCAN cluster ids land in `[-1, N]` (`-1` is the noise
bucket).

| Field | Type | Description |
|---|---|---|
| `doc_name` / `text_hash` | string | Join keys back to `documents-*.parquet` and `embed-*.parquet`. |
| `pca_x` / `pca_y` | float64 | 2-D PCA projection of the 2048-D embedding. |
| `tsne_x` / `tsne_y` | float64 | 2-D t-SNE projection. |
| `umap_x` / `umap_y` | float64 | 2-D UMAP projection (the one used in the scatter PNGs above). |
| `cluster_id` | int64 | HDBSCAN cluster label; `-1` is the noise / unclustered bucket. |

Quick load (each stage is a `data_files` glob; the default
`load_dataset("tmquan/vbpl-vn")` still resolves to the
`documents` config):

```python
from datasets import load_dataset

embed = load_dataset(
    "tmquan/vbpl-vn",
    data_files="embed-*.parquet",
    split="train",
)
print(embed[0]["doc_name"], len(embed[0]["embedding"]))
# e.g. "100000 2048"

reduce = load_dataset(
    "tmquan/vbpl-vn",
    data_files="reduce-*.parquet",
    split="train",
)
print(reduce[0]["doc_name"], reduce[0]["umap_x"], reduce[0]["cluster_id"])
# e.g. "100000 1.7142 -1"
```

To join embed-stage vectors back to the document metadata, do
the join client-side on `doc_name`:

```python
import pandas as pd

docs   = load_dataset("tmquan/vbpl-vn", split="train").to_pandas()
embed  = load_dataset("tmquan/vbpl-vn",
                      data_files="embed-*.parquet",
                      split="train").to_pandas()
joined = docs.merge(embed, on="doc_name", how="inner")
# joined now has the title / so_hieu / markdown / ... columns
# next to the 2048-D embedding vector for every embeddable doc.
```

## Trực quan hoá embedding · Embedding visualization

Mỗi điểm là một văn bản pháp luật; toạ độ là vector embedding 2048-D từ `nvidia/llama-nemotron-embed-1b-v2` chiếu xuống 2D bằng UMAP, cụm bằng HDBSCAN. Sáu mặt phân hoạch: `scope`, `doc_type` (mã ngắn), `legal_type` (tên đầy đủ), `legal_area` (lĩnh vực pháp luật), `year`, `cluster_id`. Các nhãn tail-end (sau top-18) được dồn vào nhóm *Khác / Other* màu xám để chú giải đọc được. — Each dot is one legal document; coordinates are the 2D UMAP projection of a 2048-D embedding from `nvidia/llama-nemotron-embed-1b-v2`, with HDBSCAN cluster ids. Six facets: `scope`, `doc_type` (canonical short code), `legal_type` (canonical full name), `legal_area` (subject domain), `year`, `cluster_id`. Tail-end labels beyond the top 18 are collapsed into a grey *Khác / Other* bucket to keep the legend legible. The published reducer parquet still carries `tsne_x` / `tsne_y` columns next to `umap_*` for consumers who want to render t-SNE themselves.

### UMAP colored by `scope`

![UMAP colored by `scope`](./embedding-scope-umap.png)

### UMAP colored by `doc_type`

![UMAP colored by `doc_type`](./embedding-doc-type-umap.png)

### UMAP colored by `legal_type`

![UMAP colored by `legal_type`](./embedding-legal-type-umap.png)

### UMAP colored by `legal_area`

![UMAP colored by `legal_area`](./embedding-legal-area-umap.png)

### UMAP colored by `year`

![UMAP colored by `year`](./embedding-year-umap.png)

## Cách thu thập + chuẩn hoá · How the corpus was built

The crawler is a six-stage pipeline (`harvest` → `detail` → `parse`
→ `extract` → `embed` → `reduce`) that walks vbpl.vn's public
sitemap chain (32 shards, ~160 K URLs total), drives a headless
Chromium tab against each detail page so Google's invisible
reCAPTCHA v2 mints the per-session Bearer token (the SPA's
`/api/qtdc/public/doc/...` gateway is otherwise inaccessible),
intercepts the resulting authenticated XHRs, downloads any
`.pdf` / `.doc` / `.docx` attachment, and routes the body through:

1. **Parse** -- pypdf for PDFs, docx2txt for `.docx`, an
   `antiword` / `catdoc` / `libreoffice` subprocess fallback for
   legacy `.doc`, `markdownify` for HTML bodies returned inline.
2. **Vietnamese normalisation** -- ftfy NFC + tone-mark
   canonicalisation (`Toà → Tòa`, `hoà → hòa`, `thuỷ → thủy`) +
   PDF whitespace cleanup. Every regex / segmenter downstream then
   sees a single canonical orthography.
3. **Generic + structure extractor** -- regex / dictionary NER +
   Vietnamese statute linker (`Điều N khoản M Luật ...`, dates
   `dd/MM/yyyy`, courts, agencies, document numbers) + a
   hierarchical `DocumentStructure` (sections / paragraphs /
   sentences with back-pointers).
4. **Embed** -- `nvidia/llama-nemotron-embed-1b-v2` (2048-D) over the
   normalised markdown; sliding-window mean pool when a doc exceeds
   the model's native context window.
5. **Reduce** -- PCA + t-SNE + UMAP on the embedding matrix +
   HDBSCAN cluster ids. cuML on a GPU worker; sklearn / umap-learn
   / hdbscan otherwise.

All five layers are deterministic and re-runnable; re-running any
stage with the same `--limit` is a no-op (each stage skips
already-produced outputs).

### Body-recovery rerun (May 2026)

A targeted retry against the public gateway
`https://vbpl-bientap-gateway.moj.gov.vn/api/qtdc/public/doc/<id>`
recovered **3,849 / 15,351** previously bodyless documents (the
gateway now publishes real `documentContent.content` HTML for that
slice even though our cached SPA fetch came back empty in
2026-04). The remaining ~11.5K are genuinely bodyless on the
official vbpl source (legacy / cancelled documents the publisher
no longer carries a full text for) and ship in this dataset with
`markdown=null`. Bibliographic metadata (title, agency, document
number, issue date, ...) is still populated on those rows so
consumers retain the citation handle even when no body is
available. Per-doc
embedding parquets for the NULL-markdown rows are dropped from
the embedding corpus entirely so the reducer fits on the
embeddable rows only (147,317-row corpus).

Captured: `2026-05-21T17:50:24.822753+00:00`.

## Nguồn · Source

* Portal: <https://vbpl.vn/>
* Backend gateway: `vbpl-bientap-gateway.moj.gov.vn`
* Publisher: Ministry of Justice of Vietnam (Bộ Tư pháp)
* Sitemap: <https://vbpl.vn/sitemap.xml>

## Giấy phép · License

Văn bản gốc được Bộ Tư pháp công bố trên cổng thông tin công cộng
(`Allow: /` trong `robots.txt`). Bản phân phối lại này dùng giấy
phép **CC-BY-4.0**; vui lòng kiểm tra điều khoản sử
dụng của trang nguồn trước khi tái phân phối thương mại. — The
source documents are published by the Ministry of Justice on a
public portal (its `robots.txt` allows `/` and disallows only
`/api/`). This redistribution is shared under
**CC-BY-4.0**; please check the source-website terms of
use before commercial redistribution.

## Trích dẫn · Citation

If you use this dataset, please cite both **the redistribution on
Hugging Face** and **the original source** (Cơ sở dữ liệu Quốc gia
về pháp luật, Bộ Tư pháp Việt Nam):

```bibtex
@misc{vbpl_2026,
  title        = {Vietnamese National Legal Database (vbpl.vn)},
  author       = {TMQuan},
  year         = {2026},
  howpublished = {\url{https://huggingface.co/datasets/tmquan/vbpl-vn}},
  note         = {Document-level mirror with a hierarchical structure layer (DocumentMeta + Section + Paragraph + Sentence) over Vietnam's National Legal Database, central + provincial scope.}
}

@misc{vbpl_moj_2026,
  title        = {Vietnamese National Legal Database},
  author       = {{Cơ sở dữ liệu Quốc gia về pháp luật}},
  year         = {2026},
  howpublished = {\url{https://vbpl.vn/}},
  note         = {Official portal for Vietnam's National Legal Database (laws, ordinances, decrees, circulars, decisions, ...) at central and provincial levels, published by the Ministry of Justice (Bộ Tư pháp).}
}
```