语言:
- 荷兰语
标签:
- 标点预测
- 标点符号
数据集: sonar
许可证: mit
小部件:
- 文本: "Ondanks dat het nu bijna voorjaar is hebben we nog steds best koude dagen"
示例标题: "荷兰语样本"
指标:
- f1分数
该模型用于预测荷兰语文本的标点符号。我们开发此模型旨在恢复转录口语的标点符号。
此模型基于SoNaR数据集训练而成。
模型可恢复以下标点符号:“.” “,” “?” “-” “:”
示例代码
我们提供了一个简单的Python包,可处理任意长度的文本。
安装
从pypi安装包以开始使用:
pip install deepmultilingualpunctuation
恢复标点符号
from deepmultilingualpunctuation import PunctuationModel
model = PunctuationModel(model="oliverguhr/fullstop-dutch-sonar-punctuation-prediction")
text = "hervatting van de zitting ik verklaar de zitting van het europees parlement die op vrijdag 17 december werd onderbroken te zijn hervat"
result = model.restore_punctuation(text)
print(result)
输出
hervatting van de zitting. ik verklaar de zitting van het europees parlement, die op vrijdag 17 december werd onderbroken, te zijn hervat.
预测标签
from deepmultilingualpunctuation import PunctuationModel
model = PunctuationModel(model="oliverguhr/fullstop-dutch-sonar-punctuation-prediction")
text = "hervatting van de zitting ik verklaar de zitting van het europees parlement die op vrijdag 17 december werd onderbroken te zijn hervat"
clean_text = model.preprocess(text)
labled_words = model.predict(clean_text)
print(labled_words)
输出
[['hervatting', '0', 0.99998724], ['van', '0', 0.9999784], ['de', '0', 0.99991274], ['zitting', '.', 0.6771242], ['ik', '0', 0.9999466], ['verklaar', '0', 0.9998566], ['de', '0', 0.9999783], ['zitting', '0', 0.9999809], ['van', '0', 0.99996245], ['het', '0', 0.99997795], ['europees', '0', 0.9999783], ['parlement', ',', 0.9908242], ['die', '0', 0.999985], ['op', '0', 0.99998224], ['vrijdag', '0', 0.9999831], ['17', '0', 0.99997985], ['december', '0', 0.9999827], ['werd', '0', 0.999982], ['onderbroken', ',', 0.9951485], ['te', '0', 0.9999677], ['zijn', '0', 0.99997723], ['hervat', '.', 0.9957053]]
结果
不同标点符号的性能表现有所差异,因为连字符和冒号在许多情况下是可选的,可以用逗号或句号替代。模型达到的F1分数如下:
标签 |
F1分数 |
0 |
0.985816 |
. |
0.854380 |
? |
0.684060 |
, |
0.719308 |
: |
0.696088 |
- |
0.722000 |
宏平均 |
0.776942 |
微平均 |
0.963427 |
语言
模型
社区模型
可通过设置模型参数使用不同模型:
model = PunctuationModel(model = "oliverguhr/fullstop-dutch-punctuation-prediction")
如何引用我们
@misc{https://doi.org/10.48550/arxiv.2301.03319,
doi = {10.48550/ARXIV.2301.03319},
url = {https://arxiv.org/abs/2301.03319},
author = {Vandeghinste, Vincent and Guhr, Oliver},
keywords = {Computation and Language (cs.CL), Artificial Intelligence (cs.AI), FOS: Computer and information sciences, FOS: Computer and information sciences, I.2.7},
title = {FullStop:Punctuation and Segmentation Prediction for Dutch with Transformers},
publisher = {arXiv},
year = {2023},
copyright = {Creative Commons Attribution Share Alike 4.0 International}
}