Downloads · 30 days
16
0% of all-time downloads
impresso-project/language-identifier
language-identifier is a token classification model from impresso-project. Use it when you need labels on individual words, such as names. It is set up for transformers. The card lists the license as agpl-3.0.
impresso-project/language-identifier is a multilingual language identification model fine-tuned for use on historical newspaper content. It supports German (de), French (fr), Italian (it), English (en), and Luxembourg…
Downloads · 30 days
16
0% of all-time downloads
All-time downloads
16.4K
Public
Repo size
32 MB
Likes
1
Public
Click a slice to open those files.
.bin32 MB · 100%
From the Hugging Face model README
impresso-project/language-identifierimpresso-project/language-identifier is a multilingual language identification model fine-tuned for use on historical newspaper content. It supports German (de), French (fr), Italian (it), English (en), and Luxembourgish (lb) — the core languages of the Impresso Project, which focuses on analyzing historical media across national and linguistic borders.
This model has been adapted for short, OCR-noisy and fragmentary inputs typical of historical digitized texts.
This model is a supervised floret model, trained with the following parameters:
{'bucket': 200000,
'dimension': 40,
'hash_function': 'N/A',
'loss': 'softmax',
'maxn': 4,
'minn': 1,
'model_type': 'supervised',
'vocab_size': 3}
On the impresso language identification challenge test set it achieves the following performance:
de en fr it la lb nl
de 2854 0 79 3 0 38 0
en 0 156 1 0 0 0 0
fr 14 11 1515 1 7 9 0
it 0 0 0 136 0 0 0
la 0 0 0 0 0 0 0
lb 6 1 20 0 0 775 1
nl 0 0 0 0 0 0 0
Detailed Classification Report:
precision recall f1-score support
de 0.99 0.96 0.98 2974
en 0.93 0.99 0.96 157
fr 0.94 0.97 0.96 1557
it 0.97 1.00 0.99 136
la 0.00 0.00 0.00 0
lb 0.94 0.97 0.95 803
nl 0.00 0.00 0.00 0
accuracy 0.97 5627
macro avg 0.68 0.70 0.69 5627
weighted avg 0.97 0.97 0.97 5627
from transformers import pipeline
MODEL_NAME = "impresso-project/language-identifier"
lang_pipeline = pipeline(
"langident",
model=MODEL_NAME,
trust_remote_code=True,
device="cpu",
)
text = """En l'an 1348, au plus fort des ravages de la peste noire à travers
l'Europe, le Royaume de France se trouvait à la fois au bord du désespoir et
face à une opportunité."""
langs = lang_pipeline(text)
print(langs)
The output is a single dictionary with the predicted language and confidence score:
{
"language": "fr",
"score": 1.0
}
pip install transformers floret