ipfs_germany_laws_ir
收藏资源简介:
该数据集是德国法律信息检索(IR)的研究版本,打包为country-laws-ir-graphrag/v1格式,源自endomorphosis/ipfs_germany_laws的快照。它专门用于法律文本的检索、BM25和向量搜索以及图检索增强生成(GraphRAG)场景。数据集包含112,963篇规范文档(文章级别),每个文档由唯一的entry_cid标识。数据字段涵盖法律元数据(如管辖权、语言、法律文书编号和标题、文章编号、标题、正文、来源URL、快照日期、覆盖范围、许可证等)。索引结构包括:BM25词汇索引(510,018个术语,10,076,902个倒排记录)、向量嵌入(112,963个384维向量,使用thenlper/gte-small模型)、属性图(131,340个节点,1,508,300条边)以及邻接表。BM25使用Okapi BM25算法(k1=1.2, b=0.75),标题权重为5,正文权重为1。图结构包含三种边类型:BM25邻居边(基于相似度得分和匹配术语)、文章与法律之间的ARTICLE_OF边,以及当存在时标识符边(如ELI)。所有数据以Zstandard压缩的parquet分片存储。该数据集仅供研究使用,不构成法律建议,官方德国法律公报优先。
This dataset is a research version of German legal information retrieval (IR), packaged as country-laws-ir-graphrag/v1 format, derived from a snapshot of endomorphosis/ipfs_germany_laws. It is specifically designed for legal text retrieval, BM25 and vector search, and Graph Retrieval-Augmented Generation (GraphRAG) scenarios. The dataset contains 112,963 normative documents (at article level), each identified by a unique entry_cid. Data fields include legal metadata (e.g., jurisdiction, language, legal instrument number and title, article number, title, body, source URL, snapshot date, coverage, license, etc.). The index structure includes: BM25 lexical index (510,018 terms, 10,076,902 inverted records), vector embeddings (112,963 384-dimensional vectors using the thenlper/gte-small model), property graph (131,340 nodes, 1,508,300 edges), and adjacency list. BM25 uses Okapi BM25 algorithm (k1=1.2, b=0.75) with title weight 5 and body weight 1. The graph structure contains three edge types: BM25 neighbor edges (based on similarity scores and matching terms), ARTICLE_OF edges between articles and laws, and identifier edges (e.g., ELI) when present. All data is stored as Zstandard-compressed parquet shards. This dataset is for research purposes only, does not constitute legal advice, and official German legal gazettes take precedence.
数据集概述
Germany legislation IR (CID-keyed sparse GraphRAG) 是一个面向德国法律文本的研究型信息检索数据集,用于支持包括BM25、向量检索和图检索在内的多种检索范式。
基本信息
- 数据集名称: Germany laws IR (CID-keyed GraphRAG)
- 许可证: 其他(非标准许可)
- 任务类别: 文本检索
- 标签: 法律、德国、GraphRAG、BM25、研究等
- 声明: 数据集为研究快照,非法律建议;官方公报或权威来源优先于本语料库
数据规模
| 项目 | 数值 |
|---|---|
| 法律条文(语料单元) | 0 |
| 文章条目(语料单元) | 112,963 |
| 规范文档总数 | 112,963 |
| BM25 词项数 | 510,018 |
| BM25 倒排记录数 | 10,076,902 |
| 图节点数 | 131,340 |
| 图边数 | 1,508,300 |
| 向量数 | 112,963 × 384维(thenlper/gte-small 嵌入) |
数据内容与结构
规范字段(Canonical fields)
包括 entry_cid、law_cid、record_type、jurisdiction、language、instrument_id、instrument_title、article_number、article_title、title、body、source_url、snapshot_date、coverage、license、collector、source_dataset、source_revision。
单元选取策略:优先使用文章/章节级条目;当 articles.parquet 为空时回退到法律文件级。
主键与索引
- 主键为
entry_cid(CIDv1 raw sha2-256);document_index仅作为分片指针,非身份标识。 - 数据以 Zstandard 压缩的 Parquet 分片形式存储,每个分片最多 4,096 行。
- 索引文件包括:
bm25_keyword_shards.parquet:词项范围 → BM25 posting 分片vector_chunks.parquet:语义路由质心corpus_chunks.parquet:文档范围 → 语料分片- 图节点、图边及出入邻接表分片
检索与图模型配置
- BM25: Okapi 参数 k1=1.2,b=0.75,标题权重=5,正文权重=1,采用 FTS5 unicode61 风格分词器。
- 图结构: 每个
entry_cid对应一个节点,另有面向法域、语言、法律文件、来源和状态的面状节点。边类型包括:BM25_NEIGHBOR_OF(k=8):携带分数和匹配词项的邻居关系边ARTICLE_OF:文章 → 所属法律的结构边IDENTIFIED_BY_ELI/IDENTIFIED_BY:仅当源数据中存在这些标识符时生成
配置与数据文件
数据集包含以下 config,每个 config 对应不同的数据模块:
| 配置名 | 对应路径 |
|---|---|
| corpus | data/corpus/*.parquet |
| bm25_documents | data/bm25/documents/*.parquet |
| bm25_postings | data/bm25/postings/*.parquet |
| bm25_keyword_index | indexes/bm25_keyword_shards.parquet |
| vectors | data/vectors/*.parquet |
| vector_meta_index | indexes/vector_chunks.parquet |
| graph_nodes | data/graph/nodes/*.parquet |
| graph_edges | data/graph/edges/*.parquet |
| graph_outgoing_adjacency | data/graph/adjacency/outgoing/*.parquet |
| graph_incoming_adjacency | data/graph/adjacency/incoming/*.parquet |
查询方式(示例命令)
- BM25检索:
python scripts/query_country_laws_hf.py --local-dir . bm25 "constitution" --top-k 10 - 向量检索:
python scripts/query_country_laws_hf.py --local-dir . vector "money laundering" --top-k 10 - 图邻居查询:
python scripts/query_country_laws_hf.py --local-dir . graph neighbors <entry_cid>
来源与溯源
- 上游数据来源为
endomorphosis/ipfs_germany_laws(修订版62477e216917df268f186972ef49581b02144156)。 - 上游收集方及官方许可证信息保持不变。
- CIDs 仅标识本地内容,不证明公共 IPFS 固定状态。




