HierLegalBERT
收藏资源简介:
HierLegalBERT是一个专门用于印度最高法院判决分析的法律自然语言处理数据集。该数据集基于OpenNyaya语料库(1950-2023年),包含超过19,000个印度最高法院判决文档,总计约1.79亿词元。数据集的核心特点是完整保留了判决文档的层级结构:每个判决被系统性地划分为五个结构部分——序言(案件标题、法庭信息)、事实(事件叙述)、论点(律师陈述)、分析(法庭推理)和命令(最终处置)。数据预处理流水线通过自动化的规则和正则表达式方法,为每个句子生成丰富的标注信息,包括词元序列、词元类型(法律术语、数字、普通文本)、条款分类标签(10个类别如保释、处罚、管辖权等)以及判决结果标签(驳回/允许/部分允许)。此外,数据集还支持多法官意见中的矛盾对挖掘。该数据集专门设计用于支持四项NLP任务的联合训练:命名实体识别(识别当事人、法庭、IPC条款、日期、引用等实体)、条款分类、判决结果预测和矛盾检测。通过引入脚本类型嵌入、章节类型位置编码和不确定性加权多任务学习等创新机制,HierLegalBERT为印度法律NLP研究提供了一个结构完整、标注丰富、可复现的基准数据集。
HierLegalBERT is a legal natural language processing (legal NLP) dataset specifically designed for the analysis of judgments from the Supreme Court of India. Built upon the OpenNyaya corpus spanning 1950 to 2023, it contains over 19,000 judgment documents from the Indian Supreme Court, with a total of approximately 179 million tokens. A core characteristic of this dataset is that it fully retains the hierarchical structure of the original judgment documents: each judgment is systematically divided into five standardized structural sections: preamble (case title, court information), facts (event narration), arguments (lawyers' submissions), analysis (court's reasoning), and orders (final dispositions). The dataset's preprocessing pipeline employs automated rule-based and regular expression methods to generate rich annotation information for each sentence, including token sequences, token types (legal terms, numerals, plain text), clause classification labels (10 categories including bail, penalty, jurisdiction, etc.), and judgment outcome labels (dismissed, allowed, partially allowed). Furthermore, the dataset supports the mining of contradictory opinion pairs across multiple judicial opinions. This dataset is specifically engineered to support joint training for four core NLP tasks: Named Entity Recognition (NER) (identifying entities such as parties, courts, IPC clauses, dates, citations, etc.), clause classification, judgment outcome prediction, and contradiction detection. By introducing innovative mechanisms including script type embeddings, section-type positional encoding, and uncertainty-weighted multi-task learning, HierLegalBERT provides a structurally complete, richly annotated, and reproducible benchmark dataset for Indian legal NLP research.
HierLegalBERT 数据集概述
基本信息
- 数据集名称: HierLegalBERT (Hierarchical Legal BERT for Indian Supreme Court Judgment Analysis)
- 语言: 英语 (en)
- 领域: 法律数据、判决书 (legal-data, judgements)
- 许可证: MIT License
数据集来源与构成
- 语料库: OpenNyaya Corpus (1950–2023)
- 原始文件: 32,877 份判决书文档
- 有效标注文档: 约 19,000–22,000 份
- 总词元数: 约 1.79 亿
- 判决分布: 驳回 (dismissed) 约 60%,支持 (allowed) 约 35%,部分支持 (partly allowed) 约 5%
- 矛盾检测对: 约 870 个银标签句子对,来自 211 份多法官判决
数据结构
数据集经过管道处理后输出为 JSONL 格式(train.jsonl 和 val.jsonl),每个文档包含:
- doc_id: 文档唯一标识
- preamble: 案件名称、日期、上诉编号、引用的法律条文
- sections: 按 5 个结构章节组织的句子列表,每个句子包含文本、词元、词元类型 ID、子句标签
- judgment_label: 判决标签(0 或 1)
- judge_opinions: 法官意见
- primary_judge: 主审法官
文本结构章节
| 章节 ID | 章节名称 | 描述 |
|---|---|---|
| 0 | Preamble | 案件标题、法庭、管辖权、上诉编号 |
| 1 | Facts | 事件叙述、当事人、背景 |
| 2 | Arguments | 律师陈述、提出的争议点 |
| 3 | Analysis | 法院推理、先例引用 |
| 4 | Order | 最终处理、费用、指示 |
子句分类(10 类)
- bail(保释)、penalty(刑罚)、jurisdiction(管辖权)、liability(责任)、prosecution_withdrawal(起诉撤回)、tax_assets(税务资产)、constitutional(宪法)、evidence(证据)、precedent(先例)、other(其他)
数据集用途
该数据集支持四项联合任务,训练方式为多任务学习:
- NER(命名实体识别): BIO 标签标注,包括当事人、法院、IPC 条文、日期、引证
- 子句分类: 对每个句子进行 10 类子句分类
- 判决预测: 二元分类(驳回/支持)
- 矛盾检测: 三分类(矛盾/蕴含/中立)
训练设置
- 训练/验证划分: 分层 85/15 划分(按判决标签分层)
- 最大句子数: 每份文档 30 句
- 最大词元数: 每句 128 个词元
- 批量大小: 有效批量 8(BATCH_SIZE=4 × ACCUM_STEPS=2)
- 混合精度: fp16
- 梯度检查点: 在 BERT 编码器上启用
- 早停: 耐心值=3,依据验证损失停止




