top of page

Automatically detecting lexical borrowings

  • Autorenbild: Martin Schmitt
    Martin Schmitt
  • 26. Apr. 2023
  • 5 Min. Lesezeit

Aktualisiert: 26. Mai 2023

This post discusses the ACL 2022 paper Detecting Unassimilated Borrowings in Spanish: An Annotated Corpus and Approaches to Modeling by Elena Álvarez-Mellado and Constantine Lignos. You can find the full text here.

Who should know about it

Lexical borrowing is the process of bringing words from one language into another.

This is something that happens in most languages, not only Spanish, and nowadays we mostly borrow English words (Maybe you have heard about the term anglicism.). If you are a non-English native speaker, think about how you say podcast, app, smartphone, or big data, fake news, etc. in your native language. Is there a dedicated translation in your language or do you simply use the English term?

The automatic detection of such words can be useful for a variety of tasks, e.g., text-to-speech (language-specific pronunciation rules) or machine translation (maybe you can just copy over the word if the borrowing also exists in the target language?). So if you think that your text data contains such words “borrowed” from another language (and if your texts are not in English, the chances are quite high), you might think about treating them differently. And if you then start implementing an automatic detection algorithm, you should definitely know about the new publicly available data and insights described in this paper.

Why we want to know about it

We at Celebrate company and especially our brands kartenmacherei and faireparterie accompany the celebration of a special moment with our print products at every step. Be it a colorfully announced save the date, the description of a birthday party dress code, or creatively named entries on a wedding menu, it has become quite impossible to imagine these without mentioning at least some lexical borrowings (especially from English). And that is true for both our French- and German-writing customers.

What the paper is about

The paper improves on previous research on borrowing detection in two ways:

  1. Collection of a larger, more diverse data set (called COALAS) with emphasis on evaluating the generalization capabilities of machine learning models

  2. Experiment with modern approaches based on transfer learning and the Transformer architecture


New data

Aiming for the most challenging data set possible, the authors took special care to avoid any overlap between the training, development, and test splits of their data. They only consider news texts but the exact sources the texts are extracted from and also the time period of the texts vary between the three data splits. And to make it extra challenging, the authors aim for OOV-rich (Out Of Vocabulary) evaluation sets, i.e., already before manual annotation, they preferably select sentences for the dev and test sets that contain OOVs, i.e., words that do not occur in the train set.

And this process pays off: 92% of the borrowings in the test set do not occur in the train set. Best conditions for testing the generalization capabilities of our models!

If you are currently thinking about annotating your own data, I want to highlight two things here:

  1. The authors recommend separating the borrowings into two classes: ENG for anglicisms and OTHER for the rest.

  2. There are great annotation guidelines in the appendix of the paper. You can see that the authors put a lot of thoughts in them.


Modern modeling approaches

Experiments start with an existing baseline from previous work: A CRF with handcrafted binary features. Unfortunately, this approach does not perform too well (55% F1 on test).

Next comes a Spanish BERT model called BETO and multilingual BERT (mBERT). The vanilla approach of fine-tuning these two without any custom architecture already performs quite well with mBERT beating BETO slightly (82% F1 on test).

Next, the CRF makes a re-entrance, this time equipped with a bidirectional LSTM (BiLSTM) and several types of embeddings as input features instead of handcrafted ones. The authors find that using contextualized mBERT embeddings as input unsurprisingly beats word-type-based fastText embeddings as input. Using the BiLSTM+CRF on top of the mBERT embeddings does not, however, improve overall performance. It seems the LSTM and CRF layers just add unnecessary complexity. Then they try stacking English BERT and Spanish BETO embeddings together, feed it to the BiLSTM+CRF and they get better than mBERT. It seems that combining the information from the two specialized monolingual models (with English being by far the most common source for borrowings in COALAS) provides an advantage over the general multilinguality in mBERT.

They play around with a few other embedding combinations but keep the English BERT and Spanish BETO embeddings as the base setting for best performance. Interestingly, adding pretrained BPE embeddings for both English and Spanish from the Flair library consistently boosts performance further.

They present results with two other types of embeddings: Character embeddings (also from Flair) and mBERT embeddings fine-tuned on the task of language identification with code-switched¹ data. Both of these, however, do not always lead to improvements.

Error Analysis

The paper also has a very informative error analysis section. One super important finding: Recall is a weak point for all models! When experimenting with our own data, I also found that memorizing some common expressions (save the date, dress code, …) can go a long way and will, of course, yield a very high precision (except maybe words that are spelled the same in the two languages but aren’t actually borrowings, see below). But for good recall, you will need to generalize well. You will need to really understand what an English word distinguishes generally from a Spanish word. And that is especially true for the COALAS dataset with its high rate of OOVs among the borrowings in the evaluation splits.

There are more results in the paper but here are a few highlights: Casing seems to be a problem as both unexpectedly upper-case borrowings (Big Data vs. big data) and borrowings that are upper-cased only because they are at the beginning of a sentence frequently pose problems. This could be due to the explicit exclusion of proper nouns during annotation. It makes the task harder to additionally require the model to distinguish between English-looking names and English-looking common nouns when it is already challenging to distinguish between Spanish- and English-looking words.

An interesting source of errors also stems from words in English and Spanish that accidentally share the same orthography. In English, you can have a primer on some subject, but in Spanish the word primer means first. So it is extra-challenging to distinguish between these two words only based on the context.

What we found inspiring

  1. Both character-level information and the fine-tuning on code-switching does not help as much as we had expected and does not consistently lead to improvements either.

  2. Interestingly, BPE information can be a strong signal for distinguishing words of different origins.

  3. Proper nouns are a big confounding factor for the automatic detection of lexical borrowings. A joint approach with an NER component might benefit both tasks. Also, if your use case allows it, it can make sense to annotate proper noun borrowings in the same way as common noun borrowings and thus remove this source of error entirely.


Additional materials

More details on the paper

  • The full text of the paper

  • Video on YouTube

  • GitHub repository

Background on modeling

  • Conditional Random Field (CRF)

  • Combining BiLSTM with CRF

  • BPE

Background on linguistics

  • Code-switching

  • Lexical borrowing



[1]: Code-switched data means text that mixes more than one language, e.g., you start a sentence in English and you finish in Spanish. The fine-tuning task then is about classifying each and every word according to the language it belongs to (e.g., English vs. Spanish).

11 Kommentare


terrancecart.e.r.36.0.7
vor 33 Minuten

LLWIN mình thấy dạo này hay xuất hiện nên cũng ghé thử xem trang trông ra sao. Mình chỉ vào lướt nhẹ chứ không đăng ký hay gì, chủ yếu xem cách họ trình bày nội dung. Cảm giác đầu tiên là giao diện khá sạch và hiện đại, nhìn không bị rối mắt. Mấy đoạn giới thiệu về nền tảng được viết gọn gàng, đọc nhanh là hiểu họ làm gì và vận hành kiểu nào. Mình dùng điện thoại vào thử thì chuyển qua lại các mục cũng ổn, không bị lag hay phải zoom tới zoom lui. Nói chung kiểu sắp xếp này hợp với người chỉ muốn xem thông tin nhanh, vì các khối nội dung…

Gefällt mir

savannapatt.er.s.on.7.0.4
vor 4 Tagen

789bet mình thấy bạn bè nói nhiều quá nên cũng bấm vào nghía thử cho biết thôi. Không phải kiểu ngồi nghiên cứu gì đâu, chủ yếu xem vào có dễ nhìn, dễ bấm không. Vừa mở ra cái mình để ý ngay là trang nhìn khá gọn, khoảng trắng vừa đủ nên không bị ngộp chữ. Mấy mục chính được xếp theo nhóm rõ ràng, kéo xuống một chút là hiểu mình đang ở phần nào, không phải đoán. Mình cũng thích cách họ trình bày kiểu khối nội dung, nhìn lướt nhanh là bắt được thông tin, nhất là mấy chỗ số liệu để dạng bảng cột nên đọc đỡ rối mắt. Nói chung thao tác qua lại…

Gefällt mir

billy24barne.s7.8.3.5
15. Juni

88clb mình thấy bạn bè nói hoài nên bấm vô xem thử cho biết, kiểu tò mò thôi chứ không định ngồi nghiên cứu gì sâu. Vào cái là thấy họ làm bố cục khá thoáng, chữ không bị dồn dập nên nhìn đỡ mệt mắt. Mình thích nhất là mấy tiêu đề chủ đề đặt rõ ràng, kiểu có nhắc tới World Cup 2026 nên lướt qua là biết trang đang nói về gì. Với lại có đoạn nhắc người chơi nên tỉnh táo trước web giả mạo, đọc nhanh cũng thấy hợp lý chứ không bị lan man. Nói chung thao tác qua lại giữa các phần khá trơn, vì menu để dễ thấy và các khối nội…

Gefällt mir

luciand.urha.m.584
15. Juni

mb66 hôm bữa mình cũng tò mò vào thử vì thấy mọi người nhắc hoài. Mình không có đăng ký hay tìm hiểu gì sâu, chỉ lướt vài phút xem trang nhìn ra sao thôi. Cảm giác đầu tiên là giao diện khá dễ chịu, không bị rối mắt như nhiều trang khác, kéo xuống thấy nội dung chia khối rõ ràng nên đọc nhanh cũng nắm được ý. Mình để ý thêm là lúc mở trang không bị bật mấy cái pop-up quảng cáo linh tinh, nên ngồi xem đỡ khó chịu hẳn. Tốc độ tải cũng ổn, bấm qua lại vài mục không thấy lag. Nói chung ai chỉ muốn xem qua cho biết thì cũng dễ làm…

Gefällt mir

jennysilva3.2.3.12
15. Juni

j88 mình thấy mấy đứa bạn nói suốt nên tiện ghé thử cho biết, chủ yếu xem giao diện chứ chưa đào sâu nội dung. Vừa vào là thấy trang nhìn sáng và dễ thở, không kiểu nhồi chữ dày đặc nên lướt khá nhẹ. Mình để ý họ chia thông tin thành từng khung riêng, nhìn phát là phân biệt được cái nào là phần chính, cái nào là mục phụ, đỡ phải căng mắt đọc. Thanh menu cũng nằm chỗ dễ thấy nên chuyển qua lại nhanh, bấm vài cái là quen tay luôn. Nói chung cảm giác dùng ổn vì các khối nội dung canh gọn và tiêu đề nhóm mục hiển thị rõ ràng trên trang.

Gefällt mir
bottom of page