Datasets:
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.vndo 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(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,820 |
| Tổng số bản ghi đầu vào · Raw extract rows | 158,822 |
| Loại bỏ vì rỗng · Dropped (empty body) | 2 |
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,820 |
| Có tệp đính kèm · With downloaded attachment | 0 |
| Trung vị ký tự · Median chars / doc | 5,311 |
| Trung vị trang · Median pages / doc | – |
| Trung vị đoạn văn · Median paragraphs / doc | 39 |
| Trung vị câu · Median sentences / doc | 52 |
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
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
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
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
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
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 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,344 | 65.7% |
trung_uong |
54,476 | 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
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
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,211 | 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,333 | 53.1% |
Nghị quyết |
25,922 | 16.3% |
Thông tư |
15,976 | 10.1% |
Bản dịch văn bản |
10,516 | 6.6% |
Chỉ thị |
7,866 | 5.0% |
Nghị định |
4,611 | 2.9% |
Thông tư liên tịch |
3,354 | 2.1% |
Văn bản hợp nhất |
1,667 | 1.0% |
unknown |
1,439 | 0.9% |
Sắc lệnh |
961 | 0.6% |
Công văn |
704 | 0.4% |
Luật |
564 | 0.4% |
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 |
157,687 | 99.3% |
Quản lý thuế, phí, lệ phí và thu khác của ngân sách nhà nước |
92 | 0.1% |
Lĩnh vực giá |
70 | 0.0% |
Đất đai |
65 | 0.0% |
Ngân sách nhà nước |
32 | 0.0% |
Quản lý ngân sách nhà nước |
24 | 0.0% |
Thể dục, thể thao |
22 | 0.0% |
Chính sách thuế |
20 | 0.0% |
Chính quyền địa phương |
20 | 0.0% |
Công chức, viên chức |
19 | 0.0% |
Tổ chức- Biên chế |
17 | 0.0% |
Thi đua, khen thưởng |
16 | 0.0% |
Môi trường |
15 | 0.0% |
Bảo trợ xã hội |
15 | 0.0% |
Xuất nhập khẩu |
15 | 0.0% |
Tài nguyên khoáng sản, địa chất |
14 | 0.0% |
Quản lý hoạt động xây dựng |
13 | 0.0% |
Đường bộ |
13 | 0.0% |
Quản lý thuế, phí và lệ phí |
13 | 0.0% |
Đầu tư tại Việt Nam |
12 | 0.0% |
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ầndia_phuong.
| Value | Count | Share |
|---|---|---|
unknown |
154,971 | 97.6% |
Chính phủ |
243 | 0.2% |
UBND tỉnh Cần Thơ |
223 | 0.1% |
Thủ tướng Chính phủ |
191 | 0.1% |
UBND Thành phố Cần Thơ |
183 | 0.1% |
UBND Thành phố Hồ Chí Minh |
132 | 0.1% |
UBND TỈNH BÌNH ĐỊNH |
114 | 0.1% |
UBND tỉnh Bà Rịa - Vũng Tàu |
109 | 0.1% |
UBND thành phố Đà Nẵng |
102 | 0.1% |
UBND tỉnh Thừa Thiên Huế |
78 | 0.0% |
Bộ Tài chính |
77 | 0.0% |
Bộ Y tế |
68 | 0.0% |
UBND tỉnh Bến Tre |
65 | 0.0% |
HĐND tỉnh Bà Rịa - Vũng Tàu |
56 | 0.0% |
Ngân hàng Nhà nước Việt Nam |
55 | 0.0% |
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 |
|---|---|
| 2025 | 87 |
| 2024 | 8 |
| 2023 | 3 |
| 2022 | 8 |
| 2021 | 8 |
| 2020 | 5 |
| 2019 | 2 |
| 2018 | 291 |
| 2017 | 1,083 |
| 2016 | 199 |
| 2015 | 449 |
| 2014 | 144 |
| 2013 | 127 |
| 2012 | 51 |
| 2011 | 43 |
| 2010 | 30 |
| 2009 | 28 |
| 2008 | 58 |
| 2007 | 176 |
| 2006 | 130 |
| 2005 | 103 |
| 2004 | 79 |
| 2003 | 52 |
| 2002 | 62 |
| 2001 | 56 |
| 2000 | 45 |
| 1999 | 34 |
| 1998 | 73 |
| 1997 | 50 |
| 1996 | 64 |
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,315 | 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 (QĐ, NĐ, 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<string> (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:
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,315 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<float64> | 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):
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:
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 doc_type
UMAP colored by legal_type
UMAP colored by legal_area
UMAP colored by year
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:
- Parse -- pypdf for PDFs, docx2txt for
.docx, anantiword/catdoc/libreofficesubprocess fallback for legacy.doc,markdownifyfor HTML bodies returned inline. - 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. - Generic + structure extractor -- regex / dictionary NER +
Vietnamese statute linker (
Điều N khoản M Luật ..., datesdd/MM/yyyy, courts, agencies, document numbers) + a hierarchicalDocumentStructure(sections / paragraphs / sentences with back-pointers). - 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. - 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,315-row corpus).
Captured: 2026-05-21T09:15:08.769977+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):
@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).}
}










