Skip to main content

VectorAlign

Bilingual word alignment using multilingual embeddings — no training required!

For non-nerds: a word matching engine for any language pair using parallel data.

Installation

pip install vectoralign

Quick Start

from vectoralign import align

# Your parallel sentences
english = [
    "Hello world",
    "How are you today",
    "The weather is nice"
]
hindi = [
    "नमस्ते दुनिया",
    "आज आप कैसे हैं",
    "मौसम अच्छा है"
]

# Align and build dictionary
dictionary = align(english, hindi)

Features

  • No training required — Uses pre-trained multilingual embeddings
  • Batch processing — Batch processing with automatic CUDA detection
  • Multiple models — Supports LaBSE, mBERT, and other HuggingFace models
  • Bidirectional alignment — Intersection of forward and backward alignments

Version 0.2.0 added features:

  • Memory management — Automatic garbage collection and CUDA cache management for efficient memory usage

Advanced Usage

from vectoralign import align

# Custom model and batch size
dictionary = align(
    src_sentences,
    tgt_sentences,
    model_name="setu4993/LaBSE",  # or "bert" for mBERT
    batch_size=64,
    threshold=0.6,  # Sentence similarity threshold
    output="my_dictionary.txt"
)

Supported Models

Model Name
LaBSE setu4993/LaBSE (default)
mBERT bert with mode='multilingual'
Any HuggingFace model with pooler_output Full model path

Output Format

The dictionary is saved as a TSV file:

word1    translation1    count
word2    translation2    count

Acknowledgments

This is a spiritual implementation of SimAlign by the Centre for Language and Information Processing, LMU Munich.

License

MIT License

Metadata

Release files for vectoralign 0.2.2

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

Source distribution (sdist)

Source distribution for vectoralign 0.2.2
File Size Uploaded
vectoralign-0.2.2.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vectoralign 0.2.2
File Interpreter ABI Platform
vectoralign-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / vectoralign-0.2.2.tar.gz

Download URL vectoralign-0.2.2.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e8f3bbfe0dd7e61e40a727b02918c68f1eb55328e6ebf657b83bdccdffdc37c8
BLAKE2b-256 checksum
How to use checksums
13ac33d85c616f071ef1197c19ccf9c08183075d053f6435b89fdd9e7a49c11d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.18

Release files / vectoralign-0.2.2-py3-none-any.whl

Download URL vectoralign-0.2.2-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40aa9cd7178a3a0c8114d6d0668efc8d3996c62fa44f57195cb6433f67a8f8ea
BLAKE2b-256 checksum
How to use checksums
1d52c8620a885c9d189e6663730abcddec191048459661529aaea7d8252f9805
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.18

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.1.0

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