Afrolid
AfroLID, a powerful neural toolkit for African languages identification which covers 517 African languages.
Install / Use
/learn @UBC-NLP/AfrolidREADME
AfroLID, a neural LID toolkit for 517 African languages and varieties. AfroLID exploits a multi-domain web dataset manually curated from across 14 language families utilizing five orthographic systems. AfroLID is described in this paper: AfroLID: A Neural Language Identification Tool for African Languages.
<br>What's New in AfroLID v1.5?
- Fine-tuned on SERENGETI, a massively multilingual language model covering 517 African languages and language varieties.
- Enhanced model performance, improving macro-F1 from 95.95 to 97.41.
- Built on Hugging Face Transformers for seamless integration.
- Optimized for easy use with the Hugging Face pipeline.
- Better efficiency and accuracy, making it more robust for African langauges identification.
How to use AfroLID v1.5?
from transformers import pipeline
afrolid = pipeline("text-classification", model='UBC-NLP/afrolid_1.5', use_fast=False)
input_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"
result = afrolid(input_text)
# Extract the label and score from the first result
language = result[0]['label']
score = result[0]['score']
print(f"detected language: {language}\tscore: {round(score*100, 2)}")
Output:
detected langauge: dip score: 99.99
Requirements
- Download AfroLID model:
wget https://demos.dlnlp.ai/afrolid/afrolid_model.tar.gz
tar -xf afrolid_model.tar.gz
Installation
- To install AfroLID and develop directly using pip:
pip install -U afrolid
- To install AfroLID and develop directly GitHub repo using pip:
pip install -U git+https://github.com/UBC-NLP/afrolid.git
- To install AfroLID and develop locally:
git clone https://github.com/UBC-NLP/afrolid.git
cd afrolid
pip install .
Getting Started
The full documentation contains instructions for getting started, translation using diffrent methods, intergrate AfroLID with your code, and provides more examples.
Colab Examples
(1) Integrate AfroLID with your python code
<table style='border:1px red;' width='100%'> <tr><td> <b>Content</b></td><td><b>Colab link</b></td></tr> <td> <ul> <li> Install AfroLID </li> <li> Download AfroLID's model </li> <li> Initial AfroLID object </li> <li> Get language prediction(s)</li> <li> Integrate with Pandas</li> </ul> </td> <td> <a href="https://colab.research.google.com/github/UBC-NLP/afrolid/blob/main/examples/Integrate_afrolid_with_your_code.ipynb"><img alt="colab" src="https://colab.research.google.com/assets/colab-badge.svg"></td> </tr> </table>(2) Command Line Interface
<table style='border:1px red;' width='100%'> <tr><td><b>Command</b></td><td> <b>Content</b></td><td><b>Colab link</b></td></tr> <tr> <td>afrolid_cli</td> <td> <ul> <li> Usage and Arguments </li> <li> Examples</li> </ul> </td> <td> <a href="https://colab.research.google.com/github/UBC-NLP/afrolid/blob/main/examples/afrolid_interactive_cli.ipynb"><img alt="colab" src="https://colab.research.google.com/assets/colab-badge.svg"></td> </tr> <tr> </table>Supported languages
Please refer to suported-languages
License
afrolid(-py) is Apache-2.0 licensed. The license applies to the pre-trained models as well.
Citation
If you use AfroLID toolkit or the pre-trained models for your scientific publication, or if you find the resources in this repository useful, please cite our paper as follows (to be updated):
@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",
}
Acknowledgments
We gratefully acknowledge support from Canada Research Chairs (CRC), the Natural Sciences and Engineering Research Council of Canada (NSERC; RGPIN-2018-04267), the Social Sciences and Humanities Research Council of Canada (SSHRC; 435-2018-0576; 895-2020-1004; 895-2021-1008), Canadian Foundation for Innovation (CFI; 37771), Digital Research Alliance of Canada, UBC ARC-Sockeye, Advanced Micro Devices, Inc. (AMD), and Google. Any opinions, conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of CRC, NSERC, SSHRC, CFI, CC, AMD, Google, or UBC ARC-Sockeye.
Related Skills
YC-Killer
2.7kA library of enterprise-grade AI agents designed to democratize artificial intelligence and provide free, open-source alternatives to overvalued Y Combinator startups. If you are excited about democratizing AI access & AI agents, please star ⭐️ this repository and use the link in the readme to join our open source AI research team.
best-practices-researcher
The most comprehensive Claude Code skills registry | Web Search: https://skills-registry-web.vercel.app
groundhog
398Groundhog's primary purpose is to teach people how Cursor and all these other coding agents work under the hood. If you understand how these coding assistants work from first principles, then you can drive these tools harder (or perhaps make your own!).
isf-agent
a repo for an agent that helps researchers apply for isf funding
