Feature Extraction
PyTorch
bert
word-alignment
phrase-alignment
african-languages
awesome-align
machine-translation
translation-memory

Afro-Awesome-Align (Pan-African Neural Word & Phrase Aligner)

Afro-Awesome-Align is the first neural word and phrase alignment model specifically fine-tuned across 693 African languages and English. Built on awesome-align (Dou & Neubig, EACL 2021), it extracts dense, high-precision token and multi-word phrase alignments between English and African language parallel texts.

Features

  • 693 African Languages Supported: Fine-tuned on parallel sentence pairs across Niger-Congo, Afroasiatic, Nilo-Saharan, and Khoisan language families.
  • Phrase-Level Alignment: Captures word-order inversions (e.g. holy spirit $\leftrightarrow$ honhom kronkron / ẹ̀mí mímọ́) and compound word mappings (e.g. high priest $\leftrightarrow$ ɔsɔfopanin / kuhani mkuu).
  • Self-Supervised Objectives: Trained using Translation Language Modeling (TLM), Self-Training with Pseudo-Alignments (SO), and Permutation Structural Invariance (PSI).

Quick Start

1. Installation

pip install awesome-align transformers torch

2. Extracting Alignments via CLI

Prepare an input file corpus.txt with tab-separated or pipe-separated (|||) lines:

the holy spirit came upon them . ||| honhom kronkron no baa wɔn so .
the high priest questioned him . ||| ɔsɔfo panin no bisaa no .

Run alignment:

awesome-align \
    --model_name_or_path AfriSpeech/afro-awesome-align \
    --data_file corpus.txt \
    --output_file alignments.txt \
    --output_word_file aligned_words.txt \
    --extraction softmax \
    --batch_size 32

3. Using in Python

import torch
from transformers import AutoModel, AutoTokenizer

model_name = "AfriSpeech/afro-awesome-align"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModel.from_pretrained(model_name).cuda().eval()

src_sent = "the holy spirit came upon them ."
tgt_sent = "honhom kronkron no baa wɔn so ."

# Tokenize and align
src_tokens = src_sent.split()
tgt_tokens = tgt_sent.split()
sent_pair = f"{src_sent} ||| {tgt_sent}"

# Alignments can be extracted directly using the awesome-align pipeline

Citation

If you use this model or dataset in your research or applications, please cite:

@inproceedings{dou2021word,
  title={Word Alignment by Fine-tuning Embeddings on Parallel Corpora},
  author={Dou, Zi-Yi and Neubig, Graham},
  booktitle={EACL},
  year={2021}
}
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Datasets used to train AfriSpeech/afro-awesome-align