Skip to main content

m2v-align

⚡ Fast bitext alignment powered by model2vec

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

PyPI version Python versions License Tests

Why m2v-align?

Traditional bitext aligners rely on large cross-lingual models (LaBSE, LASER) that are slow and memory-hungry. m2v-align uses 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

pip install m2v-align

Quickstart

Python API

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:

Metadata

Release files for m2v-align 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for m2v-align 0.1.0
File Size Uploaded
m2v_align-0.1.0.tar.gz 2.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for m2v-align 0.1.0
File Interpreter ABI Platform
m2v_align-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.4 kB

Release files / m2v_align-0.1.0.tar.gz

Download URL m2v_align-0.1.0.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c7a47681d8a768aad105d2d1d65b9c614933433e9bf6d4d0446d221a7c8edf8f
BLAKE2b-256 checksum
How to use checksums
5c32b380f3d37a8c50f941bae4e77cf4f69b3e4ccf9b485a93e54465edd3d975
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / m2v_align-0.1.0-py3-none-any.whl

Download URL m2v_align-0.1.0-py3-none-any.whl
Size 2.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee7ae5f94719ecc8b49d47400a5497b4da8176826c729814105841d0d4887128
BLAKE2b-256 checksum
How to use checksums
ab2b3e99ada6db564462c00766e1c175b8328ed33119c19616af5154cf91e4b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page