Skip to main content

This package allows you to obtain translations from Masakhane JoeyNMT based models. Masakhane is a grassroots research community aiming to revive and strengthen African languages through AI.

Project description

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'

Translating several sentences at once:

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'}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

AfroTranslate-0.0.5.tar.gz (11.0 kB view hashes)

Uploaded Source

Built Distribution

AfroTranslate-0.0.5-py3-none-any.whl (11.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page