Text2Receipt
收藏资源简介:
Text2Receipt是一个希伯来语合成数据集,用于文本生成任务,旨在将杂乱的自由文本希伯来语收入记录转换为完整、有效的以色列财政文档(如收据和税务发票)。该数据集通过基于规则的生成流程和LLM释义层创建,确保地面真实标签精确无误。生成过程模拟现实场景,包括类别、发行方状态、文档类型等采样,并严格编码以色列财政规则(如增值税率、税号校验算法)。数据集包含四个核心字段:raw_text(杂乱的希伯来语自由文本,作为模型输入)、parse(结构化的解析对象,作为预测目标)、completed(完整财政文档)和meta(元信息)。总规模约10,000个样本,划分为训练集(7,200行)、验证集(900行)、同分布测试集(900行)和分布外测试集(1,000行),后者用于测试词汇泛化能力。探索性数据分析验证了规则一致性和释义层效果(约17.2%样本经过LLM改写)。该数据集适用于训练和评估NLP模型,特别是从非结构化文本到结构化财政文档的信息提取和生成任务。
Text2Receipt is a Hebrew synthetic dataset for text generation tasks, designed to convert messy free-text Hebrew income records into complete and valid Israeli fiscal documents (such as receipts and tax invoices). The dataset is created through a deterministic, rule-based generation process with an added bounded large language model (LLM) paraphrasing layer to ensure precise ground truth labels. The generation process simulates real-world scenarios, including sampling of categories, issuer status, document types, customer types, years, payment methods, and amounts, and strictly encodes Israeli fiscal rules such as VAT rates (0% for exempt dealers, 17% for authorized dealers in 2024, and 18% after reform in 2025-2026), trigger conditions for allocation numbers (`מספר הקצאה`), and the check digit algorithm for Israeli 9-digit tax IDs. The dataset includes four core fields: `raw_text` (messy Hebrew free text as model input), `parse` (structured parsing object containing customer, items, document type, amount basis, payment, date, currency, etc., as model prediction target), `completed` (complete fiscal document determined by the generator, including issuer, line items, subtotals, VAT, total, and allocation number), and `meta` (metadata including data pool, category, year, issuer status, whether paraphrased, etc.). The total size is approximately 10,000 samples, divided into training set (7,200 rows), validation set (900 rows), in-distribution test set (900 rows), and out-of-distribution test set (1,000 rows). The out-of-distribution test set uses a completely disjoint vocabulary entity pool from the training set, specifically designed to test the models vocabulary generalization ability. Exploratory data analysis verifies the rule consistency of the data generator, structural integrity of the out-of-distribution pool, and the effect of the paraphrasing layer (approximately 17.2% of samples are rewritten by LLM while 100% preserving key facts such as amounts and customer names). The dataset is suitable for training and evaluating natural language processing models, particularly for information extraction and generation tasks from unstructured text to structured fiscal documents.
数据集概述
数据集名称:Text2Receipt
语言:希伯来语(he)
许可协议:MIT
任务类别:文本生成
标签:希伯来语、收据、发票、以色列税务、合成数据、结构化输出
数据规模:1K 到 100K 条记录
数据内容与结构
该数据集旨在将杂乱的自由文本希伯来语收入笔记转换为合规、完整的以色列财政文档(收据和税务发票)。数据为合成生成,包含以下字段:
- raw_text:模型输入,即杂乱的非结构化希伯来语笔记。
- parse:模型目标,包含客户、项目、文档类型、金额基础、支付方式、日期、货币等结构化信息。
- completed:确定性生成的完整文档,包括发行人、行项、小计、增值税、总额、分配号等。
- meta:元数据,记录数据池、类别、年份、发行人状态、是否经过改写等信息。
数据生成过程
数据通过确定性规则生成器结合有限的大语言模型改写层合成产生,确保真实标签准确无误。主要生成流程包括:
- 场景采样:从两个不重叠的实体/模板池(A 为训练家族,B 为分布外家族)中抽取类别、发行人状态、文档类型、客户类型、年份、支付方式和金额。
- 规则生成:确定性生成器输出完美的真实标签,包括
parse对象和completed文档。complete()函数自动完成所有税务计算(增值税、分配号、以色列身份证校验位)。 - 希伯来语渲染:生成模板化的、故意杂乱的希伯来语
raw_text作为模型输入。 - 有限改写:约 17% 的行通过指令模型改写
raw_text,并设置事实保留守卫,拒绝任何丢失金额或客户名称的改写。
编码的以色列税务规则
- 增值税:豁免经销商为 0%;授权经销商为 17%(2024年)或 18%(2025-2026年,2025年1月改革)。
- 分配号:当授权经销商向企业客户开具税务发票且小计达到年度门槛(2024-2026年从 25,000 降至 20,000 再降至 10,000 新谢克尔)时,必须包含分配号。
- 身份证校验位:所有发行人/客户的税务 ID 均符合以色列 9 位身份证算法。
数据划分
| 划分 | 行数 | 数据池 | 用途 |
|---|---|---|---|
| train | 7,200 | A | 训练 |
| validation | 900 | A | 调优 |
| iid_test | 900 | A | 分布内测试 |
| ood_test | 1,000 | B | 词汇泛化测试 |
探索性数据分析(EDA)
基于 10,000 行数据进行了探索性分析,主要发现包括:
| 支柱 | 结果 |
|---|---|
| 生成器验证 | 0 次硬规则违反(增值税/身份证/脚本);分配号规则在 99.97% 的行中成立。 |
| 增值税日历 | 发行人状态与增值税率之间的 Cramers V = 1.00,2025年1月从 17% 到 18% 的改革精确匹配。 |
| 分布外完整性 | 池 A 和 B 在词汇层面完全不相交(Jaccard 系数为 0),但分布上相同(小计 KS 检验 p = 0.41)。 |
| 类别经济学 | 小计 η² 按类别为 0.185;类别与增值税率之间的 V = 0.24,实际为豁免经销商市场份额效应。 |
| 改写层 | 17.2% 的行经大语言模型改写;金额保留率为 100%,客户名称在改写行中保留率为 100%。 |
模型局限性分析 v1.0
- 在 10,000 新谢克尔分配线附近无阈值聚集现象。
- 支付方式独立于金额和类别(V < 0.05)。
- 类别与增值税的关联仅由豁免份额驱动(在授权经销商内,17/18 的划分是平坦的)。
- 约 7% 的行包含拉丁字符(真实的品牌/产品名称,非数据污染)。
可视化图表
- Categorical Dashboard
- Amount Distribution
- Verification Battery
- VAT Calendar
- Cramers V Heatmap
- Subtotal By Category
- Gap Bunching
- VAT Composition By Category
- OOD Disjointness
- Pool Distribution Match
- Paraphrase Analysis
- t-SNE Raw Text
使用示例
python from datasets import load_dataset
ds = load_dataset("yonilev/Text2Receipt") print(ds["train"][0]["raw_text"]) # 模型输入 print(ds["train"][0]["parse"]) # 模型目标





