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:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

m2v_align-0.1.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

m2v_align-0.1.0-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file m2v_align-0.1.0.tar.gz.

File metadata

  • Download URL: m2v_align-0.1.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for m2v_align-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c7a47681d8a768aad105d2d1d65b9c614933433e9bf6d4d0446d221a7c8edf8f
MD5 a7641e220335d2d896b06cac233b65c6
BLAKE2b-256 5c32b380f3d37a8c50f941bae4e77cf4f69b3e4ccf9b485a93e54465edd3d975

See more details on using hashes here.

File details

Details for the file m2v_align-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: m2v_align-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for m2v_align-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee7ae5f94719ecc8b49d47400a5497b4da8176826c729814105841d0d4887128
MD5 cfadf7a8c615000909b132182a6331ca
BLAKE2b-256 ab2b3e99ada6db564462c00766e1c175b8328ed33119c19616af5154cf91e4b5

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page