pathnirvana commited on
Commit
6c4945d
·
verified ·
1 Parent(s): ad37072

Add README.md

Browse files
Files changed (1) hide show
  1. README.md +72 -0
README.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - si
4
+ - pi
5
+ license: cc-by-4.0
6
+ task_categories:
7
+ - image-to-text
8
+ tags:
9
+ - ocr
10
+ - sinhala
11
+ - pali
12
+ - historical-documents
13
+ - buddhism
14
+ pretty_name: Sinhala and Pali OCR (old prints)
15
+ size_categories:
16
+ - 1K<n<10K
17
+ ---
18
+
19
+ # Sinhala and Pali OCR: old prints
20
+
21
+ These are scanned pages of Sinhala and Pali books, mostly Buddhist texts printed between the 1870s and 2000s, each paired with a corrected transcription. They were collected to fine-tune a page-level OCR model (e.g. LightOnOCR-2) for old Sinhala-script print, made by [Path Nirvana](https://pitaka.lk).
22
+
23
+ ## Target format
24
+
25
+ Each target is the page text as UTF-8 Unicode Sinhala (NFC):
26
+
27
+ - **Lines:** one printed line becomes one line of text. A word split by the printer across a line end keeps its hyphen (`word-\n`).
28
+ - **Paragraphs:** a blank line separates paragraphs, headings, verses and footnotes.
29
+ - **Bold:** printed bold is marked `**bold**`.
30
+ - **Footnotes:** reference numbers are superscript digits (¹ ² ³).
31
+ - **Left out:** running headers, page numbers and printer's footer codes.
32
+
33
+ The `prompt` column says when a target falls short of this format. The image is then given to the model with that prompt as a text instruction, so that pages with no prompt keep the full format:
34
+
35
+ | prompt | meaning |
36
+ |---|---|
37
+ | null | full format |
38
+ | `nobold` | the source transcription has no bold markup (the `acts` pages) |
39
+
40
+ `crop` is `[x0, y0, x1, y1]` to apply to the image before use, or null for the full page. A crop is used where the page holds text that the transcription lacks.
41
+
42
+ ## Files
43
+
44
+ The data is in Parquet shards, `data/{train,validation,test}-*.parquet`, with one row per page. The columns are `id`, `image` (the original JPEG bytes), `crop`, `text`, `prompt`, `source`, `stratum`, `lang` and `year`.
45
+
46
+ ```python
47
+ from datasets import load_dataset
48
+ ds = load_dataset("pathnirvana/sinhala-pali-ocr", split="train")
49
+ row = ds[0]
50
+ img = row["image"].crop(row["crop"]) if row["crop"] else row["image"]
51
+ ```
52
+
53
+ ## Sources
54
+
55
+ | source | pages | images | text |
56
+ |---|---|---|---|
57
+ | `bjt` | 3,301 | Buddha Jayanti Tripitaka (Sri Lanka government edition, 1960s–80s), Pali and facing Sinhala translation | typed text from [tipitaka.lk](https://tipitaka.lk). Printed line breaks were recovered by aligning Tesseract line boxes. 30 pages per volume and language |
58
+ | `pitaka-books` | 4,795 | old scanned prints in the [tipitaka.lk library](https://tipitaka.lk/library) | corrected editions from [pitaka.lk/books](https://pitaka.lk/books), cut into pages by alignment. At most 150 pages per print, from 32 books |
59
+ | `acts` | 410 | Sri Lankan acts, 1981–1989 | the pre-2000 pages of [avishadilhara/sinhala-ocr-lk-acts-1010](https://huggingface.co/datasets/avishadilhara/sinhala-ocr-lk-acts-1010) (CC BY 4.0), with headers removed |
60
+ | `opus-lib` | 92 | single pages of library books printed 1870s–1980s | transcribed by Claude Opus. Not human-checked, so expect a few % character errors and imperfect bold |
61
+
62
+ The page transcriptions come from corrected editions, which can differ from the printed page in places: spelling, punctuation, small edits. Expect a floor of about 1–2% character differences.
63
+
64
+ ## Splits
65
+
66
+ - **test:** whole books never trained on. These are BJT volumes 12, 29 and 47, and the pitaka.lk books suvisi-gunaya (1964 print) and chathurarya-sathya (2007).
67
+ - **test, other sources:** the acts follow the source dataset's split, and 10% of the `opus-lib` pages are test.
68
+ - **validation:** a small set of pages from all sources, used to track loss.
69
+
70
+ ## Credits
71
+
72
+ The acts pages come from *Sinhala OCR – Sri Lankan Acts Dataset* by avishadilhara (CC BY 4.0). The BJT text is from tipitaka.lk, and the book texts and scans are from pitaka.lk and the tipitaka.lk library.