Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
[EMNLP 2020] Obtain Word Alignments using Pretrained Language Models (e.g., mBERT)
| Date | Stars |
|---|---|
| 2026-07-31 | 398 |
| 2026-08-04 | 398 |
| 2026-08-13 | 399 |
| 2026-08-21 | 398 |
| 2026-09-13 | 397 |
| 2026-09-15 | 397 |
| 2026-09-20 | 397 |
Today
— stars today
This week
— stars this week
This month
-1 stars this month
Momentum
0.0
growth rate 0.00%/day
SimAlign: Similarity Based Word Aligner
==============
<p align="center">
<br>
<img alt="Alignment Example" src="https://raw.githubusercontent.com/cisnlp/simalign/master/assets/example.png" width="300"/>
<br>
<p>
SimAlign is a high-quality word alignment tool that uses static and contextualized embeddings and **does not require parallel training data**.
The following table shows how it compares to popular statistical alignment models:
| | ENG-CES | ENG-DEU | ENG-FAS | ENG-FRA | ENG-HIN | ENG-RON |
| ---------- | ------- | ------- | ------- | ------- | ------- | ------- |
| fast-align | .78 | .71 | .46 | .84 | .38 | .68 |
| eflomal | .85 | .77 | .63 | .93 | .52 | .72 |
| mBERT-Argmax | .87 | .81 | .67 | .94 | .55 | .65 |
Shown is F1, maximum across subword and word level. For more details see the [Paper](https://arxiv.org/pdf/2004.08728.pdf).
Installation and Usage
--------
Tested with Python 3.7, Transformers 3.1.0, Torch 1.5.0. Networkx 2.4 is optional (only required for Match algorithm).
For full list of dependencies see `setup.py`.
For installation of transformers see [their repo](https://github.com/huggingface/transformers#installation).
Download the repo for use or alternatively install with PyPi
`pip install simalign`
or directly with pip from GitHub
`pip install --upgrade git+https://github.com/cisnlp/simalign.git#egg=simalign`
An example for using our code:
```python
from simalign import SentenceAligner
# making an instance of our model.
# You can specify the embedding model and all alignment settings in the constructor.
myaligner = SentenceAligner(model="bert", token_type="bpe", matching_methods="mai")
# The source and target sentences should be tokenized to words.
src_sentence = ["This", "is", "a", "test", "."]
trg_sentence = ["Das", "ist", "ein", "Test", "."]
# The output is a dictionary with different matching methods.
# Each method has a list of pairs indicating the indexes of aligned words (The alignments are zero-indexed).
alignments = myaligner.get_word_aligns(src_sentence, trg_sentence)
for matching_method in alignments:
print(matching_method, ":", alignments[matching_method])
# Expected output:
# mwmf (Match): [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)]
# inter (ArgMax): [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)]
# itermax (IterMax): [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)]
```
For more examples of how to use our code see `scripts/align_example.py`.
Demo
--------
An online demo is available [here](https://simalign.cis.lmu.de/).
Gold Standards
--------
Links to the gold standars used in the paper are here:
| Language Pair | Citation | Type |Link |
| ------------- | ------------- | ------------- | ------------- |
| ENG-CES | Marecek et al. 2008 | Gold Alignment | http://ufal.mff.cuni.cz/czech-english-manual-word-alignment |
| ENG-DEU | EuroParl-based | Gold Alignment | www-i6.informatik.rwth-aachen.de/goldAlignment/ |
| ENG-FAS | Tvakoli et al. 2014 | Gold Alignment | http://eceold.ut.ac.ir/en/node/940 |
| ENG-FRA | WPT2003, Och et al. 2000,| Gold Alignment | http://web.eecs.umich.edu/~mihalcea/wpt/ |
| ENG-HIN | WPT2005 | Gold Alignment | http://web.eecs.umich.edu/~mihalcea/wpt05/ |
| ENG-RON | WPT2005 Mihalcea et al. 2003 | Gold Alignment | http://web.eecs.umich.edu/~mihalcea/wpt05/ |
Evaluation Script
--------
For evaluating the output alignments use `scripts/calc_align_score.py`.
The gold alignment file should have the same format as SimAlign outputs.
Sure alignment edges in the gold standard have a '-' between the source and the target indices and the possible edges have a 'p' between indices.
For sample parallel sentences and their gold alignments from ENG-DEU, see `samples`.
Publication
--------
If you use the code, please cite
```
@inproceedings{jalili-sabet-etal-2020-simalign,
title = "{S}im{A}lign: High Quality Word Alignments without Parallel TraExcerpt of 5,414 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:08269e1518c948bc, llm:Description: "Obtain Word Alignments using Pretrained Language Models (e.g., mBERT)"; EMNLP 2020 paper. Language: Python. Repository implements methods for word alignment using pretrained language models (NLP).
matched fp:08269e1518c948bc, llm:Description: "Obtain Word Alignments using Pretrained Language Models (e.g., mBERT)"; EMNLP 2020 paper. Language: Python. Repository implements methods for word alignment using pretrained language models (NLP).
matched fp:08269e1518c948bc, llm:Description: "Obtain Word Alignments using Pretrained Language Models (e.g., mBERT)"; EMNLP 2020 paper. Language: Python. Repository implements methods for word alignment using pretrained language models (NLP).