🚀 阿拉伯語命名實體識別模型
本項目是一個基於 GigaBERTv4 的命名實體識別(NER)模型,可對阿拉伯語和英語文本進行 BIO 標籤標註。它使用 ACE2005 數據集進行訓練,涵蓋英語和阿拉伯語數據。
🚀 快速開始
模型信息
屬性 |
詳情 |
模型類型 |
基於 GigaBERTv4 的阿拉伯語 NER BIO 標籤模型 |
訓練數據 |
ACE2005 數據集(英語 + 阿拉伯語) |
NER 標籤 |
NER 標籤,包括:PER(人物)、VEH(交通工具)、GPE(地理政治實體)、WEA(武器)、ORG(組織)、LOC(地點)、FAC(設施) |
超參數
learning_rate
= 2e-5
num_train_epochs
= 10
weight_decay
= 0.01
ACE2005 評估結果(F1 值)
💻 使用示例
基礎用法
>>> from transformers import pipeline, AutoModelForTokenClassification, AutoTokenizer
>>> ner_model = AutoModelForTokenClassification.from_pretrained("ychenNLP/arabic-ner-ace")
>>> ner_tokenizer = AutoTokenizer.from_pretrained("ychenNLP/arabic-ner-ace")
>>> ner_pip = pipeline("ner", model=ner_model, tokenizer=ner_tokenizer, grouped_entities=True)
>>> output = ner_pip('Protests break out across the US after Supreme Court overturns.')
>>> print(output)
[{'entity_group': 'GPE', 'score': 0.9979881, 'word': 'us', 'start': 30, 'end': 32}, {'entity_group': 'ORG', 'score': 0.99898684, 'word': 'supreme court', 'start': 39, 'end': 52}]
>>> output = ner_pip('قال وزير العدل التركي بكير بوزداغ إن أنقرة تريد 12 مشتبهاً بهم من فنلندا و 21 من السويد')
>>> print(output)
[{'entity_group': 'PER', 'score': 0.9996214, 'word': 'وزير', 'start': 4, 'end': 8}, {'entity_group': 'ORG', 'score': 0.9952383, 'word': 'العدل', 'start': 9, 'end': 14}, {'entity_group': 'GPE', 'score': 0.9996675, 'word': 'التركي', 'start': 15, 'end': 21}, {'entity_group': 'PER', 'score': 0.9978992, 'word': 'بكير بوزداغ', 'start': 22, 'end': 33}, {'entity_group': 'GPE', 'score': 0.9997154, 'word': 'انقرة', 'start': 37, 'end': 42}, {'entity_group': 'PER', 'score': 0.9946885, 'word': 'مشتبها بهم', 'start': 51, 'end': 62}, {'entity_group': 'GPE', 'score': 0.99967396, 'word': 'فنلندا', 'start': 66, 'end': 72}, {'entity_group': 'PER', 'score': 0.99694425, 'word': '21', 'start': 75, 'end': 77}, {'entity_group': 'GPE', 'score': 0.99963355, 'word': 'السويد', 'start': 81, 'end': 87}]
📄 許可證
本項目採用 MIT 許可證。
📚 引用信息
@inproceedings{lan2020gigabert,
author = {Lan, Wuwei and Chen, Yang and Xu, Wei and Ritter, Alan},
title = {Giga{BERT}: Zero-shot Transfer Learning from {E}nglish to {A}rabic},
booktitle = {Proceedings of The 2020 Conference on Empirical Methods on Natural Language Processing (EMNLP)},
year = {2020}
}