Africa Bitext Builder
Africa Bitext Builder is a Python library for discovering, inspecting, and compiling sentence-aligned parallel and monolingual text corpora across 690+ African languages.
Quickstart
1. Discover Languages & Check Public Domain Status
Use the LanguageRegistry class to inspect supported languages, available translations, and their licensing status:
from africa_bitext_builder.registry import LanguageRegistry
reg = LanguageRegistry()
# Check if a language is supported by its ISO-639 code
swh = reg.resolve("swh")
print(swh)
# <Language code='swh' name='Swahili' region='African' versions=13 (PD: 0)>
# Inspect Public Domain vs. copyrighted translations
print("Public Domain versions:", [v.id for v in swh.public_domain_versions])
print("All available versions:", [v.id for v in swh.bible_versions])
2. Build a Parallel Corpus
Case A: Public Domain Only (Default)
When the requested languages have verified Public Domain versions available (e.g., Twi ↔ English), simply pass the language codes:
from africa_bitext_builder.builder import CorpusBuilder
builder = CorpusBuilder(
source_lang="twi",
target_lang="en",
limit=5000,
)
# Saves automatically to 'corpora/twi_en_parallel.csv'
out_file = builder.download("corpora/")
print(f"Saved: {out_file}")
Case B: Supplying Non-Public Domain Version IDs (User's Own Risk)
If a language has no Public Domain versions available (such as Swahili), or you require a specific translation, you may explicitly pass version IDs discovered via the registry:
from africa_bitext_builder.builder import CorpusBuilder
# Explicitly selecting Swahili (ID: 1627) and French Louis Segond 1910 (ID: 93 - PD)
builder = CorpusBuilder(
source_lang="swh",
target_lang="fr",
source_version_ids=[1627], # Explicit opt-in
target_version_ids=[93], # French Louis Segond (PD)
limit=1000,
sample=True,
seed=42,
)
# Provide a specific .csv file path or a directory path
out_file = builder.download("data/corpora/swahili_french.csv")
print(f"Saved: {out_file}")
3. Build a Monolingual Corpus
Extract deduplicated sentences for a single language:
from africa_bitext_builder.builder import CorpusBuilder
builder = CorpusBuilder(
source_lang="amh",
source_version_ids=[206], # Explicit version opt-in
mode="monolingual",
limit=5000,
)
out_file = builder.download("corpora/amharic.csv")
Data Source & Acknowledgements
- Primary Source: Bible verse texts are retrieved from YouVersion.
- Attribution: This work builds on the pioneering corpus collection effort by Mic-Seth Owusu (AfriSpeech/africa-corpus-builder), and is inspired by the Ghana NLP Community.
- License: Code in this repository is licensed under the MIT License.
⚠️ Licensing & Safety Notice
By default, this library restricts corpus construction exclusively to verified Public Domain (PD) and Creative Commons translations.
- If a language has no Public Domain translations indexed,
CorpusBuilderwill refuse to run by default, in order to prevent unintentional copyright infringement. - Bible version IDs (
source_version_idsortarget_version_ids) may be explicitly specified using metadata retrieved viaLanguageRegistry. - Important Notice on Copyrighted Versions: Supplying version IDs that are not in the public domain is done entirely at your own risk. You are solely responsible for obtaining any necessary permissions or licenses from the relevant copyright holders. The maintainers assume no legal responsibility or liability for the extraction, use, or redistribution of copyrighted translations.
Metadata
Release files for africa-bitext-builder 0.1.13
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 | |
|---|---|---|---|---|
| africa_bitext_builder-0.1.13.tar.gz | 435.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| africa_bitext_builder-0.1.13-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 553.8 kB
Release files / africa_bitext_builder-0.1.13.tar.gz
| Download URL | africa_bitext_builder-0.1.13.tar.gz |
|---|---|
| Size | 435.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3ce7b4bbb1e767db03952eee5f78dd335b79941cf574120b62371c30e7d24cb
|
|
BLAKE2b-256 checksum How to use checksums |
33995d4e285560ca9c9ada6edf2a9837590a4fd4a20932022c4820ab49c7ac98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / africa_bitext_builder-0.1.13-py3-none-any.whl
| Download URL | africa_bitext_builder-0.1.13-py3-none-any.whl |
|---|---|
| Size | 118.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f05072798e8354a409911cc9a5aa291b8530ddc592eb7c88ea0ba69d05b8126e
|
|
BLAKE2b-256 checksum How to use checksums |
6c4d5649c0bb52dad43251eed3832766f887fb5ab29c638d679c4aaf377fe6da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for africa-bitext-builder 0.1.13
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.