Metadata-Version: 2.4
Name: m2v-align
Version: 0.1.0
Summary: Fast bitext alignment using model2vec embeddings
Keywords: bitext,alignment,parallel-corpus,model2vec,sentence-alignment,paragraph-alignment,nlp,multilingual,llm
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: loguru>=0.7.3

# m2v-align

⚡ **Fast bitext alignment powered by [model2vec](https://github.com/MinishLab/model2vec)**

Align parallel paragraphs/sentences between two languages in seconds — no GPU required.

[![PyPI version](https://img.shields.io/pypi/v/m2v-align.svg)](https://pypi.org/project/m2v-align/)
[![Python versions](https://img.shields.io/pypi/pyversions/m2v-align.svg)](https://pypi.org/project/m2v-align/)
[![License](https://img.shields.io/github/license/yourusername/m2v-align.svg)](https://github.com/yourusername/m2v-align/blob/main/LICENSE)
[![Tests](https://github.com/yourusername/m2v-align/actions/workflows/tests.yml/badge.svg)](https://github.com/yourusername/m2v-align/actions)

## Why m2v-align?

Traditional bitext aligners rely on large cross-lingual models (LaBSE, LASER) that are slow and memory-hungry. **m2v-align** uses [Model2Vec](https://github.com/MinishLab/model2vec) static embeddings instead:

- 🚀 **~100x faster** than transformer-based aligners — thousands of sentence pairs per second on CPU
- 🪶 **Tiny footprint** — models as small as 8M parameters, no PyTorch required at inference
- 🌍 **Multilingual** — works across 100+ languages with multilingual Model2Vec models
- 🔌 **Simple API** — align two lists of sentences in 3 lines of code

## Installation

```bash
pip install m2v-align
```

## Quickstart

### Python API

```python
from m2v_align import BitextAligner

aligner = BitextAligner()  # downloads a default multilingual model

source = [
    "Hello, how are you?",
    "The cat sits on the mat.",
    "I love programming.",
]
target = [
    "Ich liebe Programmieren.",
    "Hallo, wie geht es dir?",
    "Die Katze sitzt auf der Matte.",
]

pairs = aligner.align(source, target, threshold=0.6)

for pair in pairs:
    print(f"{pair.score:.3f} | {pair.source} <-> {pair.target}")
```

Output:

