AfroTranslate
This package allows you to obtain translations from Masakhane JoeyNMT based models with very few lines of code. Masakhane is a grassroots research community aiming to revive and strengthen African languages through AI.
Available models can be found here.
Note: Please, install the cuda supported version of pytorch to use the GPU. Ex: pip install torch==1.8.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html.
Here are some useful links:
Masakhane: Visit the Masakhane home page.
Masakhane web: Get translations using the Masakhane web application.
Masakhane Github: Take a look at the community main projects here!
JoeyNMT Github: Get hands on JoeyNMT here!
Test it right now on Colab!
Installation
pip install AfroTranslate
Example:
Translation using the English to Fon model
from afrotranslate import MasakhaneTranslate
translator = MasakhaneTranslate(model_name="en-fon")
translator.translate("I love you so much!", n_best=1)
'Un yí wǎn nú we tawun'
Loading a model from specified directory
translator = MasakhaneTranslate(model_path="<directory-where-your-model-resides>")
Translating several sentences at once
The models are trained on individual sentences, so we automatically detect sentence boundaries in inputs and translate them separately. The output shows alternatives for each of them.
translator.translate("I love you so much! Our love is very strong!", n_best=1)
{'Sentence1': 'Un yí wǎn nú we tawun',
'Sentence2': 'Wanyiyi mǐtɔn ɖò taji tawun'}
Disclaimer
This is a community research project and as such, this service is not a production system. The models are only trained using religious data. Therefore, it should not be used for official translations.
Acknowledgement
I want to thank Julia Kreutzer for her precious feedback on this work.
Metadata
Release files for AfroTranslate 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| AfroTranslate-0.0.6.tar.gz | 11.6 kB | Without provenance | Details for AfroTranslate-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| AfroTranslate-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for AfroTranslate-0.0.6-py3-none-any.whl |
Total release size: 23.6 kB
Release files / AfroTranslate-0.0.6.tar.gz
| Download URL | AfroTranslate-0.0.6.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15697481ac5c952ee173a5e51347b63aa7a334ac5845f5da729c718f34fa4561
|
|
BLAKE2b-256 checksum How to use checksums |
a01cbb3b2de4dfde6a992ee4d30660d16e1374adf29671f4d7bc00e1d8a7b054
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.0
|
Release files / AfroTranslate-0.0.6-py3-none-any.whl
| Download URL | AfroTranslate-0.0.6-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81fd54cb2de0caa45dcc4fbbd4b2d4f7896c964aeda2d782a3d16c63e04db3a7
|
|
BLAKE2b-256 checksum How to use checksums |
61e909c17dc074dc72f8d654e4581592e775773ff53c6a72d42e1a2e793eb54b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.0
|
Security for AfroTranslate 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.