CoolFace
Datasetpublic

sosa123454321/persian-legal-kb

Persian Legal Knowledge Base — پایگاه دانش حقوقی فارسی A provenance-first Persian legal corpus built for retrieval-augmented and knowledge-graph (KAG) systems, not for fine-tuning knowledge into weights. Every record answers four questions a legal AI must never get wrong: is this law or just a bill? · is it still in force? · which article? · who said so? Why this dataset exists Iranian law moved in the two weeks before this dataset was built: قانون ملی توسعه هوش… See the full description on the dataset page: https://huggingface.co/datasets/sosa123454321/persian-legal-kb.

sourceHugging Faceotherupdated 13d agoView on Hugging Face
0likes56downloads
Dataset Card

Persian Legal Knowledge Base — پایگاه دانش حقوقی فارسی

A provenance-first Persian legal corpus built for retrieval-augmented and knowledge-graph (KAG) systems, not for fine-tuning knowledge into weights.

Every record answers four questions a legal AI must never get wrong: is this law or just a bill? · is it still in force? · which article? · who said so?

Why this dataset exists

Iranian law moved in the two weeks before this dataset was built:

  • —قانون ملی توسعه هوش مصنوعی was enacted 1405-05-28 (~2 weeks before verified_at).
  • —لایحهٔ حفاظت از داده‌های شخصی was approved by cabinet in 1403-04 but returned to the legal commission in 1403-07 — it is not law. Most secondary sources still describe it as if it were.
  • —The EU AI Act's high-risk deadlines were deferred by the Digital Omnibus (political agreement 2026-05-07). Any article published before May 2026 gives stale dates.
  • —Iran's base immigration statute is still from 1310 (1931) — 95 years old — with reform bills pending but unenacted.

A model fine-tuned on this material would confidently state all four of those wrong within months. A retrieval system with a validity gate will not.

Contents

filerowswhat
records.jsonl37statutes, bills, regulations, analysis — with full provenance
mcq.jsonl26graded multiple-choice questions, each linked to the record it cites
kag.json80 nodes / 93 edgesknowledge graph (see below)
kag.cypher—lossless Neo4j export of the same graph
stats.json—generated counts

15,691 characters of primary/secondary text across 25 distinct sources.

Domain coverage

domainrecordsin force**bill, not enacted**
immigration1266
ai_governance10100
startup_ip660
data_protection303
education330
ai_engineering3n/a0

6 of 10 planned domains are seeded. The remaining 4 (financial/banking, criminal procedure, labour, comparative international) are not yet collected.

Schema — records.jsonl

fieldtypenotes
idstrstable slug, e.g. mig-1310-art8
domainstrone of the 6 above
doc_typestrstatute \bill \regulation \article
jurisdictionstrIR \EU \INT
titlestrPersian
articlestr?e.g. ماده ۲۴ بند ۱۰
enactedstr?ISO date, Jalali-converted where known
textstrthe passage itself
`legal_status`str**in_force \bill_not_enacted \repealed \n_a**
source_typestrstatute \official \legal_news \gov_news \lawfirm \academic \intl_analysis \commercial
`reliability`int 1–55 = statute text, 4 = official agency/academic, 3 = legal news, 2 = law-firm blog, 1 = commercial/SEO
source_urlstr
licensestrpublic_domain_gov \cc-by-4.0 \all_rights_reserved \unknown
topicslist[str]Persian keyword tags
exam_readyboolsafe to turn into a quiz question
verified_atstrISO date the source was checked
char_countint
caveatstr?read this before citing — staleness, unverified link, low-confidence mapping
cross_refstr?id of a related record in another jurisdiction

Reliability distribution: 5×12, 4×5, 3×17, 2×3, 1×0.

Schema — mcq.jsonl

fieldnotes
idmcq-001 … mcq-026
q, options[4], answer (index), whywhy quotes the governing article
`answer_text`the correct option as a string — use this for grading, not answer, so per-user option shuffling in a bot cannot break it
citesrecord id the question is grounded in
difficulty1–4
legal_status, jurisdiction, source_url, source_title, verified_atcopied from the cited record

26 questions: immigration 8, aigovernance 6, startupip 5, education 5, data_protection 2.

The knowledge graph (kag.json)

Nodes: Law(8) Article(31) Bill(4) Amendment(2) Authority(8) Jurisdiction(2) Domain(6) RiskTier(8) Concept(11)

Edges: has_article amends supersedes proposes_amendment_to pending_before enacted_by governed_by in_domain maps_to defines cites applies_to in_risk_tier

This is what makes multi-hop legal questions answerable. Example — «what happened to ماده ۱۵?»

art:1310-15  ←proposes_amendment_to—  bill:reform-art15-16  [🟥 bill_not_enacted]
     ↑has_article
law:ir-entry-residence-1310  ←amends—  amd:1336-band-d-art13  [✅ in_force]

and the residency ladder art:bmo-24 →cites→ art:bmo-23 →cites→ art:bmo-22 (10-year requires 7-year requires 3-year).

Cross-jurisdiction mappings are deliberately marked `mapping_confidence: low`. Iran's four risk tiers (کم‌مخاطره / مخاطره محدود / پرمخاطره / بسیار پرمخاطره) turn on religious and ethical values plus social manipulation; the EU's four tiers turn on fundamental rights plus the Annex III use-case list. They are not 1:1 and no consumer of this dataset should treat them as such.

How to use this correctly

python
import json
recs = [json.loads(l) for l in open("records.jsonl", encoding="utf-8")]

for r in recs:
    if r["legal_status"] == "bill_not_enacted":
        # MUST be labelled as a proposal, never as law
        ...
    if r["reliability"] <= 2:
        # blog/SEO source — corroborate before quoting
        ...

Do not train a model to memorise text. Do index it and return it with legal_status + source_url attached.

Evaluation

mcq.jsonl doubles as a retrieval-and-grounding test set: a system passes a question only if it retrieves the record named in cites and propagates that record's legal_status into its answer. Reporting accuracy without checking legal_status propagation hides the single most dangerous failure mode in legal AI.

Known limitations — read before use

  1. 1.6 of 10 domains only. Financial, criminal procedure, labour and comparative international law are uncollected.
  2. 2.No books, no videos. The original scope called for ~10 articles + ~10 books + ~10 videos per domain. This is the article/statute layer only.
  3. 3.Iranian source domains are unreachable from the build sandbox. adadai.ir, dadbazar.com, tehranatba.ir, chesafari.com, mashhad-lawyer.com, cartesabz.net and the official ekhtebar.ir PDF all returned HTTP 000 during link verification. Text for those was extracted from search-engine cache and is marked with a caveat. Re-verify from a normal network before publishing.
  4. 4.`adadai.ir/landing/ai-book` was a banner ad, not an organic result. Excluded as untrustworthy.
  5. 5.Statute text is abridged. Passages are the operative sentences, not full articles. Never present these as complete legal text.
  6. 6.Jalali dates are given as ISO where the conversion is unambiguous; 1310-02-19 style entries for very old statutes should be treated as approximate.
  7. 7.Volume is tiny (15.7 KB of text). This is a schema and pipeline proof, sized so that the validity-gating logic can be verified end to end. It is not yet a training corpus.

Regenerating

bash
python3 build_dataset.py              # → data/records.jsonl, data/mcq.jsonl, data/stats.json
python3 blueprints/a_retrieval_only.py --selftest
python3 blueprints/b_hybrid_rag.py     --selftest
python3 blueprints/c_kag_graph.py      --build

All stdlib, no dependencies. Runs on 2 CPU cores / 1 GB RAM.

Licensing

Mixed, per record. public_domain_gov (Iranian statute text and government publications) and cc-by-4.0 (arXiv, CASRAI) records are freely reusable. all_rights_reserved records are short quoted excerpts from legal news outlets included for research and criticism; contact the publisher before redistributing commercially. Filter on the license field.

Disclaimer

این مجموعه داده اطلاعات حقوقی است، نه مشاورهٔ حقوقی. This dataset is legal information, not legal advice.