🚀 DictaBERT:面向现代希伯来语的先进BERT套件
DictaBERT是一款面向希伯来语的先进语言模型。它是基于 希伯来语情感数据集 进行情感分析任务微调的BERT-base模型,该数据集由以色列国家希伯来语和阿拉伯语自然语言处理计划发布。
如需查看用于其他任务的bert-base模型,请点击 此处。
🚀 快速开始
以下是使用DictaBERT进行情感分析的示例代码:
from transformers import pipeline
oracle = pipeline('sentiment-analysis', model='dicta-il/dictabert-sentiment')
sentence = '''אני מאוד שמח שהמודל הזה משוחרר לשימוש חופשי'''
oracle(sentence)
输出结果:
[
{
"label": "Positive",
"score": 0.9999868869781494
}
]
💻 使用示例
基础用法
from transformers import pipeline
oracle = pipeline('sentiment-analysis', model='dicta-il/dictabert-sentiment')
sentence = '''אני מאוד שמח שהמודל הזה משוחרר לשימוש חופשי'''
result = oracle(sentence)
print(result)
高级用法
在实际应用中,你可能需要对大量文本进行情感分析。可以将上述代码封装成函数,方便批量处理:
from transformers import pipeline
def analyze_sentiments(sentences):
oracle = pipeline('sentiment-analysis', model='dicta-il/dictabert-sentiment')
results = []
for sentence in sentences:
result = oracle(sentence)
results.append(result)
return results
sentences = [
'''אני מאוד שמח שהמודל הזה משוחרר לשימוש חופשי''',
'''אני מאוד מצטער על התוצאה הזו'''
]
sentiment_results = analyze_sentiments(sentences)
print(sentiment_results)
📚 详细文档
引用
如果您在研究中使用了DictaBERT,请引用 DictaBERT: A State-of-the-Art BERT Suite for Modern Hebrew
。
BibTeX格式引用:
@misc{shmidman2023dictabert,
title={DictaBERT: A State-of-the-Art BERT Suite for Modern Hebrew},
author={Shaltiel Shmidman and Avi Shmidman and Moshe Koppel},
year={2023},
eprint={2308.16687},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
📄 许可证
Shield: 
本作品采用 知识共享署名 4.0 国际许可协议 进行许可。
