--- title: Hadith Segmentation emoji: 💬 colorFrom: yellow colorTo: purple sdk: gradio sdk_version: 6.31.0 app_file: app.py pinned: false license: mit short_description: Split a raw hadith into sanad and matn models: - SHK4K/hadith-segmentation-bert language: - ar tags: - hadith - sanad - matn - arabic - token-classification - digital-humanities --- # فاصل الحديث — Hadith Splitter يقسم نص حديث خام (بدون علامات ترقيم هيكلية) إلى **سند** (سلسلة الرواة) و**متن** (قول النبي صلى الله عليه وسلم)، ويعرض الحدود بينهما بالألوان على النص الأصلي. Splits a raw hadith string into its **sanad** (chain of narrators) and **matn** (the saying itself), and highlights the boundary on the original text. - Model: [SHK4K/hadith-segmentation-bert](https://huggingface.co/SHK4K/hadith-segmentation-bert) (AraBERT v02 fine-tuned for token classification) - Labels: `B-SANAD`, `I-SANAD`, `B-MATN`, `I-MATN`, reduced to a single cut - Diacritics are stripped for inference (the model was trained undiacritized) and mapped back, so the output keeps your original vocalized text - Long hadiths: processed in overlapping 512-token windows (stride 128) with per-word majority voting, so nothing is truncated - Output strings are sliced from your original text, so punctuation and spacing are preserved ## Limits - Accuracy is limited on unusual orthography; the model was trained on normalized Arabic, and the app normalizes before inference. - Pastes longer than ~25k subword tokens are processed only up to that point. - The model is small (0.1B); treat the boundary as a suggestion on low-resource texts, not ground truth.