Catalog PyPI
PACKAGE EXPLORERView in registry

africa-bitext-builder

PyPI

Discovery, licensing verification, and bitext builder across 690+ African languages.

Versions collected1
Direct dependencies5From release 0.1.13
Last observed20 Oct, 21:10 UTC

README

Version 0.1.13 documentation

Africa Bitext Builder Banner

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.

📚 Documentation.


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


⚠️ 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, CorpusBuilder will refuse to run by default, in order to prevent unintentional copyright infringement.
  • Bible version IDs (source_version_ids or target_version_ids) may be explicitly specified using metadata retrieved via LanguageRegistry.
  • 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.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.1321 Aug 20265

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
salomonmetre/africa-bitext-builder

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:10 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:59d13f7ec1229f709c86f40cad03b205105a7b056dc5e177553047b69994b585