Views
No views yet

1from transformers import pipeline
2
3
4afrolid = pipeline("text-classification", model='UBC-NLP/afrolid_1.5')
5
6input_text="6Acï looi aya në wuöt dït kɔ̈k yiic ku lɔ wuöt tɔ̈u tëmec piny de Manatha ku Eparaim ku Thimion , ku ɣään mec tɔ̈u të lɔ rut cï Naptali"
7
8result = afrolid(input_text)
9
10# Extract the label and score from the first result
11language = result[0]['label']
12score = result[0]['score']
13
14print(f"detected langauge: {language}\tscore: {round(score*100, 2)}")
15detected langauge: dip score: 99.99@article{adebara2022afrolid,
title={AfroLID: A Neural Language Identification Tool for African Languages},
author={Adebara, Ife and Elmadany, AbdelRahim and Abdul-Mageed, Muhammad and Inciarte, Alcides Alcoba},
booktitle = "Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing (EMNLP)",
month = December,
year = "2022",
}@inproceedings{adebara-etal-2023-serengeti,
title = "{SERENGETI}: Massively Multilingual Language Models for {A}frica",
author = "Adebara, Ife and
Elmadany, AbdelRahim and
Abdul-Mageed, Muhammad and
Alcoba Inciarte, Alcides",
booktitle = "Findings of the Association for Computational Linguistics: ACL 2023",
month = jul,
year = "2023",
address = "Toronto, Canada",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2023.findings-acl.97",
doi = "10.18653/v1/2023.findings-acl.97",
pages = "1498--1537",
}