CoolFace
Datasetpublic

renzzyyy1028/civil-code-phil

Civilex — Philippine Legal RAG & SFT Dataset Retrieval corpus and supervised fine-tuning (SFT) data for a retrieval-augmented generation (RAG) pipeline over Philippine law: the Civil Code (Republic Act No. 386) and Supreme Court jurisprudence. Produced by the civilex-thesis research pipeline. Contents: 11k+ Supreme Court jurisprudence cases spanning 1949–2025, and 2,270 articles from the Civil Code (Republic Act No. 386). Dataset structure . ├── README.md ├──… See the full description on the dataset page: https://huggingface.co/datasets/renzzyyy1028/civil-code-phil.

sourceHugging Facecc-by-4.0updated 5h agoView on Hugging Face
0likes144downloads
Dataset Card

Civilex — Philippine Legal RAG & SFT Dataset

Retrieval corpus and supervised fine-tuning (SFT) data for a retrieval-augmented generation (RAG) pipeline over Philippine law: the Civil Code (Republic Act No. 386) and Supreme Court jurisprudence. Produced by the civilex-thesis research pipeline.

Contents: 11k+ Supreme Court jurisprudence cases spanning 1949–2025, and 2,270 articles from the Civil Code (Republic Act No. 386).

Dataset structure

.
├── README.md
├── civil_code_rag.jsonl          # Civil Code articles + hierarchy + citation linkage
├── jurisprudence_chunks.jsonl    # RAG-ready chunks of Supreme Court decisions
├── jurisprudence_document.jsonl  # Full Supreme Court decisions (one row per case)
├── article_case_index.json       # Auxiliary: article → case citation index (dict, not a table)
└── training/
    ├── train_clean.jsonl         # SFT chat examples (train)
    └── eval.jsonl                # SFT chat examples (validation)

Subsets (configs)

ConfigFileRowsDescription
civil_codecivil_code_rag.jsonl2,270Civil Code articles with hierarchy, cleaned text, topics, keywords, cross-references, and per-article jurisprudence linkage
jurisprudence_chunksjurisprudence_chunks.jsonl351,076Chunked decision text for retrieval; each chunk links back to its case and cited Civil Code articles
jurisprudence_documentsjurisprudence_document.jsonl11,879Full decisions: metadata, content, summary, dispositive portion, citations
trainingtraining/*.jsonl4,351 train / 485 validationChat-format SFT examples (system/user/assistant) for plain-language explanation of legal provisions

Data fields

civil_code

FieldTypeDescription
article_idstringStable ID, e.g. RA386-ART1
article_numberint32Article number
law_title / act_namestringe.g. Republic Act No. 386 / Civil Code of the Philippines
hierarchystruct{book, book_name, title, title_name, chapter, chapter_name, section, section_name}
pathstringHuman-readable location, e.g. PRELIMINARY TITLE > CH 1 - ... > Art. 1
text / text_cleanstringOriginal and normalized article text
legal_topics / keywordslist<string>Topic labels and keywords
cross_referencesstruct{cites, cited_by} article cross-references
jurisprudence_linkagestruct{total_citations, cases, citation_trend} per-article case citations
is_hubboolWhether the article is flagged as a high-citation hub
chunkslist<struct>Pre-computed retrieval chunks for the article
source_urlstringSource URL

jurisprudence_chunks

FieldTypeDescription
chunk_idstringUnique chunk ID (derived from case UID + section)
case_uidstringJoin key to jurisprudence_documents.case_uid
gr_numberstringG.R. number
yearint32Decision year
legal_topicslist<string>Topic labels
civil_code_articleslist<int32>Cited Civil Code article numbers (join key to civil_code.article_number)
sectionstringSource section of the decision the chunk came from
textstringChunk text (includes a prepended case header line)

jurisprudence_documents

FieldTypeDescription
case_idstringCase title
case_uidstringStable internal ID (join key)
gr_number / year / decision_datestring / int32 / stringCase identifiers
court / division / case_typestringe.g. Supreme Court, EN BANC, Appeal
urlstringSource URL (lawphil.net)
contentstringFull decision text
content_summary / dispositive_portionstringGenerated summary and operative portion
civil_code_citationslist<struct>Structured citations into the Civil Code
legal_topics / keywordslist<string>Topic labels and keywords
chunkslist<struct>Embedded chunk records

training

FieldTypeDescription
idstringExample ID, e.g. T1-EN-RA386-ART133
trackstringTask track (e.g. simplification)
languagestringen / fil
messageslist<struct>Chat turns: {role, content, ...}
metadatastructProvenance/track metadata

article_case_index.json (auxiliary, not a config)

Top-level dict (not a table): {article_id: {total_jurisprudence_citations, top_cases, ...}}. Not loadable via load_dataset configs — load it directly:

python
import json
index = json.load(open("article_case_index.json"))

Usage

python
from datasets import load_dataset

civil_code = load_dataset("<org>/<repo>", "civil_code")["train"]
chunks     = load_dataset("<org>/<repo>", "jurisprudence_chunks")["train"]
cases      = load_dataset("<org>/<repo>", "jurisprudence_documents")["train"]
sft_train  = load_dataset("<org>/<repo>", "training")["train"]
sft_eval   = load_dataset("<org>/<repo>", "training")["validation"]

Join path for RAG: jurisprudence_chunks.case_uid → jurisprudence_documents.case_uid, and jurisprudence_chunks.civil_code_articles → civil_code.article_number.

Dataset creation

  • Statutes: Civil Code of the Philippines (Republic Act No. 386), structured into articles with hierarchy.
  • Jurisprudence: Supreme Court decisions sourced from lawphil.net, chunked and annotated with topic labels and Civil Code citations.
  • Training data: chat-format examples generated from the corpus for plain-language legal explanation (research use, civilex-thesis pipeline).

Considerations for using the data

  • Not legal advice. This is a research corpus for a student thesis; annotations, summaries, and SFT outputs are machine-generated and may contain errors.
  • Coverage is limited to the Civil Code and the scraped jurisprudence subset — not a complete corpus of Philippine law.
  • Bias: topic labels and summaries are produced by automated pipelines; verify against the source url before relying on any record.
  • Privacy: decisions are public court records; case names appear as published.

License

Dataset documentation and annotations: CC BY 4.0. Underlying statutes are laws of the Philippines; court decisions are public records sourced from lawphil.net. Attribution: Civilex thesis research project.