Dataset Viewer
The dataset viewer is not available for this subset.
Cannot get the split names for the config 'default' of the dataset.
Exception: SplitsNotFoundError
Message: The split names could not be parsed from the dataset config.
Traceback: Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/datasets/inspect.py", line 286, in get_dataset_config_info
for split_generator in builder._split_generators(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/packaged_modules/json/json.py", line 91, in _split_generators
pa_table = next(iter(self._generate_tables(**splits[0].gen_kwargs, allow_full_read=False)))[1]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/packaged_modules/json/json.py", line 194, in _generate_tables
json_field_paths += find_mixed_struct_types_field_paths(examples)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/utils/json.py", line 58, in find_mixed_struct_types_field_paths
examples = [x[subfield] for x in content if x[subfield] is not None]
~^^^^^^^^^^
KeyError: 'year'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/split_names.py", line 65, in compute_split_names_from_streaming_response
for split in get_dataset_split_names(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/inspect.py", line 340, in get_dataset_split_names
info = get_dataset_config_info(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/inspect.py", line 291, in get_dataset_config_info
raise SplitsNotFoundError("The split names could not be parsed from the dataset config.") from err
datasets.inspect.SplitsNotFoundError: The split names could not be parsed from the dataset config.Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
Thai Legal Corpus v1
Cleaned and deduplicated Thai legal text corpus for Continual Pre-Training (CPT), with structured citation metadata for legal analysis.
Dataset Description
| Metric | Value |
|---|---|
| Total records | 176,543 |
| Total size | 6.03 GB |
| Avg doc length | 11,952 chars |
| Sources | 3 |
| Year range | 1874-2026 |
| Splits | train 158,887 / val 8,826 / test 8,830 |
Sources
| Source | Records |
|---|---|
| krisdika | 6,743 |
| supreme_court | 127,012 |
| thailaw | 42,788 |
Repository Structure
data/
train.jsonl, val.jsonl, test.jsonl -- Cleaned text (for CPT)
metadata/
deka_citations.jsonl -- Citation metadata (join by doc_id)
law_section_index.json -- Law-section-case mapping
corpus_stats.json
Data Schema
Training Data (data/*.jsonl)
| Field | Type | Description |
|---|---|---|
text |
string | Full legal text (cleaned, 100-500K chars) |
source |
string | krisdika, thailaw, or supreme_court |
doc_id |
string | Unique document ID |
year |
int (optional) | Publication year (CE) |
Citation Metadata (metadata/deka_citations.jsonl)
Structured fields for Supreme Court rulings. Join with training data on doc_id.
| Field | Type | Description |
|---|---|---|
doc_id |
string | Matches doc_id in training data |
case_id |
string | Case number (e.g., 7946/2568) |
case_year |
string | Buddhist Era year |
laws_cited |
list[str] | Laws referenced in ruling |
sections_cited |
list[str] | Specific sections cited (e.g., ป.อ. มาตรา 265) |
Law-Section-Case Index (metadata/law_section_index.json)
Structured mapping from Thai laws to sections to Supreme Court case counts.
| Metric | Value |
|---|---|
| Total laws | 2,210 |
| Total sections | 18,003 |
| Total case references | 667,613 |
Top laws: ป.พ.พ. (275,772 cases), ป.อ. (102,245), ป.วิ.อ. (99,840), ป.วิ.พ. (70,590)
Original Law Full Text Sources
| Source | URL | Coverage |
|---|---|---|
| สำนักงานคณะกรรมการกฤษฎีกา | law.go.th | Official -- all Thai laws |
| HF: ocs-krisdika | open-law-data-thailand/ocs-krisdika |
7,042 laws (structured) |
| HF: thailaw | pythainlp/thailaw-v1.0 |
43,012 laws (full text) |
| ราชกิจจานุเบกษา | ratchakitcha.soc.go.th | Original gazette PDFs |
Sources
- krisdika (Office of the Council of State) -- Structured laws from
open-law-data-thailand/ocs-krisdika - thailaw (PyThaiNLP) -- Full-text Thai laws from
pythainlp/thailaw-v1.0 - supreme_court -- Supreme Court rulings from deka.supremecourt.or.th
Cleaning Pipeline
Integrated with OpenThaiGPT/data-processing patterns:
- Unicode NFC normalization + cc_net punctuation normalization + invisible/non-printing char removal
- Content cleaning: strip URLs, emails, HTML tags, iframes, markup, IPs, hashtags
- Encoding corruption detection: GHOST (double-encoding), NONECHAR (invalid Thai codepoints), NONE_TONE_MARK (OCR artifacts)
- Quality filtering: Thai ratio >= 30%, text length 100-500K chars, garbled ratio < 10%
- Exact hash deduplication (MD5)
- Stratified 90/5/5 split by source
Intended Use
- Continual Pre-Training (CPT) of Thai language models for legal domain
- Legal citation analysis and knowledge graph construction
- Legal text analysis and information retrieval
Limitations
- Supreme Court rulings may contain archaic Thai legal terminology
- Some older statutory records may have OCR artifacts from source
- Year metadata is best-effort extraction from text
- Citation extraction is regex-based and may miss some references
Citation
@misc{thai-legal-corpus-2026,
title={Thai Legal Corpus v1},
year={2026},
howpublished={HuggingFace},
}
- Downloads last month
- 288