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