Skip to main content

Bilingual word alignment using multilingual embeddings - a spiritual implementation of SimAlign

Project description

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

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

Project details


Download files

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

Source Distribution

vectoralign-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

vectoralign-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vectoralign-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for vectoralign-0.1.0.tar.gz
Algorithm Hash digest
SHA256 54cb36b1275ac3f60e9be6610bdda9dcb074f58e4b05724d41d09399522d6d25
MD5 dd8c7785375c8f197b255bef71d19a24
BLAKE2b-256 f26383bc7f030691b9f0dac84e324754369443e9211dc78ba42b9cdd2f7044e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vectoralign-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for vectoralign-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90e13dba4f02a8b35cf83b6b68650e7bfa6276e2b8c20b470caf40b6156c4683
MD5 f9e46e1b57d429b3d10989a4923343fb
BLAKE2b-256 fc8716c0e38188d38e6d813e7c09b832beeec475fa996f07273aaac81cbdf781

See more details on using hashes here.

Supported by

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