🚀 西班牙语英语借词检测预训练模型
本项目是一个预训练模型,用于检测西班牙语新闻专线中未被同化的英语词汇借词(即英语外来词)。该模型能够标记西班牙语中使用的外来词(主要来自英语),例如 fake news(假新闻)、machine learning(机器学习)、smartwatch(智能手表)、influencer(网红)或 streaming(流媒体)等。
🚀 快速开始
本模型是一个 BiLSTM - CRF 模型,它结合了 基于代码切换数据预训练的 Transformer 嵌入 以及子词嵌入(BPE 和字符嵌入)。该模型在 COALAS 语料库上进行训练,用于检测词汇借词。
模型标签
模型考虑两种标签:
ENG
:用于标记英语词汇借词(如 smartphone、online、podcast)
OTHER
:用于标记来自其他语言的词汇借词(如 boutique、anime、umami)
模型使用 BIO 编码来处理多词借词。
⚠ 还有另一个基于 mBERT 的模型 用于相同任务,该模型使用 Transformers
库进行训练。不过,该模型的效果不如这个基于 Flair 的模型(F1 = 83.55)。
✨ 主要特性
评估指标(测试集)
在 COALAS 语料库的测试集上获得的结果如下:
标签 |
精确率 |
召回率 |
F1 值 |
ALL |
90.14 |
81.79 |
85.76 |
ENG |
90.16 |
84.34 |
87.16 |
OTHER |
85.71 |
13.04 |
22.64 |
数据集
本模型在 COALAS 语料库上进行训练,这是一个标注了未被同化词汇借词的西班牙语新闻专线语料库。该语料库包含 370,000 个标记,涵盖了各种用欧洲西班牙语撰写的书面媒体。测试集的设计尽可能具有挑战性:它涵盖了训练集中未出现过的来源和日期,包含大量未登录词(测试集中 92% 的借词是未登录词),并且借词密度很高(每 1000 个标记中有 20 个借词)。
数据集 |
标记数量 |
英语借词数量 |
其他语言借词数量 |
唯一借词数量 |
训练集 |
231,126 |
1,493 |
28 |
380 |
开发集 |
82,578 |
306 |
49 |
316 |
测试集 |
58,997 |
1,239 |
46 |
987 |
总计 |
372,701 |
3,038 |
123 |
1,683 |
更多信息
有关数据集、模型实验和错误分析的更多信息,请参阅论文:Detecting Unassimilated Borrowings in Spanish: An Annotated Corpus and Approaches to Modeling。
💻 使用示例
基础用法
from flair.data import Sentence
from flair.models import SequenceTagger
import pathlib
import os
if os.name == 'nt':
temp = pathlib.PosixPath
pathlib.PosixPath = pathlib.WindowsPath
tagger = SequenceTagger.load("lirondos/anglicisms-spanish-flair-cs")
text = "Las fake news sobre la celebrity se reprodujeron por los mass media en prime time."
sentence = Sentence(text)
tagger.predict(sentence)
print(sentence)
print('The following borrowing were found:')
for entity in sentence.get_spans():
print(entity)
📄 许可证
本项目采用 CC BY 4.0 许可证。
📚 详细文档
引用
如果您使用此模型,请引用以下文献:
@inproceedings{alvarez-mellado-lignos-2022-detecting,
title = "Detecting Unassimilated Borrowings in {S}panish: {A}n Annotated Corpus and Approaches to Modeling",
author = "{\'A}lvarez-Mellado, Elena and
Lignos, Constantine",
booktitle = "Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
month = may,
year = "2022",
address = "Dublin, Ireland",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2022.acl-long.268",
pages = "3868--3888",
abstract = "This work presents a new resource for borrowing identification and analyzes the performance and errors of several models on this task. We introduce a new annotated corpus of Spanish newswire rich in unassimilated lexical borrowings{---}words from one language that are introduced into another without orthographic adaptation{---}and use it to evaluate how several sequence labeling models (CRF, BiLSTM-CRF, and Transformer-based models) perform. The corpus contains 370,000 tokens and is larger, more borrowing-dense, OOV-rich, and topic-varied than previous corpora available for this task. Our results show that a BiLSTM-CRF model fed with subword embeddings along with either Transformer-based embeddings pretrained on codeswitched data or a combination of contextualized word embeddings outperforms results obtained by a multilingual BERT-based model.",
}