nepali-proofreader / README.md
w4ashabii's picture
Upload dataset
17c8209 verified
|
Raw
History Blame Contribute Delete
12.3 kB
metadata
license: mit
task_categories:
  - text-generation
language:
  - ne
tags:
  - text-editing
pretty_name: Nepali OCR Proofreading Dataset
size_categories:
  - 100K<n<1M
dataset_info:
  features:
    - name: corrupted
      dtype: string
    - name: clean
      dtype: string
  splits:
    - name: train
      num_bytes: 290269606
      num_examples: 974341
    - name: test
      num_bytes: 4596375
      num_examples: 9999
  download_size: 146440610
  dataset_size: 294865981
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
      - split: test
        path: data/test-*

Nepali OCR Proofreading Dataset (Devanagari)

Dataset Summary

A Nepali-only (Devanagari script) text-correction dataset built for fine-tuning a small language model (target: HimalayaGPT 0.5B) as an OCR proofreader. Each example is a (corrupted, clean) pair: corrupted is Nepali text with OCR/handwriting-style errors (character confusions, missing matras, merged/split words, transposed or dropped characters), and clean is the correct text it should map to.

The set is compiled from six sources — a printed-OCR corpus, a dictionary, a news corpus, a synthetic handwriting-confusion model, a names list, and a large web-text corpus — deliberately sized and balanced rather than used in raw form, per the curation notes below.

  • Final training set: 1,000,000 pairs (train.jsonl)
  • Test set: 10,001 pairs (test.jsonl) — the untouched, official RoundTripOCR-nepali test split
  • Format: JSON Lines, two fields per row: corrupted, clean
  • Script / language: Nepali written in Devanagari (ne)

Supported Tasks

  • Text editing / grammatical-and-OCR error correction: given noisy OCR/handwriting-style Devanagari text, produce the corrected text. Intended for sequence-to-sequence or causal LM fine-tuning (corrupted → clean).

Languages

Nepali (ne), Devanagari script only. Two supplements deliberately mix in a small amount of English:

  • The code-switching rows insert English loanwords (e.g. proper nouns, institution names) into otherwise-Nepali sentences, mirroring real Nepali documents that code-switch this way.
  • All other sources were filtered to be Devanagari-dominant (see per-source notes below); no general-purpose English text is included.

Dataset Structure

Data Instances

{"corrupted": "गाइडले हामीलाई सिंहका खुद्दाको चिह देखाए।", "clean": "गाइडले हामीलाई सिंहका खुट्टाको चिह्न देखाए।"}

Data Fields

Field Type Description
corrupted string Nepali text with OCR/handwriting-style errors
clean string The correct Nepali text

Data Splits

Split Rows Source
train 1,000,000 Compiled and size-capped, see composition below
test 10,001 Official cfilt/RoundTripOCR-nepali test split, untouched

The official RoundTripOCR-nepali validation split (10,001 rows) was folded into train rather than shipped separately — only a train/test split is provided here.

Dataset Creation

Curation Rationale

The dataset was built to avoid three failure modes common in synthetic OCR-correction data: (1) source-specific artifacts (e.g. font-driven error patterns from one rendering pipeline) dominating the mix, (2) a single supplement (a names list) so large it would have swamped every other signal, and (3) an unrealistically huge final size for a 0.5B-model fine-tune. All three are addressed explicitly in the pipeline below.

Source Data

1. cfilt/RoundTripOCR-nepali (Hugging Face) — the base corpus. Printed-text OCR round-trip pairs across 49 distinct fonts.

  • Raw: 2,970,148 train rows
  • Deduplicated + min-length filtered: 2,197,411
  • Font-balanced (capped at the per-font median, 44,931): 1,965,156
  • Numeral-only/punctuation-only diffs downsampled: 1,965,156 substantive + kept-as-is minority classes
  • Length-bucket balanced (short/medium/long): 78,675 rows
  • Plus 11,801 controlled identity examples (clean == clean, for anti-over-correction / copy-bias balance) and 184,631 word-level pairs extracted from the sentence-level diffs (higher signal-to-noise)
  • Plus the official 10,001-row validation split, folded in
  • Combined "RoundTripOCR core": 284,528 rows in the final set

2. w4ashabii/Nepali_dictionary (Hugging Face) — dictionary definition sentences, used only to widen the vocabulary pool that the synthetic handwriting-confusion model draws from (not a standalone supplement).

3. ashokpant/nepali-news-dataset-large (Kaggle) — real news articles across 20 categories (Sports, Politics, Economy, Entertainment, etc.). 6,973 articles retrieved; category sizes were highly uneven (Opinion: 34,308 sentences vs. Migration: 1,239) so each category was capped at the per-category median (4,931 sentences) before use, yielding an 80,077-sentence pool. Combined with the dictionary sentences above to form the clean-text pool for handwriting-style corruption.

4. Synthetic handwriting-confusion model — a character-level confusion map (consonant look-alikes, independent vowels, matras, nasalisation marks, Devanagari digits) plus duplication/transposition/ word-drop operators, applied to the combined dictionary+news clean-text pool. 129,723 pairs in the final set.

5. nischallal/nepali-name-dataset-in-devanagari-with-gender (Kaggle, sourced from Nepal's Election Commission voters list) — person names in Devanagari. 17,998,877 raw rows deduplicated to 6,220,952 distinct names (voter rolls repeat common names for thousands of different people). Each distinct name was run through the handwriting confusion model (elevated edit rate, tuned for short tokens) to produce a corrupted/clean pair; 32,387 came out identical and were kept as identity examples. This produced 6,220,952 candidate pairs — far more than any other single source — so for the final set, a random sample of 200,000 (20% of the final total) was drawn rather than using the source in full; see Discussion of Biases below.

6. himalaya-ai/nepali-corpus-compile (Hugging Face) — a large (~31.3M document, 30.6GB) general Nepali web-text corpus, used as filler to reach the target dataset size without over-representing any other single source. Streamed (not downloaded whole) and filtered to Devanagari-character ratio ≥ 0.8 per sentence, since this corpus mixes in some English. Corrupted the same way as the handwriting supplement. 370,768 pairs in the final set, all from distinct clean sentences (no sentence corrupted more than once).

7. Code-switching supplement — synthetic: English loanwords/proper nouns inserted into otherwise-Nepali sentences, then corrupted, to cover the code-switched text that appears in real Nepali documents (institution names, NGOs, place names, etc.). 14,981 pairs.

8. Domain diversity supplement — an optional slot for user-supplied domain-specific text (e.g. gazette notices); 0 rows in this build (no source files were provided).

Final Composition

Source Rows % of train
nepali-corpus-compile (filler) 370,768 37.08%
RoundTripOCR core (curated + identity + word-level + val) 284,528 28.45%
Names (Election Commission voters list) 200,000 20.00%
Handwriting supplement (dictionary + news, synthetic corruption) 129,723 12.97%
Code-switching supplement 14,981 1.50%
Domain supplement 0 0.00%
Total 1,000,000 100%

Clean-text length by source (characters):

Source Mean Min Median Max
Code-switching 87.6 15 80 550
nepali-corpus-compile 87.4 8 81 200
Handwriting 70.1 8 63 541
Names 15.3 3 15 53
RoundTripOCR core 33.2 1 14 541

Curation and Sizing Decisions

  • Names were capped, not the raw 6.2M used. A 0.5B-parameter fine-tune doesn't benefit from millions of near-duplicate person-name corrections; a 200,000-name random sample covers the space of Devanagari name-spelling OCR confusions without one source dominating training.
  • Overall size was capped at 1,000,000 rows rather than shipping every pair collected (a full uncapped run of this pipeline would exceed 30M rows) — chosen to keep fine-tuning time and compute reasonable for a 0.5B model while remaining large enough for the task.
  • No sentence in the final set was corrupted more than once to reach volume (an earlier design that re-corrupted the same clean sentences multiple times to hit volume targets was rejected during development in favor of pulling more raw text from a larger corpus instead).
  • The English mixed into nepali-corpus-compile was filtered out by a per-sentence Devanagari-character-ratio threshold (≥ 0.8), not by the corpus's own source/language metadata (which was null/ unreliable in the raw data).

Annotations

No human annotation was performed. All clean text is either (a) the original clean side of an existing OCR-pair dataset (RoundTripOCR), (b) real prose from a dictionary/news/web corpus, or (c) a real person name from a public voter-roll dataset. All corrupted text is synthetically generated by a character-level confusion model (for sources b and c) or comes from the source dataset's own OCR pipeline (for source a).

Considerations for Using the Data

Discussion of Biases

  • Names are still 20% of the dataset by design, and all derive from a voters-list source — this means the name-spelling distribution reflects Nepal's electoral roll demographics, not a general population or naming-convention sample. A model trained on this may proofread common electoral-roll name spellings better than rarer or newer name forms.
  • The nepali-corpus-compile filler (37% of the set) determines a large share of the model's general vocabulary exposure, since it was sized specifically to fill the volume gap after other sources were pooled — its own topical/stylistic composition (a general web corpus) is inherited by the final set.
  • Corruption is synthetic, not real scanned-document OCR output (except for the RoundTripOCR-core portion, which does derive from an actual OCR pipeline across 49 fonts). The handwriting/names/corpus- compile portions use a hand-built character-confusion model, which may not fully reflect the error distribution of any specific real-world OCR engine or handwriting style.
  • Domain diversity supplement is empty (0 rows) in this build — no gazette/legal/form-style text was included, so domain-specific vocabulary in those registers is not represented.

Other Known Limitations

  • Fields beyond corrupted/clean (e.g. source font, name gender, news category) were used during curation but are not preserved in the final JSONL — only the two-field pair ships.
  • License status of upstream sources varies and was not independently re-verified per source at compile time — see Licensing Information.

Licensing Information

This compiled dataset draws on multiple upstream sources with their own, independently-set licenses:

  • cfilt/RoundTripOCR-nepali (Hugging Face)
  • w4ashabii/Nepali_dictionary (Hugging Face)
  • ashokpant/nepali-news-dataset-large (Kaggle)
  • nischallal/nepali-name-dataset-in-devanagari-with-gender (Kaggle)
  • himalaya-ai/nepali-corpus-compile (Hugging Face)

Check each source's own license/terms before redistributing this compiled dataset or using it commercially — license was not asserted here because it was not independently re-verified per source at compile time.

Citation

If you use this dataset, please cite the upstream sources listed above in addition to this compilation.

Dataset Curators

Compiled via a Jupyter notebook pipeline (01_dataset_curation_*.ipynb) that loads, filters, balances, and merges the sources described above. See the notebook for the exact, reproducible curation steps and all tunable constants (FINAL_DATASET_SIZE, NAME_TARGET_FRACTION, per-source filters and caps).