Views
No views yet
| Label | Hebrew | Description |
|---|---|---|
Cit (B-מקור / I-מקור) | מקור | Citations — references to Jewish texts and sources |
Per (B-בן-אדם / I-בן-אדם) | בן-אדם | Persons — names of people |
BertForTokenClassification (BERT-base, 12 layers, 12 attention heads, hidden size 768)| Metric | Score |
|---|---|
| F1 | 87.2% |
| Precision | 85.7% |
| Recall | 88.8% |
| Eval loss | 0.0815 |
1from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
2
3model_id = "Sefaria/berel-linker-ner"
4tokenizer = AutoTokenizer.from_pretrained(model_id)
5model = AutoModelForTokenClassification.from_pretrained(model_id)
6
7ner = pipeline(
8 "ner",
9 model=model,
10 tokenizer=tokenizer,
11 aggregation_strategy="first",
12 stride=128,
13)
14
15text = "דברי הרמב\"ם בהלכות שבת"
16entities = ner(text)
17print(entities)1{
2 "O": 0,
3 "I-מקור": 1,
4 "I-בן-אדם": 2,
5 "B-מקור": 5,
6 "B-בן-אדם": 6
7}