Skip to content

feat(data): real Tashkeela++ fetcher via HuggingFace Hub - #1

Open
ronaldtse wants to merge 2 commits into
mainfrom
feat/tashkeela-fetcher
Open

feat(data): real Tashkeela++ fetcher via HuggingFace Hub#1
ronaldtse wants to merge 2 commits into
mainfrom
feat/tashkeela-fetcher

Conversation

@ronaldtse

Copy link
Copy Markdown

Summary

  • Replaces env-var placeholder fetcher with a real Python script that knows the canonical HuggingFace dataset locations.
  • Primary: Misraj/Sadeed_Tashkeela (gated, ~1M chunks of cleaned Tashkeela). Fallback: community-datasets/tashkeela (GPLv2, raw book text that the data module cleans).
  • Streams parquet → text, validates line lengths, atomic writes, clear error on gated-repo auth failure.

Wiring

  • scripts/fetch_data.py --task rababa_arabic [--fallback] [--max-samples N] [--out-dir DIR]
  • Writes to <out_dir>/tashkeela_plus_plus.txt (default data/raw/), which the existing RababaArabicData module already reads.
  • Adds pyarrow>=15.0 to [publish] extras.
  • Adds pythonpath = ["src", "."] to pytest config so tests run without pip install -e ..

Test plan

  • python3 -m pytest tests/ — 43 tests pass (39 existing + 4 new for fetcher)
  • python3 -m ruff check scripts/fetch_data.py tests/test_fetch_data.py — clean
  • Smoke: python3 scripts/fetch_data.py --task rababa_arabic --fallback --max-samples 100 --out-dir /tmp/x/raw then RababaArabicData.prepare_data() consumes the file → (bare, diacritized) pairs with correct harakat preservation
  • Primary path needs HF_TOKEN + acceptance at https://huggingface.co/datasets/Misraj/Sadeed_Tashkeela (user action)

Follow-ups

  • Task #82 (interscript-ts CDN wiring) — separate PR
  • First training run on Modal (~$15) once user has HF_TOKEN + Modal token

Ronald Tse added 2 commits August 1, 2026 16:34
Replaces the env-var placeholder in scripts/fetch_data.sh with a
proper Python fetcher that knows the canonical dataset locations.

Primary source: Misraj/Sadeed_Tashkeela — gated, requires HF_TOKEN.
Fallback: community-datasets/tashkeela — GPLv2 open access.

The fetcher streams parquet → one-line-per-chunk text, skips blank
and overlong lines, writes atomically via .tmp rename, and exits
with a clear error message on gated-repo failures (including the
URL the user must visit to grant access).

Also adds pythonpath = ["src", "."] to pytest config so tests run
without pip install -e ., and pyarrow>=15.0 to [publish] extras.

Smoke-tested end-to-end: fetch 100 lines → RababaArabicData
consumes them → (bare, diacritized) pairs ready for StudentTrainer.
Drops Misraj/Sadeed_Tashkeela (gated, requires manual approval) as the
primary source. Replacement: arbml/tashkeelav2 — open-access, pre-split
into train/test, and pre-paired (each row has both `text` and
`diacratized` columns). No HF_TOKEN, no acceptance click-through.

Output format is now TSV with two columns: `bare<TAB>diacritized`. The
data module reads both directly — no in-pipeline stripping needed, and
the dataset's canonical letter forms are preserved. Falls back to the
legacy single-text path (.txt + strip_diacritics) when only raw
community-datasets/tashkeela is available.

Layout:
  primary   = arbml/tashkeelav2 (TSV, open)
  fallback  = community-datasets/tashkeela (TXT, GPLv2 raw)

New tests:
- fetcher primary is open + uses TSV
- fetcher fallback still uses raw text path
- data module reads TSV pairs (bare+diacritized)
- data module falls back to legacy .txt when no TSV
- data module prefers TSV when both exist

46 tests pass; smoke-tested against arbml/tashkeelav2 end-to-end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant