File size: 1,857 Bytes
a9cf663 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
---
license: mit
---
# Dataset Title: OCR-to-JSON Information Extraction
## Project Overview
This dataset is specifically designed for fine-tuning Large Language Models (LLMs) to perform structured data extraction from Optical Character Recognition (OCR) outputs. The primary objective is to convert raw, unstructured text strings—often containing noise, misalignments, and formatting inconsistencies—into valid, machine-readable JSON objects.
---
## Dataset Specifications
| Attribute | Description |
|------------|-------------|
| **File Format** | JSON Lines (`.jsonl`) |
| **Task Type** | Supervised Fine-Tuning (SFT) / Instruction Tuning |
| **Language** | English |
| **Encoding** | UTF-8 |
---
## Data Structure
Each entry in the dataset consists of a single JSON object per line with two primary fields:
- **`prompt`** – The raw OCR text extracted from a document (e.g., invoices, receipts, or forms).
- **`completion`** – The corresponding ground-truth information structured as a nested JSON dictionary.
---
## Data Field Definitions
### **Prompt Field**
Represents the "source" text.
- Includes headers, dates, numerical values, and currency symbols as recognized by standard OCR engines.
- May contain line breaks (`\n`) and varied spacing representative of physical document layouts.
### **Completion Field**
Represents the "target" output.
Follows a strict schema containing keys such as:
- `invoice_number`
- `date`
- `vendor_name`
- `total_amount`
- `line_items` (list of objects)
---
## Usage Instructions
### Requirements
- Python 3.10+
- `datasets` (Hugging Face)
- `transformers` library
### Loading the Dataset
```python
from datasets import load_dataset
dataset = load_dataset("json", data_files="real_dataset.jsonl", split="train")
print(dataset[0])
|