Dataset Viewer
Full Screen Viewer
Full Screen
The viewer is disabled because this dataset repo requires arbitrary Python code execution. Please consider
removing the
loading script
and relying on
automated data support
(you can use
convert_to_parquet
from the datasets
library). If this is not possible, please
open a discussion
for direct help.
Arabic NER
Sample of the Arabic NER data
Usage
pip install datasets
Login:
huggingface-cli login
from datasets import load_dataset
ds = load_dataset("iahlt/arabic_ner_mafat")
Sample
{'id': '42',
'ner_tags': [32,
32,
32,
32,
32,
32,
32,
32,
32,
32,
32,
32,
32,
32,
32,
32,
32,
30,
28,
28,
31],
'raw_tags': ['O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'O',
'B-MISC',
'I-MISC',
'I-MISC',
'L-MISC'],
'record': '{"metadata": {"doc_id": '
'"0142895c6cdb030b10c8cc2e5c9639f9422bf22ef45a1b314d7a366fc6489938", '
'"url": "https://www.alarab.com//Article/1004953", "source": '
'"AlArab", "title": "فوائد غير متوقعة للعلكة الخالية من السكر.. '
'اكتشفوها معنا!", "authors": "كل العرب (تصوير: iStockphoto)", '
'"date": "2021-08-30 13:25:01", "domains": "التغذية الصحيحة:فوائد '
'العلكة الخالية من السكر", "parnumber": "36", "sentnumber": "1", '
'"manually_qa-ed": "Yes"}, "text": "يجب عليك الامتناع عن مضغ العلكة '
'إذا كنت تعاني من أي نوع من الام الفك أو اضطراب الصدغي الفكي.", '
'"label": [[75, 94, "MISC"]], "user": "nlhowell", "timestamp": '
'1685356359.342268, "flatten": {"tokens": ["يجب", "علي", "ك", '
'"الامتناع", "عن", "مضغ", "العلكة", "إذا", "كنت", "تعاني", "من", '
'"أي", "نوع", "من", "الام", "الفك", "أو", "اضطراب", "الصدغي", '
'"الفكي", "."], "ner_tags": ["O", "O", "O", "O", "O", "O", "O", '
'"O", "O", "O", "O", "O", "O", "O", "O", "O", "O", "B-MISC", '
'"I-MISC", "I-MISC", "L-MISC"]}}',
'tokens': ['يجب',
'علي',
'ك',
'الامتناع',
'عن',
'مضغ',
'العلكة',
'إذا',
'كنت',
'تعاني',
'من',
'أي',
'نوع',
'من',
'الام',
'الفك',
'أو',
'اضطراب',
'الصدغي',
'الفكي',
'.']}
Visualization
pip install spacy ipython -q
import json
from spacy.training import offsets_to_biluo_tags, biluo_tags_to_spans
record = ds[676]
record["record"] = json.loads(record["record"])
ner_tags = record["raw_tags"]
tokens = record["tokens"]
doc = spacy.tokens.Doc(spacy.blank("ar").vocab, words=tokens)
doc.ents = biluo_tags_to_spans(doc, ner_tags)
print(record["record"]["text"])
spacy.displacy.render(doc, style="ent", jupyter=True)
- Downloads last month
- 34