Gale-Church Sentence Alignment
A fast, multi-core implementation of the Gale-Church algorithm for aligning sentences in bilingual
corpora, with a Rust core (via PyO3/maturin) exposed as
the galechurch pip package.
Installation
pip install galechurch
# or, for the parameter-calibration tools (needs numpy):
pip install galechurch[calibrate]
Prebuilt wheels are published for common platforms (Linux x86_64/aarch64, macOS x86_64/arm64,
Windows x86_64); an sdist is also published, so pip install falls back to a source build
(requires a Rust toolchain) on any platform without a matching wheel.
Library usage
import galechurch
result = galechurch.align(source_sentences, target_sentences)
print(result.to_pharaoh_lines()) # ["[0]:[0]", "[1]:[1, 2]", ...]
bead_costs, mean_xy, and variance_xy default to the values the original align program shipped
with (estimated from the UBS trilingual corpus; Gale & Church 1993, Table 5 and section 4), and can be
overridden per call:
result = galechurch.align(
source_sentences,
target_sentences,
bead_costs={(1, 1): 0.0, (2, 2): 400.0}, # only override the keys you need; rest keep defaults
mean_xy=1.05,
variance_xy=7.2,
)
For a whole corpus of matched source/target file pairs, galechurch.align_corpus aligns every block
of every file in a single call, using all available CPU cores:
from galechurch import align_corpus
results = align_corpus("./eval_data/parice/eng", "./eval_data/parice/isl", "./output/parice")
CLI usage
The galechurch console script mirrors the library API and the original CLI's flag names:
galechurch -src ./eval_data/parice/eng -trg ./eval_data/parice/isl -out ./output/parice
Calibrating for a new language pair or data type
Given a hand-aligned gold corpus, galechurch-calibrate (or galechurch.calibrate as a library)
estimates bead costs and length-cost parameters following the procedure in the original paper
(section 4, Table 5), and saves them as a reusable JSON profile:
galechurch-calibrate -src mydata/source.txt -trg mydata/target.txt -gold mydata/gold.txt -out my_profile.json
galechurch --profile my_profile.json -src ./mydata/source_dir -trg ./mydata/target_dir -out ./output
Evaluating alignments
evaluate.py (a dev-only script, not part of the pip package) compares generated alignments against
gold-standard files, reporting strict and lax precision/recall/F1:
python3 evaluate.py -t ./output/parice -g ./eval_data/parice/gold
You can also evaluate individual files:
python3 evaluate.py -t ./output/parice/u_1.txt -g ./eval_data/parice/gold/u_1.txt
The ./eval_data folder contains two evaluation sets used by the test suite: the German-French
evaluation set from the Text+Berg corpus, and an English-Icelandic evaluation set from the ParIce
corpus.
Citations
If you use the code in this repository, please cite the original Gale-Church paper:
@article{gale-church-1993-program,
title = "A Program for Aligning Sentences in Bilingual Corpora",
author = "Gale, William A. and Church, Kenneth W.",
journal = "Computational Linguistics",
volume = "19",
number = "1",
year = "1993",
url = "https://aclanthology.org/J93-1004",
pages = "75--102",
}
Evaluation sets
If you use the evaluation sets provided in this repository, please consider citing the original papers where the evaluation sets were first used. For the German-French evaluation set, please cite the Bleualign paper:
BleuAlign
@inproceedings{Sennrich2010MTbasedSA,
title = {{MT-based Sentence Alignment for OCR-generated Parallel Texts}},
author = "Rico Sennrich and Martin Volk",
booktitle = "Proceedings of the 9th Conference of the Association for Machine Translation in the Americas: Research Papers",
address = "Denver, Colorado",
year = "2010",
publisher = "Association for Machine Translation in the Americas",
url = "https://aclanthology.org/2010.amta-papers.14",
}
ParIce evaluation set
The parice folder contains an evaluation set for English-Icelandic sentence alignment from 10 aligned documents in five subcorpora of the ParIce corpus. The evaluation set is distributed under a CC BY 4.0 license. If you use that evaluation set, please consider citing the ParIce paper and the SentAlign paper where the evaluation set was first used.
The ParIce paper:
@inproceedings{barkarson-steingrimsson-2019-compiling,
title = {{Compiling and Filtering {P}ar{I}ce: An {E}nglish-{I}celandic Parallel Corpus}},
author = "Barkarson, Starka{\dh}ur and Steingr{\'\i}msson, Stein{\th}{\'o}r",
booktitle = "Proceedings of the 22nd Nordic Conference on Computational Linguistics",
month = sep # "{--}" # oct,
year = "2019",
address = "Turku, Finland",
publisher = {Link{\"o}ping University Electronic Press},
url = "https://aclanthology.org/W19-6115",
pages = "140--145",
}
Metadata
Release files for galechurch 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| galechurch-0.1.0.tar.gz | 174.4 kB | With provenance | Details for galechurch-0.1.0.tar.gz |
Built distributions (wheels)
Total release size: 2.5 MB
Release files / galechurch-0.1.0.tar.gz
| Download URL | galechurch-0.1.0.tar.gz |
|---|---|
| Size | 174.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b3c308f43d380397d3a6a0bf1b64f6348f8c11694a783b4f236b272b5ac5546
|
|
BLAKE2b-256 checksum How to use checksums |
6936d3bce5814ed982519f825ed0673fead916048a82d216ac0a9bad63288b87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency logRelease files / galechurch-0.1.0-cp310-abi3-win_amd64.whl
| Download URL | galechurch-0.1.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 175.9 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1ffb9e002ae1d1d20ba94a9fee5eb5eab1ac2420a25bc7ab86722a9d20f409a8
|
|
BLAKE2b-256 checksum How to use checksums |
52827880fcc4fc008b01539608e55343394d9c4758458da568e6b80fb0491052
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency logRelease files / galechurch-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | galechurch-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 511.5 kB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b363db462ae1e50c0269c568acb1ecca38f5ee20cca595b4a7e17e48dde47c38
|
|
BLAKE2b-256 checksum How to use checksums |
7f080441e5e6406ab2f265a16d5027a6af945a113ca397a51437fccf1f4393a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency logRelease files / galechurch-0.1.0-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | galechurch-0.1.0-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 473.8 kB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
438f7013fe698566e441d5927f89e17bb84a94f51a0488e8c51a7cf3d8c28b25
|
|
BLAKE2b-256 checksum How to use checksums |
38799302a89c470140faee6fe381fd0683ebc69aeaebdfb1e7a7cfe4110c2148
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency logRelease files / galechurch-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | galechurch-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 300.1 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a0e28e2cb3a5ee27b0ec83482db3236ea7fe6fab98aa18dd3f2915614cde222e
|
|
BLAKE2b-256 checksum How to use checksums |
3ce86c75aec01e520efb036635af610dd5dde5098f8b76133c49579ad555349f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency logRelease files / galechurch-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | galechurch-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 296.9 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
34dd338dabaf5ec874b01addbbfe286caafddfe05cab0a8143cd6f68c27a33c1
|
|
BLAKE2b-256 checksum How to use checksums |
8c0751235672ee4333bbeb5a3de75d7e4c19623d39bb165e6a0aa65fa9968347
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency logRelease files / galechurch-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | galechurch-0.1.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 265.4 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ab0b9e38b30daabf00d4d07585f3b54f21a716fe74667957145ce76a206bbd64
|
|
BLAKE2b-256 checksum How to use checksums |
b34a4c172fcb2267f05d7cd089a12ab7c3478c2e3c097ba5ecbbf2fe71e97724
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency logRelease files / galechurch-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | galechurch-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 274.5 kB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
0ec7ed106757ac2041437d08c80426809098ff45fdfe92105c6dbb48eb9b1ef0
|
|
BLAKE2b-256 checksum How to use checksums |
2d8372511d02669ae3206fada58e449111b1d050a0ae6ff883d634f6e3c5876e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency logSecurity for galechurch 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for galechurch-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.