File size: 1,770 Bytes
a353893
9829939
a353893
 
 
 
df07aee
a353893
 
df07aee
 
 
 
 
 
 
 
 
 
 
 
 
a353893
 
df07aee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
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.